1515#include < boost/http_proto/detail/header.hpp>
1616#include < boost/http_proto/detail/type_traits.hpp>
1717#include < boost/http_proto/detail/workspace.hpp>
18- #include < boost/http_proto/error.hpp>
1918#include < boost/http_proto/header_limits.hpp>
2019#include < boost/http_proto/sink.hpp>
2120
2221#include < boost/buffers/any_dynamic_buffer.hpp>
23- #include < boost/buffers/circular_buffer.hpp>
24- #include < boost/buffers/flat_buffer.hpp>
2522#include < boost/buffers/mutable_buffer_pair.hpp>
2623#include < boost/buffers/mutable_buffer_span.hpp>
2724#include < boost/buffers/type_traits.hpp>
2825#include < boost/rts/context_fwd.hpp>
29- #include < boost/url/grammar/error.hpp>
3026
3127#include < cstddef>
3228#include < cstdint>
@@ -37,10 +33,6 @@ namespace http_proto {
3733// Forward declaration
3834class request_parser ;
3935class response_parser ;
40- namespace detail {
41- class parser_service ;
42- class filter ;
43- } // detail
4436
4537/* * A parser for HTTP/1 messages.
4638
@@ -92,30 +84,6 @@ class parser
9284 using const_buffers_type =
9385 buffers::const_buffer_span;
9486
95- // --------------------------------------------
96- //
97- // Special Members
98- //
99- // --------------------------------------------
100-
101- /* * Constructor (deleted)
102- */
103- // TODO
104- parser (parser&&) = delete ;
105-
106- /* * Assignment (deleted)
107- */
108- // TODO
109- parser& operator =(parser&&) = delete ;
110-
111- /* * Destructor.
112-
113- Any views or buffers obtained from this
114- parser become invalid.
115- */
116- BOOST_HTTP_PROTO_DECL
117- ~parser ();
118-
11987 // --------------------------------------------
12088 //
12189 // Observers
@@ -643,87 +611,47 @@ class parser
643611private:
644612 friend class request_parser ;
645613 friend class response_parser ;
614+ class impl ;
646615
647616 BOOST_HTTP_PROTO_DECL
648617 parser (
649618 const rts::context&,
650619 detail::kind);
651620
652621 BOOST_HTTP_PROTO_DECL
653- void
654- start_impl (bool );
622+ parser (parser&& other) noexcept ;
655623
656624 BOOST_HTTP_PROTO_DECL
657- void
658- on_set_body () noexcept ;
625+ parser& operator =(parser&& other) noexcept ;
659626
660- std::size_t
661- apply_filter (
662- system::error_code&,
663- std::size_t ,
664- bool );
627+ BOOST_HTTP_PROTO_DECL
628+ ~parser ();
629+
630+ BOOST_HTTP_PROTO_DECL
631+ void
632+ start_impl (bool );
665633
666634 detail::header const *
667635 safe_get_header () const ;
668636
637+ BOOST_HTTP_PROTO_DECL
638+ detail::workspace&
639+ ws () noexcept ;
640+
641+ BOOST_HTTP_PROTO_DECL
669642 bool
670- is_plain () const noexcept ;
643+ is_body_set () const noexcept ;
671644
672- std::uint64_t
673- body_limit_remain () const noexcept ;
645+ BOOST_HTTP_PROTO_DECL
646+ void
647+ set_body_impl (buffers::any_dynamic_buffer&) noexcept ;
674648
675- static constexpr unsigned buffers_N = 8 ;
649+ BOOST_HTTP_PROTO_DECL
650+ void
651+ set_body_impl (sink&) noexcept ;
676652
677- enum class state
678- {
679- reset,
680- start,
681- header,
682- header_done,
683- body,
684- set_body,
685- complete_in_place,
686- complete
687- };
688-
689- enum class how
690- {
691- in_place,
692- sink,
693- elastic,
694- };
695-
696- const rts::context& ctx_;
697- detail::parser_service& svc_;
698-
699- detail::workspace ws_;
700- detail::header h_;
701- std::uint64_t body_limit_;
702- std::uint64_t body_total_;
703- std::uint64_t payload_remain_;
704- std::uint64_t chunk_remain_;
705- std::size_t body_avail_;
706- std::size_t nprepare_;
707-
708- buffers::flat_buffer fb_;
709- buffers::circular_buffer cb0_;
710- buffers::circular_buffer cb1_;
711-
712- buffers::mutable_buffer_pair mbp_;
713- buffers::const_buffer_pair cbp_;
714-
715- detail::filter* filter_;
716- buffers::any_dynamic_buffer* eb_;
717- sink* sink_;
718-
719- state st_;
720- how how_;
721- bool got_header_;
722- bool got_eof_;
723- bool head_response_;
724- bool needs_chunk_close_;
725- bool trailer_headers_;
726- bool chunked_body_ended;
653+ static constexpr unsigned buffers_N = 8 ;
654+ impl* impl_;
727655};
728656
729657// ------------------------------------------------
0 commit comments