MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / message_eq

Function message_eq

libs/qhttpserver/http-parser/test.c:2281–2361  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2279} while(0)
2280
2281int
2282message_eq (int index, const struct message *expected)
2283{
2284 int i;
2285 struct message *m = &messages[index];
2286
2287 MESSAGE_CHECK_NUM_EQ(expected, m, http_major);
2288 MESSAGE_CHECK_NUM_EQ(expected, m, http_minor);
2289
2290 if (expected->type == HTTP_REQUEST) {
2291 MESSAGE_CHECK_NUM_EQ(expected, m, method);
2292 } else {
2293 MESSAGE_CHECK_NUM_EQ(expected, m, status_code);
2294 MESSAGE_CHECK_STR_EQ(expected, m, response_status);
2295 }
2296
2297 MESSAGE_CHECK_NUM_EQ(expected, m, should_keep_alive);
2298 MESSAGE_CHECK_NUM_EQ(expected, m, message_complete_on_eof);
2299
2300 assert(m->message_begin_cb_called);
2301 assert(m->headers_complete_cb_called);
2302 assert(m->message_complete_cb_called);
2303
2304
2305 MESSAGE_CHECK_STR_EQ(expected, m, request_url);
2306
2307 /* Check URL components; we can't do this w/ CONNECT since it doesn't
2308 * send us a well-formed URL.
2309 */
2310 if (*m->request_url && m->method != HTTP_CONNECT) {
2311 struct http_parser_url u;
2312
2313 if (http_parser_parse_url(m->request_url, strlen(m->request_url), 0, &u)) {
2314 fprintf(stderr, "\n\n*** failed to parse URL %s ***\n\n",
2315 m->request_url);
2316 abort();
2317 }
2318
2319 if (expected->host) {
2320 MESSAGE_CHECK_URL_EQ(&u, expected, m, host, UF_HOST);
2321 }
2322
2323 if (expected->userinfo) {
2324 MESSAGE_CHECK_URL_EQ(&u, expected, m, userinfo, UF_USERINFO);
2325 }
2326
2327 m->port = (u.field_set & (1 << UF_PORT)) ?
2328 u.port : 0;
2329
2330 MESSAGE_CHECK_URL_EQ(&u, expected, m, query_string, UF_QUERY);
2331 MESSAGE_CHECK_URL_EQ(&u, expected, m, fragment, UF_FRAGMENT);
2332 MESSAGE_CHECK_URL_EQ(&u, expected, m, request_path, UF_PATH);
2333 MESSAGE_CHECK_NUM_EQ(expected, m, port);
2334 }
2335
2336 if (expected->body_size) {
2337 MESSAGE_CHECK_NUM_EQ(expected, m, body_size);
2338 } else {

Callers 5

test_messageFunction · 0.85
test_message_count_bodyFunction · 0.85
test_multiple3Function · 0.85
test_scanFunction · 0.85
test_message_pauseFunction · 0.85

Calls 2

http_parser_parse_urlFunction · 0.85
check_str_eqFunction · 0.85

Tested by

no test coverage detected