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

Function dispatch

modules/proxy/mod_proxy_fcgi.c:596–1018  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

594}
595
596static apr_status_t dispatch(proxy_conn_rec *conn, proxy_dir_conf *conf,
597 request_rec *r, apr_pool_t *setaside_pool,
598 apr_uint16_t request_id, const char **err,
599 int *bad_request, int *has_responded,
600 apr_bucket_brigade *input_brigade)
601{
602 apr_bucket_brigade *ib, *ob;
603 int seen_end_of_headers = 0, done = 0, ignore_body = 0;
604 apr_status_t rv = APR_SUCCESS;
605 int script_error_status = HTTP_OK;
606 conn_rec *c = r->connection;
607 struct iovec vec[2];
608 ap_fcgi_header header;
609 unsigned char farray[AP_FCGI_HEADER_LEN];
610 apr_pollfd_t pfd;
611 apr_pollfd_t *flushpoll = NULL;
612 apr_int32_t flushpoll_fd;
613 int header_state = HDR_STATE_READING_HEADERS;
614 char stack_iobuf[AP_IOBUFSIZE];
615 apr_size_t iobuf_size = AP_IOBUFSIZE;
616 char *iobuf = stack_iobuf;
617
618 *err = NULL;
619 if (conn->worker->s->io_buffer_size_set) {
620 iobuf_size = conn->worker->s->io_buffer_size;
621 iobuf = apr_palloc(r->pool, iobuf_size);
622 }
623
624 pfd.desc_type = APR_POLL_SOCKET;
625 pfd.desc.s = conn->sock;
626 pfd.p = r->pool;
627 pfd.reqevents = APR_POLLIN | APR_POLLOUT;
628
629 if (conn->worker->s->flush_packets == flush_auto) {
630 flushpoll = apr_pcalloc(r->pool, sizeof(apr_pollfd_t));
631 flushpoll->reqevents = APR_POLLIN;
632 flushpoll->desc_type = APR_POLL_SOCKET;
633 flushpoll->desc.s = conn->sock;
634 }
635
636 ib = apr_brigade_create(r->pool, c->bucket_alloc);
637 ob = apr_brigade_create(r->pool, c->bucket_alloc);
638
639 while (! done) {
640 apr_interval_time_t timeout;
641 apr_size_t len;
642 int n;
643
644 /* We need SOME kind of timeout here, or virtually anything will
645 * cause timeout errors. */
646 apr_socket_timeout_get(conn->sock, &timeout);
647
648 rv = apr_poll(&pfd, 1, &n, timeout);
649 if (rv != APR_SUCCESS) {
650 if (APR_STATUS_IS_EINTR(rv)) {
651 continue;
652 }
653 *err = "polling";

Callers 1

fcgi_do_requestFunction · 0.70

Calls 13

ap_get_brigadeFunction · 0.85
ap_fcgi_fill_in_headerFunction · 0.85
ap_fcgi_header_to_arrayFunction · 0.85
send_dataFunction · 0.85
get_data_fullFunction · 0.85
get_dataFunction · 0.85
ap_pass_brigadeFunction · 0.85
ap_proxy_should_overrideFunction · 0.85
ap_is_initial_reqFunction · 0.85
ap_dieFunction · 0.85

Tested by

no test coverage detected