| 5456 | } |
| 5457 | |
| 5458 | void |
| 5459 | HttpTransact::set_client_request_state(State *s, HTTPHdr *incoming_hdr) |
| 5460 | { |
| 5461 | if (incoming_hdr == nullptr) { |
| 5462 | return; |
| 5463 | } |
| 5464 | |
| 5465 | // Set transfer_encoding value |
| 5466 | if (incoming_hdr->presence(MIME_PRESENCE_TRANSFER_ENCODING)) { |
| 5467 | MIMEField *field = incoming_hdr->field_find(MIME_FIELD_TRANSFER_ENCODING, MIME_LEN_TRANSFER_ENCODING); |
| 5468 | if (field) { |
| 5469 | HdrCsvIter enc_val_iter; |
| 5470 | int enc_val_len; |
| 5471 | const char *enc_value = enc_val_iter.get_first(field, &enc_val_len); |
| 5472 | |
| 5473 | while (enc_value) { |
| 5474 | const char *wks_value = hdrtoken_string_to_wks(enc_value, enc_val_len); |
| 5475 | if (wks_value == HTTP_VALUE_CHUNKED) { |
| 5476 | s->client_info.transfer_encoding = CHUNKED_ENCODING; |
| 5477 | break; |
| 5478 | } |
| 5479 | enc_value = enc_val_iter.get_next(&enc_val_len); |
| 5480 | } |
| 5481 | } |
| 5482 | } |
| 5483 | |
| 5484 | ///////////////////////////////////////////////////// |
| 5485 | // get request content length // |
| 5486 | // To avoid parsing content-length twice, we set // |
| 5487 | // s->hdr_info.request_content_length here rather // |
| 5488 | // than in initialize_state_variables_from_request // |
| 5489 | ///////////////////////////////////////////////////// |
| 5490 | if (incoming_hdr->presence(MIME_PRESENCE_CONTENT_LENGTH)) { |
| 5491 | s->hdr_info.request_content_length = incoming_hdr->get_content_length(); |
| 5492 | } else { |
| 5493 | s->hdr_info.request_content_length = HTTP_UNDEFINED_CL; // content length less than zero is invalid |
| 5494 | } |
| 5495 | |
| 5496 | TxnDbg(dbg_ctl_http_trans, "set req cont length to %" PRId64, s->hdr_info.request_content_length); |
| 5497 | } |
| 5498 | |
| 5499 | HttpTransact::ResponseError_t |
| 5500 | HttpTransact::check_response_validity(State *s, HTTPHdr *incoming_hdr) |
nothing calls this directly
no test coverage detected