MCPcopy Create free account
hub / github.com/acl-dev/acl / http_hdr_parse

Function http_hdr_parse

lib_protocol/src/http/http_hdr.c:389–548  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

387}
388
389int http_hdr_parse(HTTP_HDR *hh)
390{
391 int keep_alive = -1;
392 HTTP_HDR_ENTRY *entry;
393 ACL_ITER iter;
394
395 struct HEADER_LIST {
396 char *name;
397 };
398
399#if 0
400 static const struct HEADER_LIST header_list[] = {
401 { "Accept-Ranges" },
402 { "Age" },
403 { "Cache-Control" },
404 { "Connection" },
405 { "Content-Encoding" },
406 { "Content-Length" },
407 { "Content-Type" },
408 { "Date" },
409 { "ETag" },
410 { "Last-Modified" },
411 { "Server" },
412 { "Transfer-Encoding" },
413 };
414 int care_size = sizeof(header_list)/sizeof(struct HEADER_LIST);
415 int care_cnt = 0, i, n;
416
417 n = acl_array_size(hh->entry_lnk);
418 for (i = 0; i < n; i++) {
419 if (care_cnt >= care_size)
420 break;
421
422 entry = (HTTP_HDR_ENTRY *) acl_array_index(hh->entry_lnk, i);
423
424 if (strcasecmp(entry->name, "Accept-Ranges") == 0) {
425 care_cnt++;
426 } else if (strcasecmp(entry->name, "Age") == 0) {
427 care_cnt++;
428 } else if (strcasecmp(entry->name, "Cache-Control") == 0) {
429 care_cnt++;
430 } else if (strcasecmp(entry->name, "Connection") == 0) {
431 care_cnt++;
432 if (strcasecmp(entry->value, "keep-alive") == 0)
433 keep_alive = 1;
434 else
435 keep_alive = 0;
436 } else if (strcasecmp(entry->name, "Proxy-Connection") == 0) {
437 care_cnt++;
438 if (strcasecmp(entry->value, "keep-alive") == 0)
439 keep_alive = 1;
440 else
441 keep_alive = 0;
442 } else if (strcasecmp(entry->name, "Content-Encoding") == 0) {
443 care_cnt++;
444 } else if (strcasecmp(entry->name, "Content-Length") == 0) {
445#ifdef MS_VC6
446 hh->content_length = acl_atoui64(entry->value);

Callers 2

http_hdr_res_parseFunction · 0.85
http_hdr_req_parse3Function · 0.85

Calls 5

acl_array_sizeFunction · 0.85
acl_array_indexFunction · 0.85
acl_atoui64Function · 0.85
acl_msg_errorFunction · 0.85
acl_foreachFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…