MCPcopy Create free account
hub / github.com/3rdparty/libprocess / on_header_field

Method on_header_field

src/decoder.hpp:638–658  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

636 }
637
638 static int on_header_field(http_parser* p, const char* data, size_t length)
639 {
640 StreamingResponseDecoder* decoder = (StreamingResponseDecoder*) p->data;
641
642 // TODO(alexr): We currently do not support trailers, i.e., headers after
643 // `on_headers_complete` has been called, and instead treat them as errors.
644 if (decoder->response == nullptr) {
645 return http_parsing::FAILURE;
646 }
647
648 if (decoder->header != HEADER_FIELD) {
649 decoder->response->headers[decoder->field] = decoder->value;
650 decoder->field.clear();
651 decoder->value.clear();
652 }
653
654 decoder->field.append(data, length);
655 decoder->header = HEADER_FIELD;
656
657 return http_parsing::SUCCESS;
658 }
659
660 static int on_header_value(http_parser* p, const char* data, size_t length)
661 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected