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

Function parse_response

core/utils/http_parser.cc:377–407  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

375}
376
377static const char *parse_response(const char *buf, const char *buf_end,
378 int *minor_version, int *status,
379 const char **msg, size_t *msg_len,
380 struct phr_header *headers,
381 size_t *num_headers, size_t max_headers,
382 int *ret) {
383 /* parse "HTTP/1.x" */
384 if ((buf = parse_http_version(buf, buf_end, minor_version, ret)) == NULL) {
385 return NULL;
386 }
387 /* skip space */
388 if (*buf++ != ' ') {
389 *ret = -1;
390 return NULL;
391 }
392 /* parse status code */
393 if ((buf = parse_int(buf, buf_end, status, ret)) == NULL) {
394 return NULL;
395 }
396 /* skip space */
397 if (*buf++ != ' ') {
398 *ret = -1;
399 return NULL;
400 }
401 /* get message */
402 if ((buf = get_token_to_eol(buf, buf_end, msg, msg_len, ret)) == NULL) {
403 return NULL;
404 }
405
406 return parse_headers(buf, buf_end, headers, num_headers, max_headers, ret);
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,

Callers 1

phr_parse_responseFunction · 0.85

Calls 4

parse_http_versionFunction · 0.85
parse_intFunction · 0.85
get_token_to_eolFunction · 0.85
parse_headersFunction · 0.85

Tested by

no test coverage detected