response.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #ifndef CPR_RESPONSE_H
  2. #define CPR_RESPONSE_H
  3. #include <cassert>
  4. #include <cstdint>
  5. #include <memory>
  6. #include <string>
  7. #include <utility>
  8. #include <vector>
  9. #include "cpr/cert_info.h"
  10. #include "cpr/cookies.h"
  11. #include "cpr/cprtypes.h"
  12. #include "cpr/error.h"
  13. #include "cpr/ssl_options.h"
  14. #include "cpr/util.h"
  15. namespace cpr {
  16. class MultiPerform;
  17. class Response {
  18. private:
  19. friend MultiPerform;
  20. std::shared_ptr<CurlHolder> curl_{nullptr};
  21. public:
  22. // Ignored here since libcurl uses a long for this.
  23. // NOLINTNEXTLINE(google-runtime-int)
  24. long status_code{};
  25. std::string text{};
  26. Header header{};
  27. Url url{};
  28. double elapsed{};
  29. Cookies cookies{};
  30. Error error{};
  31. std::string raw_header{};
  32. std::string status_line{};
  33. std::string reason{};
  34. cpr_off_t uploaded_bytes{};
  35. cpr_off_t downloaded_bytes{};
  36. // Ignored here since libcurl uses a long for this.
  37. // NOLINTNEXTLINE(google-runtime-int)
  38. long redirect_count{};
  39. Response() = default;
  40. Response(std::shared_ptr<CurlHolder> curl, std::string&& p_text, std::string&& p_header_string, Cookies&& p_cookies, Error&& p_error);
  41. std::vector<CertInfo> GetCertInfos();
  42. Response(const Response& other) = default;
  43. Response(Response&& old) noexcept = default;
  44. ~Response() noexcept = default;
  45. Response& operator=(Response&& old) noexcept = default;
  46. Response& operator=(const Response& other) = default;
  47. };
  48. } // namespace cpr
  49. #endif