Commit 88aa8117 authored by Ruediger Pluem's avatar Ruediger Pluem
Browse files

* Style fixes: Spaces, comments, typos. No functional change.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@322467 13f79535-47bb-0310-9956-ffa450edef68
parent 4808d486
Loading
Loading
Loading
Loading
+27 −21
Changes for modules/proxy/mod_proxy_ajp.c: 27 added lines, 21 removed lines.
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
#include "ajp.h"

module AP_MODULE_DECLARE_DATA proxy_ajp_module;

/*
 * Canonicalise http-like URLs.
 * scheme is the scheme for the URL
@@ -43,7 +44,8 @@ static int proxy_ajp_canon(request_rec *r, char *url)
    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
             "proxy: AJP: canonicalising URL %s", url);

    /* do syntatic check.
    /*
     * do syntactic check.
     * We break the URL into host, port, path, search
     */
    err = ap_proxy_canon_netloc(r->pool, &url, NULL, NULL, &host, &port);
@@ -54,10 +56,12 @@ static int proxy_ajp_canon(request_rec *r, char *url)
        return HTTP_BAD_REQUEST;
    }

    /* now parse path/search args, according to rfc1738 */
    /* N.B. if this isn't a true proxy request, then the URL _path_
     * has already been decoded.  True proxy requests have r->uri
     * == r->unparsed_uri, and no others have that property.
    /*
     * now parse path/search args, according to rfc1738
     *
     * N.B. if this isn't a true proxy request, then the URL _path_
     * has already been decoded.  True proxy requests have
     * r->uri == r->unparsed_uri, and no others have that property.
     */
    if (r->uri == r->unparsed_uri) {
        search = strchr(url, '?');
@@ -68,22 +72,25 @@ static int proxy_ajp_canon(request_rec *r, char *url)
        search = r->args;

    /* process path */
    path = ap_proxy_canonenc(r->pool, url, strlen(url), enc_path, 0, r->proxyreq);
    path = ap_proxy_canonenc(r->pool, url, strlen(url), enc_path, 0,
                             r->proxyreq);
    if (path == NULL)
        return HTTP_BAD_REQUEST;

    apr_snprintf(sport, sizeof(sport), ":%d", port);

    if (ap_strchr_c(host, ':')) { /* if literal IPv6 address */
    if (ap_strchr_c(host, ':')) {
        /* if literal IPv6 address */
        host = apr_pstrcat(r->pool, "[", host, "]", NULL);
    }
    r->filename = apr_pstrcat(r->pool, "proxy:ajp://", host, sport,
            "/", path, (search) ? "?" : "", (search) ? search : "", NULL);
                              "/", path, (search) ? "?" : "",
                              (search) ? search : "", NULL);
    return OK;
}

/*
 * process the request and write the respnse.
 * process the request and write the response.
 */
static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
                                proxy_conn_rec *conn,
@@ -131,10 +138,11 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
                     "proxy: ajp_alloc_data_msg failed");
        return HTTP_INTERNAL_SERVER_ERROR;
    }

    /* read the first bloc of data */
    input_brigade = apr_brigade_create(p, r->connection->bucket_alloc);
    tenc = apr_table_get(r->headers_in, "Transfer-Encoding");
    if (tenc && strcasecmp(tenc, "chunked")==0) {
    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");
@@ -207,7 +215,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
            case CMD_AJP13_GET_BODY_CHUNK:
                if (havebody) {
                    if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(input_brigade))) {
                        /* That is the end */
                        /* This is the end */
                        bufsiz = 0;
                        havebody = 0;
                        ap_log_error(APLOG_MARK, APLOG_DEBUG, status, r->server,
@@ -231,7 +239,8 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
                        }
                    }

                    ajp_msg_reset(msg); /* will go in ajp_send_data_msg */
                    ajp_msg_reset(msg);
                    /* will go in ajp_send_data_msg */
                    status = ajp_send_data_msg(conn->sock, msg, bufsiz);
                    if (status != APR_SUCCESS) {
                        ap_log_error(APLOG_MARK, APLOG_DEBUG, status, r->server,
@@ -240,7 +249,8 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
                    }
                    conn->worker->s->transferred += bufsiz;
                } else {
                    /* something is wrong TC asks for more body but we are
                    /*
                     * something is wrong TC asks for more body but we are
                     * already at the end of the body data
                     */
                    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
@@ -330,13 +340,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
}

/*
 * This handles ajp:// URLs, and other URLs using a remote proxy over http
 * If proxyhost is NULL, then contact the server directly, otherwise
 * go via the proxy.
 * Note that if a proxy is used, then URLs other than http: can be accessed,
 * also, if we have trouble which is clearly specific to the proxy, then
 * we return DECLINED so that we can try another proxy. (Or the direct
 * route.)
 * This handles ajp:// URLs
 */
static int proxy_ajp_handler(request_rec *r, proxy_worker *worker,
                             proxy_server_conf *conf,
@@ -351,7 +355,8 @@ static int proxy_ajp_handler(request_rec *r, proxy_worker *worker,
    proxy_dir_conf *dconf = ap_get_module_config(r->per_dir_config,
                                                 &proxy_module);

    /* Note: Memory pool allocation.
    /*
     * Note: Memory pool allocation.
     * A downstream keepalive connection is always connected to the existence
     * (or not) of an upstream keepalive connection. If this is not done then
     * load balancing against multiple backend servers breaks (one backend
@@ -399,6 +404,7 @@ static int proxy_ajp_handler(request_rec *r, proxy_worker *worker,

    if (status != OK)
        goto cleanup;

    /* 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,