| 126 | } |
| 127 | |
| 128 | int |
| 129 | compare_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 |
| 162 | int |
no test coverage detected