LCOV - code coverage report
Current view: top level - http/client - client_error.hpp (source / functions) Coverage Total Hit
Test: coverage_filtered.info Lines: 100.0 % 2 2
Test Date: 2026-11-10 10:38:07 Functions: 100.0 % 1 1

            Line data    Source code
       1              : #ifndef THINGER_HTTP_CLIENT_ERROR_HPP
       2              : #define THINGER_HTTP_CLIENT_ERROR_HPP
       3              : 
       4              : #include <type_traits>
       5              : #include <boost/system/error_code.hpp>
       6              : 
       7              : namespace thinger::http {
       8              : 
       9              :     /// Why a response could not be read, or a request not sent (client_response::error_code(),
      10              :     /// stream_result::error). The connection is never reused after any of them.
      11              :     enum class client_error {
      12              :         none = 0,
      13              :         invalid_status_line,        // not "HTTP/1.DIGIT SP 3DIGIT [SP reason] CRLF", or a status out of 100-599
      14              :         invalid_header,             // a malformed header line: bare CR or LF, obs-fold, invalid name or value
      15              :         header_section_too_large,   // too many header lines, or too many bytes
      16              :         invalid_framing,            // invalid Content-Length, Transfer-Encoding other than chunked, or both
      17              :         malformed_body,             // invalid chunked framing
      18              :         body_too_large,             // over the maximum content size of a buffered response, also once decompressed
      19              :         incomplete_response,        // the connection ended before the end of the response
      20              :         unexpected_upgrade,         // 101 Switching Protocols for a request without Upgrade
      21              :         aborted,                    // the streaming callback stopped the download
      22              :         invalid_ca_certificate,     // a CA certificate (file or PEM) could not be loaded
      23              :         proxy_authentication_required,  // the proxy answered CONNECT with 407 (see client_response::status())
      24              :         proxy_tunnel_failed,        // the proxy answered CONNECT with another status than 2xx, or sent data before the origin
      25              :         invalid_proxy,              // the proxy URL is invalid or not supported (only http:// proxies are)
      26              :         bad_content_encoding,       // the body is not valid gzip or deflate, as its Content-Encoding says (corrupt or truncated)
      27              :         invalid_client_certificate, // the client certificate, or a certificate of its chain, could not be read (file or PEM)
      28              :         invalid_client_key,         // the private key of the client certificate could not be read (file or PEM), or is encrypted
      29              :         client_key_mismatch         // the private key is not the one of the client certificate
      30              :     };
      31              : 
      32              :     const boost::system::error_category& client_error_category();
      33              : 
      34          810 :     inline boost::system::error_code make_error_code(client_error error) {
      35          810 :         return {static_cast<int>(error), client_error_category()};
      36              :     }
      37              : 
      38              : }
      39              : 
      40              : template<>
      41              : struct boost::system::is_error_code_enum<thinger::http::client_error> : std::true_type {};
      42              : 
      43              : #endif
        

Generated by: LCOV version 2.0-1