| 905 | } |
| 906 | |
| 907 | static int on_header_field(http_parser* p, const char* data, size_t length) |
| 908 | { |
| 909 | StreamingRequestDecoder* decoder = (StreamingRequestDecoder*) p->data; |
| 910 | |
| 911 | // TODO(alexr): We currently do not support trailers, i.e., headers after |
| 912 | // `on_headers_complete` has been called, and instead treat them as errors. |
| 913 | if (decoder->request == nullptr) { |
| 914 | return http_parsing::FAILURE; |
| 915 | } |
| 916 | |
| 917 | if (decoder->header != HEADER_FIELD) { |
| 918 | decoder->request->headers[decoder->field] = decoder->value; |
| 919 | decoder->field.clear(); |
| 920 | decoder->value.clear(); |
| 921 | } |
| 922 | |
| 923 | decoder->field.append(data, length); |
| 924 | decoder->header = HEADER_FIELD; |
| 925 | |
| 926 | return http_parsing::SUCCESS; |
| 927 | } |
| 928 | |
| 929 | static int on_header_value(http_parser* p, const char* data, size_t length) |
| 930 | { |
nothing calls this directly
no outgoing calls
no test coverage detected