| 588 | #include "proxy/http/HttpDebugNames.h" |
| 589 | |
| 590 | void |
| 591 | HttpTransactHeaders::insert_warning_header(HttpConfigParams *http_config_param, HTTPHdr *header, HTTPWarningCode code, |
| 592 | const char *warn_text, int warn_text_len) |
| 593 | { |
| 594 | int bufsize, len; |
| 595 | |
| 596 | // + 23 for 20 possible digits of warning code (long long max |
| 597 | // digits) & 2 spaces & the string terminator |
| 598 | bufsize = http_config_param->proxy_response_via_string_len + 23; |
| 599 | if (warn_text != nullptr) { |
| 600 | bufsize += warn_text_len; |
| 601 | } else { |
| 602 | warn_text_len = 0; // Make sure it's really zero |
| 603 | } |
| 604 | |
| 605 | char *warning_text = static_cast<char *>(alloca(bufsize)); |
| 606 | |
| 607 | len = |
| 608 | snprintf(warning_text, bufsize, "%3d %s %.*s", code, http_config_param->proxy_response_via_string, warn_text_len, warn_text); |
| 609 | header->value_set(MIME_FIELD_WARNING, MIME_LEN_WARNING, warning_text, len); |
| 610 | } |
| 611 | |
| 612 | void |
| 613 | HttpTransactHeaders::insert_time_and_age_headers_in_response(ink_time_t request_sent_time, ink_time_t response_received_time, |