| 137 | namespace |
| 138 | { |
| 139 | static const char * |
| 140 | comp_http_hdr(HTTPHdr *h1, HTTPHdr *h2) |
| 141 | { |
| 142 | int h1_len = h1->length_get(); |
| 143 | int h2_len = h2->length_get(); |
| 144 | |
| 145 | if (h1_len != h2_len) { |
| 146 | return "length mismatch"; |
| 147 | } |
| 148 | |
| 149 | std::unique_ptr<char[]> h1_pbuf(new char[h1_len + 1]); |
| 150 | std::unique_ptr<char[]> h2_pbuf(new char[h2_len + 1]); |
| 151 | |
| 152 | int p_index = 0, p_dumpoffset = 0; |
| 153 | |
| 154 | int rval = h1->print(h1_pbuf.get(), h1_len, &p_index, &p_dumpoffset); |
| 155 | if (rval != 1) { |
| 156 | return "hdr print failed"; |
| 157 | } |
| 158 | |
| 159 | p_index = p_dumpoffset = 0; |
| 160 | rval = h2->print(h2_pbuf.get(), h2_len, &p_index, &p_dumpoffset); |
| 161 | if (rval != 1) { |
| 162 | return "hdr print failed"; |
| 163 | } |
| 164 | |
| 165 | rval = memcmp(h1_pbuf.get(), h2_pbuf.get(), h1_len); |
| 166 | |
| 167 | if (rval != 0) { |
| 168 | return "compare failed"; |
| 169 | } else { |
| 170 | return nullptr; |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | int |
| 175 | test_http_hdr_copy_over_aux(int testnum, const char *request, const char *response) |
no test coverage detected