MCPcopy Create free account
hub / github.com/apache/trafficserver / convert

Method convert

src/proxy/hdrs/VersionConverter.cc:32–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30#include "tsutil/LocalBuffer.h"
31
32int
33VersionConverter::convert(HTTPHdr &header, int from, int to) const
34{
35 int type = 0;
36
37 switch (http_hdr_type_get(header.m_http)) {
38 case HTTP_TYPE_REQUEST:
39 type = 0;
40 break;
41 case HTTP_TYPE_RESPONSE:
42 type = 1;
43 break;
44 case HTTP_TYPE_UNKNOWN:
45 ink_abort("HTTP_TYPE_UNKNOWN");
46 break;
47 }
48
49 ink_assert(MIN_VERSION <= from && from <= MAX_VERSION);
50 ink_assert(MIN_VERSION <= to && to <= MAX_VERSION);
51
52 int ret = (this->*_convert_functions[type][from - 1][to - 1])(header);
53 if (ret < 0) {
54 return -1;
55 }
56
57 // Check validity of all names and values
58 for (auto &&mf : header) {
59 if (!mf.name_is_valid(is_control_BIT | is_ws_BIT) || !mf.value_is_valid()) {
60 return -1;
61 }
62 }
63
64 return 0;
65}
66
67int
68VersionConverter::_convert_nop(HTTPHdr & /* header ATS_UNUSED */) const

Calls 4

http_hdr_type_getFunction · 0.85
name_is_validMethod · 0.80
value_is_validMethod · 0.80
ink_abortFunction · 0.50

Tested by

no test coverage detected