MCPcopy Create free account
hub / github.com/apache/httpd / handle_headers

Function handle_headers

modules/aaa/mod_authnz_fcgi.c:409–460  ·  view source on GitHub ↗

Try to find the end of the script headers in the response from the back * end fastcgi server. STATE holds the current header parsing state for this * request. * * Returns 0 if it can't find the end of the headers, and 1 if it found the * end of the headers. */

Source from the content-addressed store, hash-verified

407 * Returns 0 if it can't find the end of the headers, and 1 if it found the
408 * end of the headers. */
409static int handle_headers(request_rec *r, int *state,
410 const char *readbuf, apr_size_t readlen)
411{
412 const char *itr = readbuf;
413
414 while (readlen--) {
415 if (*itr == '\r') {
416 switch (*state) {
417 case HDR_STATE_GOT_CRLF:
418 *state = HDR_STATE_GOT_CRLFCR;
419 break;
420
421 default:
422 *state = HDR_STATE_GOT_CR;
423 break;
424 }
425 }
426 else if (*itr == '\n') {
427 switch (*state) {
428 case HDR_STATE_GOT_LF:
429 *state = HDR_STATE_DONE_WITH_HEADERS;
430 break;
431
432 case HDR_STATE_GOT_CR:
433 *state = HDR_STATE_GOT_CRLF;
434 break;
435
436 case HDR_STATE_GOT_CRLFCR:
437 *state = HDR_STATE_DONE_WITH_HEADERS;
438 break;
439
440 default:
441 *state = HDR_STATE_GOT_LF;
442 break;
443 }
444 }
445 else {
446 *state = HDR_STATE_READING_HEADERS;
447 }
448
449 if (*state == HDR_STATE_DONE_WITH_HEADERS)
450 break;
451
452 ++itr;
453 }
454
455 if (*state == HDR_STATE_DONE_WITH_HEADERS) {
456 return 1;
457 }
458
459 return 0;
460}
461
462/*
463 * handle_response() is based on mod_proxy_fcgi's dispatch()

Callers 1

handle_responseFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected