Bläddra i källkod

* Some small improvements

master
bergmann 6 år sedan
förälder
incheckning
12d65ad6be
3 ändrade filer med 11 tillägg och 11 borttagningar
  1. +3
    -3
      include/cppmicrohttpd/daemon.h
  2. +3
    -3
      include/cppmicrohttpd/daemon.inl
  3. +5
    -5
      src/cppmicrohttpd/damon.cpp

+ 3
- 3
include/cppmicrohttpd/daemon.h Visa fil

@@ -79,9 +79,9 @@ namespace cppmicrohttpd
/** /**
* @brief Get the timeout in milliseconds to wait for the file descriptors. * @brief Get the timeout in milliseconds to wait for the file descriptors.
* *
* @return Timeout how many milliseconds select should at most block.
* @return Timeout how many milliseconds select should at most block (0r -1 if not relevant).
*/ */
inline unsigned long long get_timeout() const;
inline long long get_timeout() const;


protected: protected:
/** /**
@@ -108,7 +108,7 @@ namespace cppmicrohttpd
* @return The created response. * @return The created response.
*/ */
virtual response_ptr_u create_response( virtual response_ptr_u create_response(
const request& p_request);
request& p_request);


/** /**
* @brief Create a default response object. * @brief Create a default response object.


+ 3
- 3
include/cppmicrohttpd/daemon.inl Visa fil

@@ -36,12 +36,12 @@ namespace cppmicrohttpd
return ret; return ret;
} }


unsigned long long daemon::get_timeout() const
long long daemon::get_timeout() const
{ {
unsigned long long timeout = 0; unsigned long long timeout = 0;
if (MHD_get_timeout(_handle.get(), &timeout) != MHD_YES) if (MHD_get_timeout(_handle.get(), &timeout) != MHD_YES)
throw exception("Unable to execute MHD_get_timeout");
return timeout;
return -1;
return static_cast<long long>(timeout);
} }


} }

+ 5
- 5
src/cppmicrohttpd/damon.cpp Visa fil

@@ -38,7 +38,7 @@ request_ptr_u daemon::create_request(
{ return std::make_unique<request>(p_connection, p_url, p_method, p_version); } { return std::make_unique<request>(p_connection, p_url, p_method, p_version); }


response_ptr_u daemon::create_response( response_ptr_u daemon::create_response(
const request& p_request)
request& p_request)
{ return create_default_response(p_request, true); } { return create_default_response(p_request, true); }


response_ptr_u daemon::create_default_response( response_ptr_u daemon::create_default_response(
@@ -144,28 +144,28 @@ int daemon::mhd_access_handler_callback(
{ {
cppmicrohttpd_log(warn) << "Error while handling post data: " << ex; cppmicrohttpd_log(warn) << "Error while handling post data: " << ex;
req.set_error(ex); req.set_error(ex);
*data_size = 0; // Assume that all data has been progressed
*data_size = 0; // Assume that all data has been processed
return MHD_YES; return MHD_YES;
} }
catch(const exception& ex) catch(const exception& ex)
{ {
cppmicrohttpd_log(warn) << "Error while handling post data: " << ex; cppmicrohttpd_log(warn) << "Error while handling post data: " << ex;
req.set_error(ex); req.set_error(ex);
*data_size = 0; // Assume that all data has been progressed
*data_size = 0; // Assume that all data has been processed
return MHD_YES; return MHD_YES;
} }
catch(std::exception& ex) catch(std::exception& ex)
{ {
cppmicrohttpd_log(warn) << "Error while handling post data: " << ex.what(); cppmicrohttpd_log(warn) << "Error while handling post data: " << ex.what();
req.set_error(exception(ex.what())); req.set_error(exception(ex.what()));
*data_size = 0; // Assume that all data has been progressed
*data_size = 0; // Assume that all data has been processed
return MHD_YES; return MHD_YES;
} }
catch(...) catch(...)
{ {
cppmicrohttpd_log(warn) << "Error while handling post data: unknown"; cppmicrohttpd_log(warn) << "Error while handling post data: unknown";
req.set_error(exception("Unknown error")); req.set_error(exception("Unknown error"));
*data_size = 0; // Assume that all data has been progressed
*data_size = 0; // Assume that all data has been processed
return MHD_YES; return MHD_YES;
} }




Laddar…
Avbryt
Spara