您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

41 行
980 B

  1. #pragma once
  2. #include "request.h"
  3. namespace cppmicrohttpd
  4. {
  5. request::request(
  6. MHD_Connection * const p_connection,
  7. const std::string& p_url,
  8. const std::string& p_method,
  9. const std::string& p_version)
  10. : connection(p_connection)
  11. , url (p_url)
  12. , method (p_method)
  13. , version (p_version)
  14. { }
  15. std::string request::get_header(const std::string& key) const
  16. {
  17. std::string value;
  18. get_header(key, value);
  19. return value;
  20. }
  21. bool request::get_header(const std::string& key, std::string& value) const
  22. {
  23. auto v = MHD_lookup_connection_value(connection, MHD_HEADER_KIND, key.c_str());
  24. if (v) value.assign(v);
  25. return static_cast<bool>(v);
  26. }
  27. template<typename T_exception>
  28. void request::set_error(const T_exception& p_error)
  29. {
  30. if (!error)
  31. error.reset(new T_exception(p_error));
  32. }
  33. }