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

Function compare_header_fields

src/proxy/http2/test_HPACK.cc:128–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126}
127
128int
129compare_header_fields(HTTPHdr *a, HTTPHdr *b)
130{
131 // compare fields count
132 if (a->fields_count() != b->fields_count()) {
133 return -1;
134 }
135
136 auto a_spot = a->begin(), a_limit = a->end();
137 auto b_spot = b->begin(), b_limit = b->end();
138
139 while (a_spot != a_limit && b_spot != b_limit) {
140 // compare header name
141 auto a_str{a_spot->name_get()};
142 auto b_str{b_spot->name_get()};
143 if (a_str != b_str) {
144 print_difference(a_str.data(), a_str.length(), b_str.data(), b_str.length());
145 return -1;
146 }
147 // compare header value
148 a_str = a_spot->value_get();
149 b_str = b_spot->value_get();
150 if (a_str != b_str) {
151 print_difference(a_str.data(), a_str.length(), b_str.data(), b_str.length());
152 return -1;
153 }
154 ++a_spot;
155 ++b_spot;
156 }
157
158 return 0;
159}
160
161// Returns -1 if test passes, or returns the failed sequence number
162int

Callers 2

test_decodingFunction · 0.85
test_encodingFunction · 0.85

Calls 8

print_differenceFunction · 0.85
fields_countMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
name_getMethod · 0.45
dataMethod · 0.45
lengthMethod · 0.45
value_getMethod · 0.45

Tested by

no test coverage detected