MCPcopy Create free account
hub / github.com/NetSys/bess / phr_parse_response

Function phr_parse_response

core/utils/http_parser.cc:409–435  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

407}
408
409int phr_parse_response(const char *buf_start, size_t len, int *minor_version,
410 int *status, const char **msg, size_t *msg_len,
411 struct phr_header *headers, size_t *num_headers,
412 size_t last_len) {
413 const char *buf = buf_start, *buf_end = buf + len;
414 size_t max_headers = *num_headers;
415 int r;
416
417 *minor_version = -1;
418 *status = 0;
419 *msg = NULL;
420 *msg_len = 0;
421 *num_headers = 0;
422
423 /* if last_len != 0, check if the response is complete (a fast countermeasure
424 against slowloris */
425 if (last_len != 0 && is_complete(buf, buf_end, last_len, &r) == NULL) {
426 return r;
427 }
428
429 if ((buf = parse_response(buf, buf_end, minor_version, status, msg, msg_len,
430 headers, num_headers, max_headers, &r)) == NULL) {
431 return r;
432 }
433
434 return (int)(buf - buf_start);
435}
436
437int phr_parse_headers(const char *buf_start, size_t len,
438 struct phr_header *headers, size_t *num_headers,

Callers

nothing calls this directly

Calls 2

is_completeFunction · 0.85
parse_responseFunction · 0.85

Tested by

no test coverage detected