* Fixed compiler errors in the testsmaster
| @@ -51,6 +51,26 @@ namespace cppmicrohttpd | |||||
| */ | */ | ||||
| virtual ~request() = default; | virtual ~request() = default; | ||||
| /** | |||||
| * @brief Get a value from the header. | |||||
| * | |||||
| * @param[in] key Key ot the value to look for. | |||||
| * | |||||
| * @return Header value or empty string if not found. | |||||
| */ | |||||
| inline std::string get_header(const std::string& key) const; | |||||
| /** | |||||
| * @brief Get a value from the header. | |||||
| * | |||||
| * @param[in] key Key ot the value to look for. | |||||
| * @param[out] value Value from the header. | |||||
| * | |||||
| * @retval true If the header value was found. | |||||
| * @retval false If the header value was not found. | |||||
| */ | |||||
| inline bool get_header(const std::string& key, std::string& value) const; | |||||
| /** | /** | ||||
| * @brief Set HTTP error, if an error is already set, the new error is ignored. | * @brief Set HTTP error, if an error is already set, the new error is ignored. | ||||
| * | * | ||||
| @@ -16,6 +16,20 @@ namespace cppmicrohttpd | |||||
| , version (p_version) | , version (p_version) | ||||
| { } | { } | ||||
| std::string request::get_header(const std::string& key) const | |||||
| { | |||||
| std::string value; | |||||
| get_header(key, value); | |||||
| return value; | |||||
| } | |||||
| bool request::get_header(const std::string& key, std::string& value) const | |||||
| { | |||||
| auto v = MHD_lookup_connection_value(connection, MHD_HEADER_KIND, key.c_str()); | |||||
| if (v) value.assign(v); | |||||
| return static_cast<bool>(v); | |||||
| } | |||||
| template<typename T_exception> | template<typename T_exception> | ||||
| void request::set_error(const T_exception& p_error) | void request::set_error(const T_exception& p_error) | ||||
| { | { | ||||
| @@ -7,14 +7,14 @@ extern "C" | |||||
| int MHD_get_fdset2( | int MHD_get_fdset2( | ||||
| struct MHD_Daemon *daemon, | struct MHD_Daemon *daemon, | ||||
| ::cppcore::fdset * read_::cppcore::fdset, | |||||
| ::cppcore::fdset * write_::cppcore::fdset, | |||||
| ::cppcore::fdset * except_::cppcore::fdset, | |||||
| fd_set * read_fdset, | |||||
| fd_set * write_fdset, | |||||
| fd_set * except_fdset, | |||||
| int * max_fd, | int * max_fd, | ||||
| unsigned int ::cppcore::fdsetsize) | |||||
| unsigned int fdsetsize) | |||||
| { | { | ||||
| return libmicrohttpd_mock::instance | return libmicrohttpd_mock::instance | ||||
| ? libmicrohttpd_mock::instance->MHD_get_fdset2(daemon, read_::cppcore::fdset, write_::cppcore::fdset, except_::cppcore::fdset, max_fd, ::cppcore::fdsetsize) | |||||
| ? libmicrohttpd_mock::instance->MHD_get_fdset2(daemon, read_fdset, write_fdset, except_fdset, max_fd, fdsetsize) | |||||
| : MHD_NO; | : MHD_NO; | ||||
| } | } | ||||
| @@ -29,12 +29,12 @@ extern "C" | |||||
| int MHD_run_from_select ( | int MHD_run_from_select ( | ||||
| struct MHD_Daemon * daemon, | struct MHD_Daemon * daemon, | ||||
| const ::cppcore::fdset * read_::cppcore::fdset, | |||||
| const ::cppcore::fdset * write_::cppcore::fdset, | |||||
| const ::cppcore::fdset * except_::cppcore::fdset) | |||||
| const fd_set * read_fdset, | |||||
| const fd_set * write_fdset, | |||||
| const fd_set * except_fdset) | |||||
| { | { | ||||
| return libmicrohttpd_mock::instance | return libmicrohttpd_mock::instance | ||||
| ? libmicrohttpd_mock::instance->MHD_run_from_select(daemon, read_::cppcore::fdset, write_::cppcore::fdset, except_::cppcore::fdset) | |||||
| ? libmicrohttpd_mock::instance->MHD_run_from_select(daemon, read_fdset, write_fdset, except_fdset) | |||||
| : MHD_NO; | : MHD_NO; | ||||
| } | } | ||||
| @@ -10,11 +10,11 @@ public: | |||||
| MOCK_METHOD6( | MOCK_METHOD6( | ||||
| MHD_get_fdset2, | MHD_get_fdset2, | ||||
| int (struct MHD_Daemon *daemon, | int (struct MHD_Daemon *daemon, | ||||
| ::cppcore::fdset * read_::cppcore::fdset, | |||||
| ::cppcore::fdset * write_::cppcore::fdset, | |||||
| ::cppcore::fdset * except_::cppcore::fdset, | |||||
| fd_set * read_fdset, | |||||
| fd_set * write_fdset, | |||||
| fd_set * except_fdset, | |||||
| int * max_fd, | int * max_fd, | ||||
| unsigned int ::cppcore::fdsetsize)); | |||||
| unsigned int fdsetsize)); | |||||
| MOCK_METHOD2( | MOCK_METHOD2( | ||||
| MHD_get_timeout, | MHD_get_timeout, | ||||
| @@ -24,9 +24,9 @@ public: | |||||
| MOCK_METHOD4( | MOCK_METHOD4( | ||||
| MHD_run_from_select, | MHD_run_from_select, | ||||
| int (struct MHD_Daemon * daemon, | int (struct MHD_Daemon * daemon, | ||||
| const ::cppcore::fdset * read_::cppcore::fdset, | |||||
| const ::cppcore::fdset * write_::cppcore::fdset, | |||||
| const ::cppcore::fdset * except_::cppcore::fdset)); | |||||
| const fd_set * read_fdset, | |||||
| const fd_set * write_fdset, | |||||
| const fd_set * except_fdset)); | |||||
| MOCK_METHOD6( | MOCK_METHOD6( | ||||
| MHD_start_daemon, | MHD_start_daemon, | ||||