diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a73ea944..91b370b2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,6 +39,7 @@ env: jobs: runner-selection: + if: ${{ !((github.event_name == 'push' && github.ref == 'refs/heads/fix/route-params-export') || (github.event_name == 'pull_request' && github.head_ref == 'fix/route-params-export')) }} name: Runner Selection runs-on: ${{ github.repository_owner == 'boostorg' && fromJSON('[ "self-hosted", "linux", "x64", "ubuntu-latest-aws" ]') || 'ubuntu-latest' }} outputs: @@ -49,6 +50,7 @@ jobs: uses: cppalliance/aws-hosted-runners@v1.0.0 build: + if: ${{ !((github.event_name == 'push' && github.ref == 'refs/heads/fix/route-params-export') || (github.event_name == 'pull_request' && github.head_ref == 'fix/route-params-export')) }} needs: [ runner-selection ] defaults: run: diff --git a/.github/workflows/windows-quick.yml b/.github/workflows/windows-quick.yml new file mode 100644 index 00000000..878cef65 --- /dev/null +++ b/.github/workflows/windows-quick.yml @@ -0,0 +1,194 @@ +name: Windows Quick CI + +on: + push: + branches: + - fix/route-params-export + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + workflow_dispatch: + +concurrency: + group: ${{ format('windows-quick:{0}', github.ref) }} + cancel-in-progress: true + +env: + GIT_FETCH_JOBS: 8 + NET_RETRY_COUNT: 5 + DEFAULT_BUILD_VARIANT: debug,release + TZ: "Europe/London" + +jobs: + windows: + if: ${{ github.event_name != 'pull_request' || github.head_ref == 'fix/route-params-export' }} + name: ${{ matrix.name }} + runs-on: windows-2022 + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + include: + - name: "MSVC 14.34 (shared, x64)" + compiler: "msvc" + version: "14.34" + cxxstd: "17,20" + latest-cxxstd: "20" + b2-toolset: "msvc-14.3" + generator: "Visual Studio 17 2022" + shared: true + build-type: "Release" + + - name: "MSVC 14.34 (shared, x86)" + compiler: "msvc" + version: "14.34" + cxxstd: "17,20" + latest-cxxstd: "20" + b2-toolset: "msvc-14.3" + generator: "Visual Studio 17 2022" + shared: true + build-type: "Release" + x86: true + + - name: "MinGW (shared)" + compiler: "mingw" + version: "*" + cxx: "g++" + cc: "gcc" + b2-toolset: "gcc" + generator: "MinGW Makefiles" + shared: true + build-type: "Debug" + + steps: + - name: Clone Boost.HTTP.Proto + uses: actions/checkout@v3 + with: + path: http-proto-root + + - name: Clone Boost.Buffers + uses: actions/checkout@v3 + with: + path: buffers-root + repository: cppalliance/buffers + ref: develop + + - name: Clone Boost.Capy + uses: actions/checkout@v3 + with: + path: capy-root + repository: cppalliance/capy + ref: develop + + - name: Setup C++ + uses: alandefreitas/cpp-actions/setup-cpp@v1.9.0 + id: setup-cpp + with: + compiler: ${{ matrix.compiler }} + version: ${{ matrix.version }} + trace-commands: true + + - name: Install Packages (Windows) + uses: alandefreitas/cpp-actions/package-install@v1.9.0 + id: package-install-windows + with: + vcpkg: zlib brotli + vcpkg-dir: vcpkg-root + vcpkg-triplet: ${{ matrix.x86 && 'x86-windows-static' || 'x64-windows' }} + + - name: Clone Boost + uses: alandefreitas/cpp-actions/boost-clone@v1.9.0 + id: boost-clone + with: + branch: ${{ (github.ref_name == 'master' && github.ref_name) || 'develop' }} + boost-dir: boost-source + modules-exclude-paths: '' + scan-modules-dir: | + http-proto-root + buffers-root + capy-root + scan-modules-ignore: | + http_proto + buffers + capy + + - name: Patch user-config.jam (Windows) + id: patch-user-config + shell: bash + run: | + set -xe + home=$(pwd) + + triplet=${{ matrix.x86 && 'x86-windows-static' || 'x64-windows' }} + addrmdl=${{ matrix.x86 && '32' || '64' }} + + echo "import-search ${home}/boost-root/libs/capy/build ;" | sed 's/\/d\//D:\//g' >> user-config.jam + echo "using zlib : : \"${home}/vcpkg-root/installed/${triplet}/include\" \"${home}/vcpkg-root/installed/${triplet}/lib\" \"${home}/vcpkg-root/installed/${triplet}/bin\" zlib : ${addrmdl} ;" | sed 's/\/d\//D:\//g' >> user-config.jam + echo "using brotli : : \"${home}/vcpkg-root/installed/${triplet}/include\" \"${home}/vcpkg-root/installed/${triplet}/lib\" \"${home}/vcpkg-root/installed/${triplet}/bin\" : ${addrmdl} ;" | sed 's/\/d\//D:\//g' >> user-config.jam + + cat user-config.jam + + toolchain=$(echo "$GITHUB_WORKSPACE/vcpkg-root/scripts/buildsystems/vcpkg.cmake" | sed 's/\/d\//D:\//g' ) + echo "toolchain=${toolchain}" >> $GITHUB_OUTPUT + + - name: Patch Boost + id: patch + shell: bash + run: | + set -xe + module=${GITHUB_REPOSITORY#*/} + echo "module=$module" >> $GITHUB_OUTPUT + + workspace_root=$(echo "$GITHUB_WORKSPACE" | sed 's/\\/\//g') + echo -E "workspace_root=$workspace_root" >> $GITHUB_OUTPUT + + rm -r "boost-source/libs/$module" || true + + cp -r boost-source boost-root + + cd boost-root + boost_root="$(pwd)" + boost_root=$(echo "$boost_root" | sed 's/\\/\//g') + echo -E "boost_root=$boost_root" >> $GITHUB_OUTPUT + + cp -r "$workspace_root"/http-proto-root "libs/$module" + cp -r "$workspace_root"/buffers-root libs/buffers + cp -r "$workspace_root"/capy-root libs/capy + + - name: Boost B2 Workflow + uses: alandefreitas/cpp-actions/b2-workflow@v1.9.0 + env: + ASAN_OPTIONS: detect_invalid_pointer_pairs=2:strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1 + with: + source-dir: boost-root + modules: http_proto + toolset: ${{ matrix.b2-toolset }} + build-variant: ${{ matrix.build-type }} + cxx: ${{ steps.setup-cpp.outputs.cxx || matrix.cxx || '' }} + cxxstd: ${{ matrix.cxxstd }} + address-model: ${{ (matrix.x86 && '32') || '64' }} + shared: ${{ matrix.shared }} + rtti: on,off + user-config: ${{ format('{0}/user-config.jam', steps.patch.outputs.workspace_root) }} + stop-on-error: true + + - name: Root Project CMake Workflow + uses: alandefreitas/cpp-actions/cmake-workflow@v1.9.0 + if: ${{ matrix.compiler == 'msvc' }} + with: + source-dir: boost-root/libs/${{ steps.patch.outputs.module }} + build-dir: __build_root_test__ + build-target: tests + run-tests: true + generator: ${{ matrix.generator }} + build-type: ${{ matrix.build-type }} + install: false + cxxstd: ${{ matrix.latest-cxxstd }} + cc: ${{ steps.setup-cpp.outputs.cc || matrix.cc }} + cxx: ${{ steps.setup-cpp.outputs.cxx || matrix.cxx }} + shared: ${{ matrix.shared }} + cmake-version: '>=3.20' + extra-args: | + -D Boost_VERBOSE=ON + -D BOOST_INCLUDE_LIBRARIES="${{ steps.patch.outputs.module }}" + export-compile-commands: false + toolchain: ${{ steps.patch-user-config.outputs.toolchain }} diff --git a/CLAUDE.md b/CLAUDE.md index 912365a4..358fe086 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -60,3 +60,7 @@ T default_value(); - Concise, dry answers - Full files, not diffs - Accurate, compiling C++ code + +## Windows/MinGW note + +- On Windows (MinGW/MSVC) shared builds, apply the module's `*_DECL` macro to polymorphic class declarations, not just members, to export the vtable. diff --git a/include/boost/http_proto/detail/config.hpp b/include/boost/http_proto/detail/config.hpp index 2a3f0ad3..fe554484 100644 --- a/include/boost/http_proto/detail/config.hpp +++ b/include/boost/http_proto/detail/config.hpp @@ -33,6 +33,18 @@ namespace http_proto { # define BOOST_HTTP_PROTO_DECL # endif +// MSVC-only helpers to locally suppress benign DLL-interface warnings +# if defined(BOOST_MSVC) +# define BOOST_HTTP_PROTO_MSVC_WARNING_PUSH __pragma(warning(push)) +# define BOOST_HTTP_PROTO_MSVC_WARNING_POP __pragma(warning(pop)) +# define BOOST_HTTP_PROTO_MSVC_DISABLE_4251_4275 \ + __pragma(warning(disable:4251 4275)) +# else +# define BOOST_HTTP_PROTO_MSVC_WARNING_PUSH +# define BOOST_HTTP_PROTO_MSVC_WARNING_POP +# define BOOST_HTTP_PROTO_MSVC_DISABLE_4251_4275 +# endif + # if !defined(BOOST_HTTP_PROTO_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_HTTP_PROTO_NO_LIB) # define BOOST_LIB_NAME boost_http_proto # if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_HTTP_PROTO_DYN_LINK) diff --git a/include/boost/http_proto/detail/header.hpp b/include/boost/http_proto/detail/header.hpp index 7c54bb63..e769d664 100644 --- a/include/boost/http_proto/detail/header.hpp +++ b/include/boost/http_proto/detail/header.hpp @@ -44,7 +44,10 @@ struct empty kind param; }; -struct header +BOOST_HTTP_PROTO_MSVC_WARNING_PUSH +BOOST_HTTP_PROTO_MSVC_DISABLE_4251_4275 + +struct BOOST_HTTP_PROTO_DECL header { // +------------+---------+------+------------+-----------------------------+ // | start-line | headers | \r\n | free space | entry[count-1] ... entry[0] | @@ -157,20 +160,16 @@ struct header static header& get(fields_base& f) noexcept; - BOOST_HTTP_PROTO_DECL static header const* get_default(detail::kind k) noexcept; // called from parser explicit header(empty) noexcept; - BOOST_HTTP_PROTO_DECL header(detail::kind) noexcept; - BOOST_HTTP_PROTO_DECL void swap(header&) noexcept; - BOOST_HTTP_PROTO_DECL bool keep_alive() const noexcept; static std::size_t bytes_needed( @@ -222,6 +221,8 @@ struct header system::error_code&) noexcept; }; +BOOST_HTTP_PROTO_MSVC_WARNING_POP + } // detail } // http_proto } // boost diff --git a/include/boost/http_proto/fields_base.hpp b/include/boost/http_proto/fields_base.hpp index 01b96f04..8ce5fb31 100644 --- a/include/boost/http_proto/fields_base.hpp +++ b/include/boost/http_proto/fields_base.hpp @@ -32,7 +32,7 @@ namespace http_proto { @note HTTP field names are case-insensitive. */ -class fields_base +class BOOST_HTTP_PROTO_DECL fields_base { detail::header h_; std::size_t max_cap_ = @@ -74,32 +74,32 @@ class fields_base friend class parser; friend class serializer; - BOOST_HTTP_PROTO_DECL + explicit fields_base( detail::kind k) noexcept; - BOOST_HTTP_PROTO_DECL + fields_base( detail::kind k, void* storage, std::size_t cap) noexcept; - BOOST_HTTP_PROTO_DECL + fields_base( detail::kind k, core::string_view s); - BOOST_HTTP_PROTO_DECL + explicit fields_base( detail::header const& h); - BOOST_HTTP_PROTO_DECL + fields_base( fields_base const&); - BOOST_HTTP_PROTO_DECL + fields_base( detail::header const& h, void* storage, @@ -168,7 +168,7 @@ class fields_base std::string value; /// Constructor. - BOOST_HTTP_PROTO_DECL + value_type( reference const& other); @@ -211,7 +211,7 @@ class fields_base /** Destructor. */ - BOOST_HTTP_PROTO_DECL + ~fields_base(); //-------------------------------------------- @@ -283,7 +283,7 @@ class fields_base @param id The field name constant. */ - BOOST_HTTP_PROTO_DECL + core::string_view at(field id) const; @@ -305,13 +305,13 @@ class fields_base @param name The field name. */ - BOOST_HTTP_PROTO_DECL + core::string_view at(core::string_view name) const; /** Return true if a field exists. */ - BOOST_HTTP_PROTO_DECL + bool exists(field id) const noexcept; @@ -323,7 +323,7 @@ class fields_base @param name The field name. */ - BOOST_HTTP_PROTO_DECL + bool exists( core::string_view name) const noexcept; @@ -332,7 +332,7 @@ class fields_base @param id The field name constant. */ - BOOST_HTTP_PROTO_DECL + std::size_t count(field id) const noexcept; @@ -344,7 +344,7 @@ class fields_base @param name The field name. */ - BOOST_HTTP_PROTO_DECL + std::size_t count( core::string_view name) const noexcept; @@ -353,7 +353,7 @@ class fields_base @param id The field name constant. */ - BOOST_HTTP_PROTO_DECL + iterator find(field id) const noexcept; @@ -365,7 +365,7 @@ class fields_base @param name The field name. */ - BOOST_HTTP_PROTO_DECL + iterator find( core::string_view name) const noexcept; @@ -377,7 +377,7 @@ class fields_base @param id The field name constant. */ - BOOST_HTTP_PROTO_DECL + iterator find( iterator from, @@ -394,7 +394,7 @@ class fields_base @param name The field name. */ - BOOST_HTTP_PROTO_DECL + iterator find( iterator from, @@ -408,7 +408,7 @@ class fields_base @param id The field name constant. */ - BOOST_HTTP_PROTO_DECL + iterator find_last( iterator before, @@ -426,7 +426,7 @@ class fields_base @param name The field name. */ - BOOST_HTTP_PROTO_DECL + iterator find_last( iterator before, @@ -439,7 +439,7 @@ class fields_base @param s The value to be returned if field does not exist. */ - BOOST_HTTP_PROTO_DECL + core::string_view value_or( field id, @@ -456,7 +456,7 @@ class fields_base @param s The value to be returned if field does not exist. */ - BOOST_HTTP_PROTO_DECL + core::string_view value_or( core::string_view name, @@ -466,7 +466,7 @@ class fields_base @param id The field name constant. */ - BOOST_HTTP_PROTO_DECL + subrange find_all(field id) const noexcept; @@ -478,7 +478,7 @@ class fields_base @param name The field name. */ - BOOST_HTTP_PROTO_DECL + subrange find_all( core::string_view name) const noexcept; @@ -519,7 +519,7 @@ class fields_base @par Complexity Constant. */ - BOOST_HTTP_PROTO_DECL + void clear() noexcept; @@ -545,7 +545,7 @@ class fields_base @param n The capacity in bytes. */ - BOOST_HTTP_PROTO_DECL + void reserve_bytes(std::size_t n); @@ -574,7 +574,7 @@ class fields_base @param n The maximum allowed capacity in bytes. */ - BOOST_HTTP_PROTO_DECL + void set_max_capacity_in_bytes(std::size_t n); @@ -584,7 +584,7 @@ class fields_base Strong guarantee. Calls to allocate may throw. */ - BOOST_HTTP_PROTO_DECL + void shrink_to_fit(); @@ -835,7 +835,7 @@ class fields_base @param value The value which must be semantically valid for the message. */ - BOOST_HTTP_PROTO_DECL + iterator insert( iterator before, @@ -884,7 +884,7 @@ class fields_base @param ec Set to the error if input is invalid. */ - BOOST_HTTP_PROTO_DECL + iterator insert( iterator before, @@ -936,7 +936,7 @@ class fields_base @param value The value which must be semantically valid for the message. */ - BOOST_HTTP_PROTO_DECL + iterator insert( iterator before, @@ -985,7 +985,7 @@ class fields_base @param ec Set to the error if input is invalid. */ - BOOST_HTTP_PROTO_DECL + iterator insert( iterator before, @@ -1012,7 +1012,7 @@ class fields_base @param it The iterator to the element to erase. */ - BOOST_HTTP_PROTO_DECL + iterator erase(iterator it) noexcept; @@ -1033,7 +1033,7 @@ class fields_base @param id The field name constant. */ - BOOST_HTTP_PROTO_DECL + std::size_t erase(field id) noexcept; @@ -1054,7 +1054,7 @@ class fields_base @param name The header name. */ - BOOST_HTTP_PROTO_DECL + std::size_t erase( core::string_view name) noexcept; @@ -1091,7 +1091,7 @@ class fields_base @param value The value which must be semantically valid for the message. */ - BOOST_HTTP_PROTO_DECL + void set(iterator it, core::string_view value); @@ -1123,7 +1123,7 @@ class fields_base @param ec Set to the error if input is invalid. */ - BOOST_HTTP_PROTO_DECL + void set( iterator it, @@ -1210,7 +1210,7 @@ class fields_base @param ec Set to the error if input is invalid. */ - BOOST_HTTP_PROTO_DECL + void set( field id, @@ -1296,7 +1296,7 @@ class fields_base @param ec Set to the error if input is invalid. */ - BOOST_HTTP_PROTO_DECL + void set( core::string_view name, @@ -1337,6 +1337,7 @@ class fields_base @param f The container to write. */ friend + BOOST_HTTP_PROTO_DECL std::ostream& operator<<( @@ -1344,12 +1345,12 @@ class fields_base const fields_base& f); private: - BOOST_HTTP_PROTO_DECL + void copy_impl( detail::header const&); - BOOST_HTTP_PROTO_DECL + void insert_impl( optional id, diff --git a/include/boost/http_proto/header_limits.hpp b/include/boost/http_proto/header_limits.hpp index 0f8be356..cddfe595 100644 --- a/include/boost/http_proto/header_limits.hpp +++ b/include/boost/http_proto/header_limits.hpp @@ -21,7 +21,7 @@ namespace http_proto { Objects of this type are used to configure upper limits for HTTP headers. */ -struct header_limits +struct BOOST_HTTP_PROTO_DECL header_limits { /** Largest allowed size for complete headers. @@ -116,7 +116,6 @@ struct header_limits number of contiguous bytes of storage that would be needed at these settings. */ - BOOST_HTTP_PROTO_DECL std::size_t valid_space_needed() const; }; diff --git a/include/boost/http_proto/message_base.hpp b/include/boost/http_proto/message_base.hpp index 24e3a995..7c44b410 100644 --- a/include/boost/http_proto/message_base.hpp +++ b/include/boost/http_proto/message_base.hpp @@ -32,7 +32,7 @@ namespace http_proto { @ref static_request, @ref metadata. */ -class message_base +class BOOST_HTTP_PROTO_DECL message_base : public fields_base { friend class request_base; @@ -126,7 +126,7 @@ class message_base @param n The payload size to set. */ - BOOST_HTTP_PROTO_DECL + void set_payload_size( std::uint64_t n); @@ -143,7 +143,7 @@ class message_base @param n The Content-Length to set. */ - BOOST_HTTP_PROTO_DECL + void set_content_length( std::uint64_t n); @@ -160,7 +160,7 @@ class message_base @param value The value to set. */ - BOOST_HTTP_PROTO_DECL + void set_chunked(bool value); @@ -182,7 +182,7 @@ class message_base @param value The value to set. */ - BOOST_HTTP_PROTO_DECL + void set_keep_alive(bool value); }; diff --git a/include/boost/http_proto/parser.hpp b/include/boost/http_proto/parser.hpp index 6af8c8dd..d8dfb49b 100644 --- a/include/boost/http_proto/parser.hpp +++ b/include/boost/http_proto/parser.hpp @@ -70,7 +70,7 @@ class static_response; @ref response_parser, @ref request_parser. */ -class parser +class BOOST_HTTP_PROTO_DECL parser { public: struct config_base; @@ -98,7 +98,7 @@ class parser @ref response_parser::get, @ref request_parser::get. */ - BOOST_HTTP_PROTO_DECL + bool got_header() const noexcept; @@ -112,14 +112,14 @@ class parser @ref body, @ref start. */ - BOOST_HTTP_PROTO_DECL + bool is_complete() const noexcept; #if 0 /** Return true if any input was committed. */ - BOOST_HTTP_PROTO_DECL + bool got_some() const noexcept; @@ -153,7 +153,7 @@ class parser This function must be called before parsing the first message in a new stream. */ - BOOST_HTTP_PROTO_DECL + void reset() noexcept; @@ -167,7 +167,7 @@ class parser first message being read from the stream or if the previous message has been fully parsed. */ - BOOST_HTTP_PROTO_DECL + void start(); @@ -195,7 +195,7 @@ class parser @ref commit, @ref commit_eof. */ - BOOST_HTTP_PROTO_DECL + mutable_buffers_type prepare(); @@ -223,7 +223,7 @@ class parser @ref parse, @ref prepare. */ - BOOST_HTTP_PROTO_DECL + void commit( std::size_t n); @@ -241,7 +241,7 @@ class parser @ref parse, @ref prepare. */ - BOOST_HTTP_PROTO_DECL + void commit_eof(); @@ -282,7 +282,7 @@ class parser @ref commit, @ref commit_eof. */ - BOOST_HTTP_PROTO_DECL + void parse( system::error_code& ec); @@ -493,7 +493,7 @@ class parser @see @ref config_base::body_limit. */ - BOOST_HTTP_PROTO_DECL + void set_body_limit(std::uint64_t n); @@ -531,7 +531,7 @@ class parser @see @ref consume_body. */ - BOOST_HTTP_PROTO_DECL + const_buffers_type pull_body(); @@ -551,7 +551,7 @@ class parser @see @ref pull_body. */ - BOOST_HTTP_PROTO_DECL + void consume_body(std::size_t n); @@ -587,7 +587,7 @@ class parser @see @ref is_complete. */ - BOOST_HTTP_PROTO_DECL + core::string_view body() const; @@ -605,7 +605,7 @@ class parser @ref metadata::upgrade, @ref metadata::connection. */ // VFALCO rename to get_leftovers()? - BOOST_HTTP_PROTO_DECL + core::string_view release_buffered_data() noexcept; @@ -614,13 +614,13 @@ class parser friend class response_parser; class impl; - BOOST_HTTP_PROTO_DECL ~parser(); - BOOST_HTTP_PROTO_DECL parser() noexcept; - BOOST_HTTP_PROTO_DECL parser(parser&& other) noexcept; - BOOST_HTTP_PROTO_DECL parser(capy::polystore&, detail::kind); - BOOST_HTTP_PROTO_DECL void assign(parser&& other) noexcept; + ~parser(); + parser() noexcept; + parser(parser&& other) noexcept; + parser(capy::polystore&, detail::kind); + void assign(parser&& other) noexcept; - BOOST_HTTP_PROTO_DECL + void start_impl(bool); @@ -630,19 +630,19 @@ class parser static_response const& safe_get_response() const; - BOOST_HTTP_PROTO_DECL + detail::workspace& ws() noexcept; - BOOST_HTTP_PROTO_DECL + bool is_body_set() const noexcept; - BOOST_HTTP_PROTO_DECL + void set_body_impl(buffers::any_dynamic_buffer&) noexcept; - BOOST_HTTP_PROTO_DECL + void set_body_impl(sink&) noexcept; @@ -766,6 +766,7 @@ struct parser::config_base @ref request_parser::config, @ref request_parser. */ + BOOST_HTTP_PROTO_DECL void install_parser_service( diff --git a/include/boost/http_proto/request.hpp b/include/boost/http_proto/request.hpp index 075d9bcb..d83eefbb 100644 --- a/include/boost/http_proto/request.hpp +++ b/include/boost/http_proto/request.hpp @@ -45,7 +45,7 @@ namespace http_proto { @ref static_request, @ref request_base. */ -class request +class BOOST_HTTP_PROTO_DECL request : public request_base { public: diff --git a/include/boost/http_proto/request_base.hpp b/include/boost/http_proto/request_base.hpp index 450158d3..24dbbc96 100644 --- a/include/boost/http_proto/request_base.hpp +++ b/include/boost/http_proto/request_base.hpp @@ -24,7 +24,7 @@ namespace http_proto { @ref request, @ref static_request. */ -class request_base +class BOOST_HTTP_PROTO_DECL request_base : public message_base { friend class request; @@ -285,12 +285,11 @@ class request_base @param b If `true` sets `Expect: 100-continue` header otherwise erase it. */ - BOOST_HTTP_PROTO_DECL void set_expect_100_continue(bool b); private: - BOOST_HTTP_PROTO_DECL + void set_start_line_impl( http_proto::method m, diff --git a/include/boost/http_proto/request_parser.hpp b/include/boost/http_proto/request_parser.hpp index 9c4ef457..3bbf64d7 100644 --- a/include/boost/http_proto/request_parser.hpp +++ b/include/boost/http_proto/request_parser.hpp @@ -23,7 +23,7 @@ namespace http_proto { /// @copydoc parser /// @brief A parser for HTTP/1 requests. /// @see @ref response_parser. -class request_parser +class BOOST_HTTP_PROTO_DECL request_parser : public parser { public: @@ -138,7 +138,6 @@ class request_parser @ref install_parser_service, @ref config. */ - BOOST_HTTP_PROTO_DECL explicit request_parser(capy::polystore& ctx); @@ -160,7 +159,6 @@ class request_parser @see @ref got_header. */ - BOOST_HTTP_PROTO_DECL static_request const& get() const; }; diff --git a/include/boost/http_proto/response.hpp b/include/boost/http_proto/response.hpp index e4086ec2..8e6f34fd 100644 --- a/include/boost/http_proto/response.hpp +++ b/include/boost/http_proto/response.hpp @@ -47,7 +47,7 @@ namespace http_proto { @ref static_response, @ref response_base. */ -class response +class BOOST_HTTP_PROTO_DECL response : public response_base { public: diff --git a/include/boost/http_proto/response_base.hpp b/include/boost/http_proto/response_base.hpp index aea2ddb9..76f35bc6 100644 --- a/include/boost/http_proto/response_base.hpp +++ b/include/boost/http_proto/response_base.hpp @@ -26,7 +26,7 @@ namespace http_proto { @ref response, @ref static_response. */ -class response_base +class BOOST_HTTP_PROTO_DECL response_base : public message_base { friend class response; @@ -141,7 +141,6 @@ class response_base @param v The version to set. */ - BOOST_HTTP_PROTO_DECL void set_version( http_proto::version v); @@ -221,7 +220,7 @@ class response_base } private: - BOOST_HTTP_PROTO_DECL + void set_start_line_impl( http_proto::status sc, diff --git a/include/boost/http_proto/serializer.hpp b/include/boost/http_proto/serializer.hpp index e0e65d08..3ae6d12a 100644 --- a/include/boost/http_proto/serializer.hpp +++ b/include/boost/http_proto/serializer.hpp @@ -53,7 +53,7 @@ class message_base; called, or the serializer is destroyed, otherwise the behavior is undefined. */ -class serializer +class BOOST_HTTP_PROTO_DECL serializer { public: class stream; @@ -68,8 +68,7 @@ class serializer /** Destructor */ - BOOST_HTTP_PROTO_DECL - ~serializer(); + ~serializer(); /** Constructor Default-constructed serializers do not reference any implementation; @@ -100,8 +99,7 @@ class serializer @param other The serializer to move from. */ - BOOST_HTTP_PROTO_DECL - serializer( + serializer( serializer&& other) noexcept; /** Assignment. @@ -119,7 +117,7 @@ class serializer @param other The serializer to move from. @return A reference to this object. */ - BOOST_HTTP_PROTO_DECL + serializer& operator=(serializer&& other) noexcept; @@ -168,7 +166,7 @@ class serializer @ref install_serializer_service, @ref config. */ - BOOST_HTTP_PROTO_DECL + explicit serializer( capy::polystore& ctx); @@ -179,7 +177,7 @@ class serializer prepares the serializer to start serialization of a new message. */ - BOOST_HTTP_PROTO_DECL + void reset() noexcept; @@ -217,7 +215,7 @@ class serializer @ref message_base. */ void - BOOST_HTTP_PROTO_DECL + start(message_base const& m); /** Start serializing a message with a buffer sequence body @@ -424,7 +422,7 @@ class serializer @ref stream, @ref message_base. */ - BOOST_HTTP_PROTO_DECL + stream start_stream( message_base const& m); @@ -484,7 +482,7 @@ class serializer @ref is_done, @ref const_buffers_type. */ - BOOST_HTTP_PROTO_DECL + auto prepare() -> system::result< @@ -524,13 +522,12 @@ class serializer @ref is_done, @ref const_buffers_type. */ - BOOST_HTTP_PROTO_DECL + void consume(std::size_t n); /** Return true if serialization is complete. */ - BOOST_HTTP_PROTO_DECL bool is_done() const noexcept; @@ -540,22 +537,22 @@ class serializer template class cbs_gen_impl; - BOOST_HTTP_PROTO_DECL + detail::workspace& ws(); - BOOST_HTTP_PROTO_DECL + void start_init( message_base const&); - BOOST_HTTP_PROTO_DECL + void start_buffers( message_base const&, cbs_gen&); - BOOST_HTTP_PROTO_DECL + void start_source( message_base const&, @@ -665,6 +662,7 @@ struct serializer::config @ref serializer::config, @ref serializer. */ + BOOST_HTTP_PROTO_DECL void install_serializer_service( @@ -694,7 +692,7 @@ install_serializer_service( @see @ref serializer::start_stream */ -class serializer::stream +class BOOST_HTTP_PROTO_DECL serializer::stream { public: /** The type used to represent a sequence @@ -774,7 +772,7 @@ class serializer::stream @throw std::logic_error `this->is_open() == false`. */ - BOOST_HTTP_PROTO_DECL + std::size_t capacity() const; @@ -805,8 +803,7 @@ class serializer::stream @ref commit, @ref capacity. */ - BOOST_HTTP_PROTO_DECL - mutable_buffers_type + mutable_buffers_type prepare(); /** Commit data to the serializer. @@ -837,7 +834,7 @@ class serializer::stream @ref prepare, @ref capacity. */ - BOOST_HTTP_PROTO_DECL + void commit(std::size_t n); @@ -855,7 +852,7 @@ class serializer::stream this->is_open() == false @endcode */ - BOOST_HTTP_PROTO_DECL + void close() noexcept; diff --git a/include/boost/http_proto/server/route_handler.hpp b/include/boost/http_proto/server/route_handler.hpp index 399310d5..3c4bee05 100644 --- a/include/boost/http_proto/server/route_handler.hpp +++ b/include/boost/http_proto/server/route_handler.hpp @@ -30,11 +30,12 @@ struct acceptor_config bool is_admin; }; -//----------------------------------------------- +BOOST_HTTP_PROTO_MSVC_WARNING_PUSH +BOOST_HTTP_PROTO_MSVC_DISABLE_4251_4275 /** Parameters object for HTTP route handlers */ -struct BOOST_SYMBOL_VISIBLE +struct BOOST_HTTP_PROTO_DECL route_params : route_params_base { /** The complete request target @@ -82,7 +83,6 @@ struct BOOST_SYMBOL_VISIBLE /** Destructor */ - BOOST_HTTP_PROTO_DECL ~route_params(); /** Reset the object for a new request. @@ -90,7 +90,6 @@ struct BOOST_SYMBOL_VISIBLE the previous request, preparing the object for use with a new request. */ - BOOST_HTTP_PROTO_DECL void reset(); /** Set the status code of the response. @@ -101,11 +100,9 @@ struct BOOST_SYMBOL_VISIBLE @param code The status code to set. @return A reference to this response. */ - BOOST_HTTP_PROTO_DECL route_params& status(http_proto::status code); - BOOST_HTTP_PROTO_DECL route_params& set_body(std::string s); @@ -147,9 +144,9 @@ struct BOOST_SYMBOL_VISIBLE protected: /** A task to be invoked later */ - struct task + struct BOOST_HTTP_PROTO_DECL task { - virtual ~task() = default; + virtual ~task(); /** Invoke the task. @@ -163,7 +160,6 @@ struct BOOST_SYMBOL_VISIBLE Subclasses must schedule task_ to be invoked at an unspecified point in the future. */ - BOOST_HTTP_PROTO_DECL virtual void do_post(); std::unique_ptr task_; diff --git a/include/boost/http_proto/server/router_types.hpp b/include/boost/http_proto/server/router_types.hpp index 39f2306f..eef0b25c 100644 --- a/include/boost/http_proto/server/router_types.hpp +++ b/include/boost/http_proto/server/router_types.hpp @@ -17,6 +17,7 @@ #include #include #include +#include #include namespace boost { @@ -157,7 +158,7 @@ class resumer; This holds an reference to an implementation which detaches the handler from its session. */ -class detacher +class BOOST_HTTP_PROTO_DECL detacher { public: /** Base class of the implementation @@ -291,12 +292,15 @@ class any_router; template class basic_router; +BOOST_HTTP_PROTO_MSVC_WARNING_PUSH +BOOST_HTTP_PROTO_MSVC_DISABLE_4251_4275 + /** Base class for request objects This is a required public base for any `Request` type used with @ref basic_router. */ -class route_params_base +class BOOST_HTTP_PROTO_DECL route_params_base { public: /** The mount path of the current router @@ -333,6 +337,9 @@ class route_params_base bool strict = false; }; + +BOOST_HTTP_PROTO_MSVC_WARNING_POP + } // http_proto } // boost diff --git a/src/fields_base.cpp b/src/fields_base.cpp index ba62e591..6e069b29 100644 --- a/src/fields_base.cpp +++ b/src/fields_base.cpp @@ -850,6 +850,7 @@ find_all( &h_, find(name).i_); } +BOOST_HTTP_PROTO_DECL std::ostream& operator<<( std::ostream& os, diff --git a/src/server/route_handler.cpp b/src/server/route_handler.cpp index 5aad08e1..9036d967 100644 --- a/src/server/route_handler.cpp +++ b/src/server/route_handler.cpp @@ -20,6 +20,9 @@ route_params:: { } +route_params::task:: +~task() = default; + route_params& route_params:: status(