Commit 82d72799 authored by Stefan Fritsch's avatar Stefan Fritsch
Browse files

great proxy logging cleanup:

    
  * remove "proxy:", "FCGI", etc. prefixes and pid which are now
    included in the error log format

  * propagate frontend request's logconfig to backend request
    
  * use ap_log_rerror where possible
    
  * remove obsolete APLOG_NOERRNO


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1203859 13f79535-47bb-0310-9956-ffa450edef68
parent a0850d7e
Loading
Loading
Loading
Loading
+6 −6
Changes for modules/proxy/mod_proxy.c: 6 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -904,7 +904,7 @@ static int proxy_handler(request_rec *r)
                           "TRACE forbidden by server configuration");
            apr_table_setn(r->notes, "verbose-error-to", "*");
            ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
                          "proxy: TRACE forbidden by server configuration");
                          "TRACE forbidden by server configuration");
            return HTTP_METHOD_NOT_ALLOWED;
        }

@@ -922,7 +922,7 @@ static int proxy_handler(request_rec *r)
                           "TRACE with request body is not allowed");
            apr_table_setn(r->notes, "verbose-error-to", "*");
            ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
                          "proxy: TRACE with request body is not allowed");
                          "TRACE with request body is not allowed");
            return HTTP_REQUEST_ENTITY_TOO_LARGE;
        }
    }
@@ -996,7 +996,7 @@ static int proxy_handler(request_rec *r)
                                strlen(ents[i].scheme)) == 0)) {

                    /* handle the scheme */
                    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
                    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
                                  "Trying to run scheme_handler against proxy");
                    access_status = proxy_run_scheme_handler(r, worker,
                                                             conf, url,
@@ -1048,7 +1048,7 @@ static int proxy_handler(request_rec *r)
        */

        /* handle the scheme */
        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
                      "Running scheme %s handler (attempt %d)",
                      scheme, attempts);
        AP_PROXY_RUN(r, worker, conf, url, attempts);
@@ -1090,8 +1090,8 @@ static int proxy_handler(request_rec *r)
             max_attempts > attempts++);

    if (DECLINED == access_status) {
        ap_log_error(APLOG_MARK, APLOG_WARNING, 0, r->server,
                    "proxy: No protocol handler was valid for the URL %s. "
        ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
                      "No protocol handler was valid for the URL %s. "
                      "If you are using a DSO version of mod_proxy, make sure "
                      "the proxy submodules are included in the configuration "
                      "using LoadModule.", r->uri);
+24 −24
Changes for modules/proxy/mod_proxy_ajp.c: 24 added lines, 24 removed lines.
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ static int proxy_ajp_canon(request_rec *r, char *url)
    }

    ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server,
             "proxy: AJP: canonicalising URL %s", url);
             "AJP: canonicalising URL %s", url);

    /*
     * do syntactic check.
@@ -211,7 +211,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
    if (status != APR_SUCCESS) {
        conn->close++;
        ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server,
                     "proxy: AJP: request failed to %pI (%s)",
                     "AJP: request failed to %pI (%s)",
                     conn->worker->cp->addr,
                     conn->worker->s->hostname);
        if (status == AJP_EOVERFLOW)
@@ -238,7 +238,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
        /* We had a failure: Close connection to backend */
        conn->close++;
        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
                     "proxy: ajp_alloc_data_msg failed");
                     "ajp_alloc_data_msg failed");
        return HTTP_INTERNAL_SERVER_ERROR;
    }

@@ -248,7 +248,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
    if (tenc && (strcasecmp(tenc, "chunked") == 0)) {
        /* The AJP protocol does not want body data yet */
        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
                     "proxy: request is chunked");
                     "request is chunked");
    } else {
        /* Get client provided Content-Length header */
        content_length = get_content_length(r);
@@ -260,7 +260,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
            /* We had a failure: Close connection to backend */
            conn->close++;
            ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
                         "proxy: ap_get_brigade failed");
                         "ap_get_brigade failed");
            apr_brigade_destroy(input_brigade);
            return HTTP_BAD_REQUEST;
        }
@@ -268,12 +268,12 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
        /* have something */
        if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(input_brigade))) {
            ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
                         "proxy: APR_BUCKET_IS_EOS");
                         "APR_BUCKET_IS_EOS");
        }

        /* Try to send something */
        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
                     "proxy: data to read (max %" APR_SIZE_T_FMT
                     "data to read (max %" APR_SIZE_T_FMT
                     " at %" APR_SIZE_T_FMT ")", bufsiz, msg->pos);

        status = apr_brigade_flatten(input_brigade, buff, &bufsiz);
@@ -282,13 +282,13 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
            conn->close++;
            apr_brigade_destroy(input_brigade);
            ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server,
                         "proxy: apr_brigade_flatten");
                         "apr_brigade_flatten");
            return HTTP_INTERNAL_SERVER_ERROR;
        }
        apr_brigade_cleanup(input_brigade);

        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
                     "proxy: got %" APR_SIZE_T_FMT " bytes of data", bufsiz);
                     "got %" APR_SIZE_T_FMT " bytes of data", bufsiz);
        if (bufsiz > 0) {
            status = ajp_send_data_msg(conn->sock, msg, bufsiz);
            ajp_msg_log(r, msg, "First ajp_send_data_msg: ajp_ilink_send packet dump");
@@ -297,7 +297,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
                conn->close++;
                apr_brigade_destroy(input_brigade);
                ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server,
                             "proxy: send failed to %pI (%s)",
                             "send failed to %pI (%s)",
                             conn->worker->cp->addr,
                             conn->worker->s->hostname);
                /*
@@ -311,7 +311,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
        }
        else if (content_length > 0) {
            ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server,
                         "proxy: read zero bytes, expecting"
                         "read zero bytes, expecting"
                         " %" APR_OFF_T_FMT " bytes",
                         content_length);
            /*
@@ -337,7 +337,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
        conn->close++;
        apr_brigade_destroy(input_brigade);
        ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server,
                     "proxy: read response failed from %pI (%s)",
                     "read response failed from %pI (%s)",
                     conn->worker->cp->addr,
                     conn->worker->s->hostname);

@@ -384,7 +384,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
                        bufsiz = 0;
                        havebody = 0;
                        ap_log_error(APLOG_MARK, APLOG_DEBUG, status, r->server,
                                     "proxy: APR_BUCKET_IS_EOS");
                                     "APR_BUCKET_IS_EOS");
                    } else {
                        status = ap_get_brigade(r->input_filters, input_brigade,
                                                AP_MODE_READBYTES,
@@ -438,7 +438,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
                     */
                    backend_failed = 1;
                    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
                                 "proxy: Backend sent headers twice.");
                                 "Backend sent headers twice.");
                    break;
                }
                /* AJP13_SEND_HEADERS: process them */
@@ -515,7 +515,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
                            if (ap_pass_brigade(r->output_filters,
                                                output_brigade) != APR_SUCCESS) {
                                ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
                                              "proxy: error processing body.%s",
                                              "error processing body.%s",
                                              r->connection->aborted ?
                                              " Client aborted connection." : "");
                                output_failed = 1;
@@ -544,7 +544,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
                    if (ap_pass_brigade(r->output_filters,
                                        output_brigade) != APR_SUCCESS) {
                        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
                                      "proxy: error processing end");
                                      "error processing end");
                        output_failed = 1;
                    }
                    /* XXX: what about flush here? See mod_jk */
@@ -599,7 +599,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,

    if (backend_failed || output_failed) {
        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
                     "proxy: Processing of request failed backend: %i, "
                     "Processing of request failed backend: %i, "
                     "output: %i", backend_failed, output_failed);
        /* We had a failure: Close connection to backend */
        conn->close++;
@@ -610,7 +610,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
    }
    else if (!request_ended) {
        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
                     "proxy: Processing of request didn't terminate cleanly");
                     "Processing of request didn't terminate cleanly");
        /* We had a failure: Close connection to backend */
        conn->close++;
        backend_failed = 1;
@@ -625,7 +625,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
    }
    else {
        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
                     "proxy: got response from %pI (%s)",
                     "got response from %pI (%s)",
                     conn->worker->cp->addr,
                     conn->worker->s->hostname);

@@ -644,7 +644,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,

    if (backend_failed) {
        ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server,
                     "proxy: dialog to %pI (%s) failed",
                     "dialog to %pI (%s) failed",
                     conn->worker->cp->addr,
                     conn->worker->s->hostname);
        /*
@@ -727,11 +727,11 @@ static int proxy_ajp_handler(request_rec *r, proxy_worker *worker,

    if (strncasecmp(url, "ajp:", 4) != 0) {
        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
                     "proxy: AJP: declining URL %s", url);
                     "AJP: declining URL %s", url);
        return DECLINED;
    }
    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
                 "proxy: AJP: serving URL %s", url);
                 "AJP: serving URL %s", url);

    /* create space for state information */
    status = ap_proxy_acquire_connection(scheme, &backend, worker,
@@ -762,7 +762,7 @@ static int proxy_ajp_handler(request_rec *r, proxy_worker *worker,
        /* Step Two: Make the Connection */
        if (ap_proxy_connect_backend(scheme, backend, worker, r->server)) {
            ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
                         "proxy: AJP: failed to make connection to backend: %s",
                         "AJP: failed to make connection to backend: %s",
                         backend->hostname);
            status = HTTP_SERVICE_UNAVAILABLE;
            break;
@@ -781,7 +781,7 @@ static int proxy_ajp_handler(request_rec *r, proxy_worker *worker,
            if (status != APR_SUCCESS) {
                backend->close++;
                ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server,
                             "proxy: AJP: cping/cpong failed to %pI (%s)",
                             "AJP: cping/cpong failed to %pI (%s)",
                             worker->cp->addr,
                             worker->s->hostname);
                status = HTTP_SERVICE_UNAVAILABLE;
+70 −66

File changed.

Preview size limit exceeded, changes collapsed.

+28 −36
Changes for modules/proxy/mod_proxy_connect.c: 28 added lines, 36 removed lines.
Original line number Diff line number Diff line
@@ -138,8 +138,7 @@ static int proxy_connect_canon(request_rec *r, char *url)
    if (r->method_number != M_CONNECT) {
    return DECLINED;
    }
    ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server,
                 "proxy: CONNECT: canonicalising URL %s", url);
    ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "canonicalising URL %s", url);

    return OK;
}
@@ -166,7 +165,7 @@ static int proxy_connect_transfer(request_rec *r, conn_rec *c_i, conn_rec *c_o,
            len = -1;
            apr_brigade_length(bb, 0, &len);
            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
                          "proxy: CONNECT: read %" APR_OFF_T_FMT
                          "read %" APR_OFF_T_FMT
                          " bytes from %s", len, name);
#endif
            rv = ap_pass_brigade(c_o->output_filters, bb);
@@ -175,12 +174,12 @@ static int proxy_connect_transfer(request_rec *r, conn_rec *c_i, conn_rec *c_o,
            }
            else {
                ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
                              "proxy: CONNECT: error on %s - ap_pass_brigade",
                              "error on %s - ap_pass_brigade",
                              name);
            }
        } else if (!APR_STATUS_IS_EAGAIN(rv)) {
            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, r,
                          "proxy: CONNECT: error on %s - ap_get_brigade",
                          "error on %s - ap_get_brigade",
                          name);
        }
    } while (rv == APR_SUCCESS);
@@ -225,12 +224,10 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,

    /* is this for us? */
    if (r->method_number != M_CONNECT) {
        ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server,
                     "proxy: CONNECT: declining URL %s", url);
        ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "declining URL %s", url);
        return DECLINED;
    }
    ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server,
                 "proxy: CONNECT: serving URL %s", url);
    ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "serving URL %s", url);


    /*
@@ -246,9 +243,8 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
                                         NULL));
    }

    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
                 "proxy: CONNECT: connecting %s to %s:%d", url, uri.hostname,
                 uri.port);
    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
                  "connecting %s to %s:%d", url, uri.hostname, uri.port);

    /* do a DNS lookup for the destination host */
    err = apr_sockaddr_info_get(&uri_addr, uri.hostname, APR_UNSPEC, uri.port,
@@ -271,8 +267,8 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
        connectport = uri.port;
        connect_addr = uri_addr;
    }
    ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server,
                 "proxy: CONNECT: connecting to remote proxy %s on port %d",
    ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r,
                  "connecting to remote proxy %s on port %d",
                  connectname, connectport);

    /* check if ProxyBlock directive on this host */
@@ -326,13 +322,12 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
    }

    /* setup polling for connection */
    ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r,
                  "proxy: CONNECT: setting up poll()");
    ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r, "setting up poll()");

    if ((rv = apr_pollset_create(&pollset, 2, r->pool, 0)) != APR_SUCCESS) {
        apr_socket_close(sock);
        ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
                      "proxy: CONNECT: error apr_pollset_create()");
                      "error apr_pollset_create()");
        return HTTP_INTERNAL_SERVER_ERROR;
    }

@@ -359,7 +354,7 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
    if (!backconn) {
        /* peer reset */
        ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r,
                      "proxy: an error occurred creating a new connection "
                      "an error occurred creating a new connection "
                      "to %pI (%s)", connect_addr, connectname);
        apr_socket_close(sock);
        return HTTP_INTERNAL_SERVER_ERROR;
@@ -369,12 +364,12 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
    if (rc != OK && rc != DONE) {
        backconn->aborted = 1;
        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
                      "proxy: CONNECT: pre_connection setup failed (%d)", rc);
                      "pre_connection setup failed (%d)", rc);
        return HTTP_INTERNAL_SERVER_ERROR;
    }

    ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r,
                  "proxy: CONNECT: connection complete to %pI (%s)",
                  "connection complete to %pI (%s)",
                  connect_addr, connectname);
    apr_table_setn(r->notes, "proxy-source-port", apr_psprintf(r->pool, "%hu",
                   backconn->local_addr->port));
@@ -385,9 +380,8 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
    if (proxyport) {
    /* FIXME: Error checking ignored.
     */
        ap_log_error(APLOG_MARK, APLOG_TRACE2, 0, r->server,
                     "proxy: CONNECT: sending the CONNECT request"
                     " to the remote proxy");
        ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r,
                      "sending the CONNECT request to the remote proxy");
        ap_fprintf(backconn->output_filters, bb,
                   "CONNECT %s HTTP/1.0" CRLF, r->uri);
        ap_fprintf(backconn->output_filters, bb,
@@ -395,8 +389,7 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
        ap_fflush(backconn->output_filters, bb);
    }
    else {
        ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server,
                     "proxy: CONNECT: Returning 200 OK Status");
        ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "Returning 200 OK");
        nbytes = apr_snprintf(buffer, sizeof(buffer),
                              "HTTP/1.0 200 Connection Established" CRLF);
        ap_xlate_proto_to_ascii(buffer, nbytes);
@@ -418,8 +411,7 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
#endif
    }

    ap_log_error(APLOG_MARK, APLOG_TRACE2, 0, r->server,
                 "proxy: CONNECT: setting up poll()");
    ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r, "setting up poll()");

    /*
     * Step Four: Handle Data Transfer
@@ -443,12 +435,12 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
                continue;
            }
            apr_socket_close(sock);
            ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "proxy: CONNECT: error apr_poll()");
            ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "error apr_poll()");
            return HTTP_INTERNAL_SERVER_ERROR;
        }
#ifdef DEBUGGING
        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
                     "proxy: CONNECT: woke from poll(), i=%d", pollcnt);
        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
                      "woke from poll(), i=%d", pollcnt);
#endif

        for (pi = 0; pi < pollcnt; pi++) {
@@ -459,7 +451,7 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
                if (pollevent & APR_POLLIN) {
#ifdef DEBUGGING
                    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
                                  "proxy: CONNECT: sock was readable");
                                  "sock was readable");
#endif
                    rv = proxy_connect_transfer(r, backconn, c, bb, "sock");
                    }
@@ -467,7 +459,7 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
                         || (pollevent & APR_POLLHUP)) {
                         rv = APR_EPIPE;
                         ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r,
                                       "proxy: CONNECT: err/hup on backconn");
                                       "err/hup on backconn");
                }
                if (rv != APR_SUCCESS)
                    client_error = 1;
@@ -477,7 +469,7 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
                if (pollevent & APR_POLLIN) {
#ifdef DEBUGGING
                    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
                                  "proxy: CONNECT: client was readable");
                                  "client was readable");
#endif
                    rv = proxy_connect_transfer(r, c, backconn, bb, "client");
                }
@@ -485,7 +477,7 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
            else {
                rv = APR_EBADF;
                ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r,
                              "proxy: CONNECT: unknown socket in pollset");
                              "unknown socket in pollset");
            }

        }
@@ -494,8 +486,8 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
        }
    }

    ap_log_error(APLOG_MARK, APLOG_TRACE2, 0, r->server,
                 "proxy: CONNECT: finished with poll() - cleaning up");
    ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r,
                  "finished with poll() - cleaning up");

    /*
     * Step Five: Clean Up
+33 −39
Changes for modules/proxy/mod_proxy_fcgi.c: 33 added lines, 39 removed lines.
Original line number Diff line number Diff line
@@ -86,8 +86,8 @@ static int proxy_fcgi_canon(request_rec *r, char *url)
        return DECLINED;
    }

    ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server,
                 "proxy: FCGI: canonicalising URL %s", url);
    ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r,
                 "canonicalising URL %s", url);

    err = ap_proxy_canon_netloc(r->pool, &url, NULL, NULL, &host, &port);
    if (err) {
@@ -117,13 +117,13 @@ static int proxy_fcgi_canon(request_rec *r, char *url)
                              path, NULL);

    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
                  "proxy: FCGI: set r->filename to %s", r->filename);
                  "set r->filename to %s", r->filename);

    if (apr_table_get(r->subprocess_env, "proxy-fcgi-pathinfo")) {
        r->path_info = apr_pstrcat(r->pool, "/", path, NULL);

        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
                      "proxy: FCGI: set r->path_info to %s", r->path_info);
                      "set r->path_info to %s", r->path_info);
    }

    return OK;
@@ -318,7 +318,7 @@ static apr_status_t send_environment(proxy_conn_rec *conn, request_rec *r,

#ifdef FCGI_DUMP_ENV_VARS
        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
                      "proxy: FCGI: sending env var '%s' value '%s'",
                      "sending env var '%s' value '%s'",
                      elts[i].key, elts[i].val);
#endif

@@ -334,7 +334,7 @@ static apr_status_t send_environment(proxy_conn_rec *conn, request_rec *r,
        /* The cast of bodylen is safe since FCGI_MAX_ENV_SIZE is for sure an int */
        if (envlen > FCGI_MAX_ENV_SIZE) {
            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
                          "proxy: FCGI: truncating environment to %d bytes and %d elements",
                          "truncating environment to %d bytes and %d elements",
                          (int)bodylen, i);
            break;
        }
@@ -499,7 +499,7 @@ static void dump_header_to_log(request_rec *r, unsigned char fheader[],
        if (i >= 20) {
            i = 0;

            ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
                          "HEADER: %s %s", asc_line, hex_line);

            memset(asc_line, 0, sizeof(asc_line));
@@ -534,11 +534,11 @@ static void dump_header_to_log(request_rec *r, unsigned char fheader[],
    }

    if (i != 1) {
        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "HEADER: %s %s",
        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "HEADER: %s %s",
                      asc_line, hex_line);
    }

    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "HEADER: -EOH-");
    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "HEADER: -EOH-");
#endif
}

@@ -671,8 +671,8 @@ static apr_status_t dispatch(proxy_conn_rec *conn, proxy_dir_conf *conf,
            dump_header_to_log(r, farray, readbuflen);

            if (readbuflen != FCGI_HEADER_LEN) {
                ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
                             "proxy: FCGI: Failed to read entire header "
                ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
                              "Failed to read entire header "
                              "got %" APR_SIZE_T_FMT " wanted %d",
                              readbuflen, FCGI_HEADER_LEN);
                rv = APR_EINVAL;
@@ -682,9 +682,8 @@ static apr_status_t dispatch(proxy_conn_rec *conn, proxy_dir_conf *conf,
            fcgi_header_from_array(&header, farray);

            if (header.version != FCGI_VERSION) {
                ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
                             "proxy: FCGI: Got bogus version %d",
                             (int) header.version);
                ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
                              "Got bogus version %d", (int) header.version);
                rv = APR_EINVAL;
                break;
            }
@@ -695,8 +694,8 @@ static apr_status_t dispatch(proxy_conn_rec *conn, proxy_dir_conf *conf,
            rid |= header.requestIdB0;

            if (rid != request_id) {
                ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
                             "proxy: FCGI: Got bogus rid %d, expected %d",
                ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
                              "Got bogus rid %d, expected %d",
                              rid, request_id);
                rv = APR_EINVAL;
                break;
@@ -750,8 +749,8 @@ recv_again:
                                tmp_b = apr_bucket_eos_create(c->bucket_alloc);
                                APR_BRIGADE_INSERT_TAIL(ob, tmp_b);
                                ap_pass_brigade(r->output_filters, ob);
                                ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
                                    "proxy: FCGI: Error parsing script headers");
                                ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
                                              "Error parsing script headers");
                                r->status = status;
                                rv = APR_EINVAL;
                                break;
@@ -829,8 +828,8 @@ recv_again:
            case FCGI_STDERR:
                /* TODO: Should probably clean up this logging a bit... */
                if (clen) {
                    ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
                                 "proxy: FCGI: Got error '%s'", readbuf);
                    ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
                                  "Got error '%s'", readbuf);
                }

                if (clen > readbuflen) {
@@ -844,8 +843,8 @@ recv_again:
                break;

            default:
                ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
                             "proxy: FCGI: Got bogus record %d", type);
                ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
                              "Got bogus record %d", type);
                break;
            }

@@ -891,9 +890,8 @@ static int fcgi_do_request(apr_pool_t *p, request_rec *r,
    /* Step 1: Send FCGI_BEGIN_REQUEST */
    rv = send_begin_request(conn, request_id);
    if (rv != APR_SUCCESS) {
        ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
                     "proxy: FCGI: Failed Writing Request to %s:",
                     server_portstr);
        ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
                      "Failed Writing Request to %s:", server_portstr);
        conn->close = 1;
        return HTTP_SERVICE_UNAVAILABLE;
    }
@@ -901,9 +899,8 @@ static int fcgi_do_request(apr_pool_t *p, request_rec *r,
    /* Step 2: Send Environment via FCGI_PARAMS */
    rv = send_environment(conn, r, request_id);
    if (rv != APR_SUCCESS) {
        ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
                     "proxy: FCGI: Failed writing Environment to %s:",
                     server_portstr);
        ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
                      "Failed writing Environment to %s:", server_portstr);
        conn->close = 1;
        return HTTP_SERVICE_UNAVAILABLE;
    }
@@ -911,9 +908,8 @@ static int fcgi_do_request(apr_pool_t *p, request_rec *r,
    /* Step 3: Read records from the back end server and handle them. */
    rv = dispatch(conn, conf, r, request_id);
    if (rv != APR_SUCCESS) {
        ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
                     "proxy: FCGI: Error dispatching request to %s:",
                     server_portstr);
        ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
                      "Error dispatching request to %s:", server_portstr);
        conn->close = 1;
        return HTTP_SERVICE_UNAVAILABLE;
    }
@@ -943,21 +939,19 @@ static int proxy_fcgi_handler(request_rec *r, proxy_worker *worker,

    apr_uri_t *uri = apr_palloc(r->pool, sizeof(*uri));

    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
                 "proxy: FCGI: url: %s proxyname: %s proxyport: %d",
    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
                  "url: %s proxyname: %s proxyport: %d",
                 url, proxyname, proxyport);

    if (strncasecmp(url, "fcgi:", 5) == 0) {
        url += 5;
    }
    else {
        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
                     "proxy: FCGI: declining URL %s", url);
        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "declining URL %s", url);
        return DECLINED;
    }

    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
                 "proxy: FCGI: serving URL %s", url);
    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "serving URL %s", url);

    /* Create space for state information */
    if (! backend) {
@@ -991,8 +985,8 @@ static int proxy_fcgi_handler(request_rec *r, proxy_worker *worker,

    /* Step Two: Make the Connection */
    if (ap_proxy_connect_backend(FCGI_SCHEME, backend, worker, r->server)) {
        ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
                     "proxy: FCGI: failed to make connection to backend: %s",
        ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
                      "failed to make connection to backend: %s",
                      backend->hostname);
        status = HTTP_SERVICE_UNAVAILABLE;
        goto cleanup;
Loading