15 reinterpret_cast< restinio::impl::http_parser_ctx_t * >(
18 ctx->m_header.append_request_target( at, length );
20 catch(
const std::exception & )
34 reinterpret_cast< restinio::impl::http_parser_ctx_t * >(
37 if( ctx->m_last_was_value )
39 ctx->m_current_field_name.assign( at, length );
40 ctx->m_last_was_value =
false;
44 ctx->m_current_field_name.append( at, length );
47 catch(
const std::exception & )
58 fields.append_last_field( value );
67 reinterpret_cast< restinio::impl::http_parser_ctx_t * >( parser->data );
69 if( !ctx->m_last_was_value )
71 ctx->m_header.set_field(
72 std::move( ctx->m_current_field_name ),
73 std::string{ at, length } );
75 ctx->m_last_was_value =
true;
79 append_last_field_accessor( ctx->m_header, std::string{ at, length } );
82 catch(
const std::exception & )
93 if( ULLONG_MAX != parser->content_length &&
94 0 < parser->content_length )
99 reinterpret_cast< restinio::impl::http_parser_ctx_t * >(
103 ::restinio::utils::impl::uint64_to_size_t(
104 parser->content_length) );
106 catch(
const std::exception & )
122 reinterpret_cast< restinio::impl::http_parser_ctx_t * >(
125 ctx->m_body.append( at, length );
127 catch(
const std::exception & )
135 template<
typename Http_Methods >
140 http_parser_pause( parser, 1 );
143 reinterpret_cast< restinio::impl::http_parser_ctx_t * >(
146 ctx->m_message_complete =
true;
147 ctx->m_header.method( Http_Methods::from_nodejs( parser->method ) );
149 if( 0 == parser->upgrade )
150 ctx->m_header.should_keep_alive( 0 != http_should_keep_alive( parser ) );
152 ctx->m_header.connection( http_connection_header_t::upgrade );
int restinio_url_cb(http_parser *parser, const char *at, size_t length)
void append_last_field_accessor(http_header_fields_t &fields, string_view_t value)
int restinio_body_cb(http_parser *parser, const char *at, size_t length)
int restinio_headers_complete_cb(http_parser *parser)
int restinio_header_value_cb(http_parser *parser, const char *at, size_t length)
int restinio_header_field_cb(http_parser *parser, const char *at, size_t length)
int restinio_message_complete_cb(http_parser *parser)