modules/proxy/mod_proxy_ajp.c:256: error: INTEGER_OVERFLOW_L2
  ([0, 66559] - 6):unsigned64.

modules/proxy/mod_proxy_ajp.c:191:5: <LHS trace>
189.     proxy_server_conf *psf =
190.     ap_get_module_config(r->server->module_config, &proxy_module);
191.     apr_size_t maxsize = AJP_MSG_BUFFER_SZ;
         ^
192.     int send_body = 0;
193.     apr_off_t content_length = 0;

modules/proxy/mod_proxy_ajp.c:191:5: Assignment
189.     proxy_server_conf *psf =
190.     ap_get_module_config(r->server->module_config, &proxy_module);
191.     apr_size_t maxsize = AJP_MSG_BUFFER_SZ;
         ^
192.     int send_body = 0;
193.     apr_off_t content_length = 0;

modules/proxy/mod_proxy_ajp.c:204:5: Assignment
202.     else if (maxsize < AJP_MSG_BUFFER_SZ)
203.        maxsize = AJP_MSG_BUFFER_SZ;
204.     maxsize = APR_ALIGN(maxsize, 1024);
         ^
205. 
206.     if (*conn->worker->s->secret)

modules/proxy/mod_proxy_ajp.c:256:18: Binary operation: ([0, 66559] - 6):unsigned64
254.         /* Get client provided Content-Length header */
255.         content_length = get_content_length(r);
256.         status = ap_get_brigade(r->input_filters, input_brigade,
                      ^
257.                                 AP_MODE_READBYTES, APR_BLOCK_READ,
258.                                 maxsize - AJP_HEADER_SZ);

static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
                                proxy_conn_rec *conn,
                                conn_rec *origin,
                                proxy_dir_conf *conf,
                                apr_uri_t *uri,
                                char *url, char *server_portstr)
{
    apr_status_t status;
    int result;
    apr_bucket *e;
    apr_bucket_brigade *input_brigade;
    apr_bucket_brigade *output_brigade;
    ajp_msg_t *msg;
    apr_size_t bufsiz = 0;
    char *buff;
    char *send_body_chunk_buff;
    apr_uint16_t size;
    apr_byte_t conn_reuse = 0;
    const char *tenc;
    int havebody = 1;
    int client_failed = 0;
    int backend_failed = 0;
    apr_off_t bb_len;
    int data_sent = 0;
    int request_ended = 0;
    int headers_sent = 0;
    int rv = OK;
    apr_int32_t conn_poll_fd;
    apr_pollfd_t *conn_poll;
    proxy_server_conf *psf =
    ap_get_module_config(r->server->module_config, &proxy_module);
    apr_size_t maxsize = AJP_MSG_BUFFER_SZ;
    int send_body = 0;
    apr_off_t content_length = 0;
    int original_status = r->status;
    const char *original_status_line = r->status_line;
    const char *secret = NULL;
    if (psf->io_buffer_size_set)
       maxsize = psf->io_buffer_size;
    if (maxsize > AJP_MAX_BUFFER_SZ)
       maxsize = AJP_MAX_BUFFER_SZ;
    else if (maxsize < AJP_MSG_BUFFER_SZ)
       maxsize = AJP_MSG_BUFFER_SZ;
    maxsize = APR_ALIGN(maxsize, 1024);
    if (*conn->worker->s->secret)
        secret = conn->worker->s->secret;
    status = ajp_send_header(conn->sock, r, maxsize, uri, secret);
    if (status != APR_SUCCESS) {
        conn->close = 1;
        ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, APLOGNO(00868)
                      "request failed to %pI (%s)",
                      conn->worker->cp->addr,
                      conn->worker->s->hostname);
        if (status == AJP_EOVERFLOW)
            return HTTP_BAD_REQUEST;
        else {
            if (is_idempotent(r) == METHOD_IDEMPOTENT) {
                return HTTP_SERVICE_UNAVAILABLE;
            }
            return HTTP_INTERNAL_SERVER_ERROR;
        }
    }
    bufsiz = maxsize;
    status = ajp_alloc_data_msg(r->pool, &buff, &bufsiz, &msg);
    if (status != APR_SUCCESS) {
        conn->close = 1;
        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00869)
                      "ajp_alloc_data_msg failed");
        return HTTP_INTERNAL_SERVER_ERROR;
    }
    input_brigade = apr_brigade_create(p, r->connection->bucket_alloc);
    tenc = apr_table_get(r->headers_in, "Transfer-Encoding");
    if (tenc && (ap_casecmpstr(tenc, "chunked") == 0)) {
        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00870) "request is chunked");
    } else {
        content_length = get_content_length(r);
        status = ap_get_brigade(r->input_filters, input_brigade,
                                AP_MODE_READBYTES, APR_BLOCK_READ,
                                maxsize - AJP_HEADER_SZ);
        if (status != APR_SUCCESS) {
            conn->close = 1;
            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, status, r, APLOGNO(00871)
                          "ap_get_brigade failed");
            apr_brigade_destroy(input_brigade);
            return ap_map_http_request_error(status, HTTP_BAD_REQUEST);
        }
        if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(input_brigade))) {
            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00872) "APR_BUCKET_IS_EOS");
        }
        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00873)
                      "data to read (max %" APR_SIZE_T_FMT
                      " at %" APR_SIZE_T_FMT ")", bufsiz, msg->pos);
        status = apr_brigade_flatten(input_brigade, buff, &bufsiz);
        if (status != APR_SUCCESS) {
            conn->close = 1;
            apr_brigade_destroy(input_brigade);
            ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, APLOGNO(00874)
                          "apr_brigade_flatten");
            return HTTP_INTERNAL_SERVER_ERROR;
        }
        apr_brigade_cleanup(input_brigade);
        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00875)
                      "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");
            if (status != APR_SUCCESS) {
                conn->close = 1;
                apr_brigade_destroy(input_brigade);
                ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, APLOGNO(00876)
                              "send failed to %pI (%s)",
                              conn->worker->cp->addr,
                              conn->worker->s->hostname);
                return HTTP_INTERNAL_SERVER_ERROR;
            }
            conn->worker->s->transferred += bufsiz;
            send_body = 1;
        }
        else if (content_length > 0) {
            ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, APLOGNO(00877)
                          "read zero bytes, expecting"
                          " %" APR_OFF_T_FMT " bytes",
                          content_length);
            conn->close = 1;
            return HTTP_BAD_REQUEST;
        }
    }
    conn->data = NULL;
    status = ajp_read_header(conn->sock, r, maxsize,
                             (ajp_msg_t **)&(conn->data));
    if (status != APR_SUCCESS) {
        conn->close = 1;
        apr_brigade_destroy(input_brigade);
        ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, APLOGNO(00878)
                      "read response failed from %pI (%s)",
                      conn->worker->cp->addr,
                      conn->worker->s->hostname);
        if (APR_STATUS_IS_TIMEUP(status) &&
                conn->worker->s->ping_timeout_set) {
            return HTTP_GATEWAY_TIME_OUT;
        }
        if (!send_body && (is_idempotent(r) == METHOD_IDEMPOTENT)) {
            return HTTP_SERVICE_UNAVAILABLE;
        }
        return HTTP_INTERNAL_SERVER_ERROR;
    }
    result = ajp_parse_type(r, conn->data);
    output_brigade = apr_brigade_create(p, r->connection->bucket_alloc);
    conn_poll = apr_pcalloc(p, sizeof(apr_pollfd_t));
    conn_poll->reqevents = APR_POLLIN;
    conn_poll->desc_type = APR_POLL_SOCKET;
    conn_poll->desc.s = conn->sock;
    bufsiz = maxsize;
    for (;;) {
        switch (result) {
            case CMD_AJP13_GET_BODY_CHUNK:
                if (havebody) {
                    if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(input_brigade))) {
                        bufsiz = 0;
                        havebody = 0;
                        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, status, r, APLOGNO(00879)
                                      "APR_BUCKET_IS_EOS");
                    } else {
                        status = ap_get_brigade(r->input_filters, input_brigade,
                                                AP_MODE_READBYTES,
                                                APR_BLOCK_READ,
                                                maxsize - AJP_HEADER_SZ);
                        if (status != APR_SUCCESS) {
                            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, status, r, APLOGNO(00880)
                                          "ap_get_brigade failed");
                            if (APR_STATUS_IS_TIMEUP(status)) {
                                rv = HTTP_REQUEST_TIME_OUT;
                            }
                            else if (status == AP_FILTER_ERROR) {
                                rv = AP_FILTER_ERROR;
                            }
                            client_failed = 1;
                            break;
                        }
                        bufsiz = maxsize;
                        status = apr_brigade_flatten(input_brigade, buff,
                                                     &bufsiz);
                        apr_brigade_cleanup(input_brigade);
                        if (status != APR_SUCCESS) {
                            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, status, r, APLOGNO(00881)
                                         "apr_brigade_flatten failed");
                            rv = HTTP_INTERNAL_SERVER_ERROR;
                            client_failed = 1;
                            break;
                        }
                    }
                    ajp_msg_reset(msg);
                    status = ajp_send_data_msg(conn->sock, msg, bufsiz);
                    ajp_msg_log(r, msg, "ajp_send_data_msg after CMD_AJP13_GET_BODY_CHUNK: ajp_ilink_send packet dump");
                    if (status != APR_SUCCESS) {
                        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, status, r, APLOGNO(00882)
                                      "ajp_send_data_msg failed");
                        backend_failed = 1;
                        break;
                    }
                    conn->worker->s->transferred += bufsiz;
                } else {
                    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00883)
                                  "ap_proxy_ajp_request error read after end");
                    backend_failed = 1;
                }
                break;
            case CMD_AJP13_SEND_HEADERS:
                if (headers_sent) {
                    backend_failed = 1;
                    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00884)
                                  "Backend sent headers twice.");
                    break;
                }
                status = ajp_parse_header(r, conf, conn->data);
                if (status != APR_SUCCESS) {
                    backend_failed = 1;
                }
                else if ((r->status == 401) && conf->error_override) {
                    const char *buf;
                    const char *wa = "WWW-Authenticate";
                    if ((buf = apr_table_get(r->headers_out, wa))) {
                        apr_table_set(r->err_headers_out, wa, buf);
                    } else {
                        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00885)
                                      "ap_proxy_ajp_request: origin server "
                                      "sent 401 without WWW-Authenticate header");
                    }
                }
                headers_sent = 1;
                break;
            case CMD_AJP13_SEND_BODY_CHUNK:
                status = ajp_parse_data(r, conn->data, &size, &send_body_chunk_buff);
                if (status == APR_SUCCESS) {
                    if (!conf->error_override || !ap_is_HTTP_ERROR(r->status)) {
                        if (size == 0) {
                            if (headers_sent) {
                                e = apr_bucket_flush_create(r->connection->bucket_alloc);
                                APR_BRIGADE_INSERT_TAIL(output_brigade, e);
                            }
                            else {
                                ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00886)
                                              "Ignoring flush message "
                                              "received before headers");
                            }
                        }
                        else {
                            apr_status_t rv;
                            if (conf->error_override && !ap_is_HTTP_ERROR(r->status)
                                    && ap_is_HTTP_ERROR(original_status)) {
                                r->status = original_status;
                                r->status_line = original_status_line;
                            }
                            e = apr_bucket_transient_create(send_body_chunk_buff, size,
                                                        r->connection->bucket_alloc);
                            APR_BRIGADE_INSERT_TAIL(output_brigade, e);
                            if ((conn->worker->s->flush_packets == flush_on) ||
                                ((conn->worker->s->flush_packets == flush_auto) &&
                                ((rv = apr_poll(conn_poll, 1, &conn_poll_fd,
                                                 conn->worker->s->flush_wait))
                                                 != APR_SUCCESS) &&
                                  APR_STATUS_IS_TIMEUP(rv))) {
                                e = apr_bucket_flush_create(r->connection->bucket_alloc);
                                APR_BRIGADE_INSERT_TAIL(output_brigade, e);
                            }
                            apr_brigade_length(output_brigade, 0, &bb_len);
                            if (bb_len != -1)
                                conn->worker->s->read += bb_len;
                        }
                        if (headers_sent) {
                            if (ap_pass_brigade(r->output_filters,
                                                output_brigade) != APR_SUCCESS) {
                                ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00887)
                                              "error processing body.%s",
                                              r->connection->aborted ?
                                              " Client aborted connection." : "");
                                client_failed = 1;
                            }
                            data_sent = 1;
                            apr_brigade_cleanup(output_brigade);
                        }
                    }
                }
                else {
                    backend_failed = 1;
                }
                break;
            case CMD_AJP13_END_RESPONSE:
                status = ajp_parse_reuse(r, conn->data, &conn_reuse);
                if (status != APR_SUCCESS) {
                    backend_failed = 1;
                }
                if (!conf->error_override || !ap_is_HTTP_ERROR(r->status)) {
                    e = apr_bucket_eos_create(r->connection->bucket_alloc);
                    APR_BRIGADE_INSERT_TAIL(output_brigade, e);
                    if (ap_pass_brigade(r->output_filters,
                                        output_brigade) != APR_SUCCESS) {
                        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00888)
                                      "error processing end");
                        client_failed = 1;
                    }
                    data_sent = 1;
                }
                request_ended = 1;
                break;
            default:
                backend_failed = 1;
                break;
        }
        if (r->connection->aborted) {
            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(02821)
                          "client connection aborted");
            if (!headers_sent) {
                r->status = HTTP_BAD_REQUEST;
            }
            client_failed = 1;
            data_sent = 1;
            break;
        }
        if ((result == CMD_AJP13_END_RESPONSE)
                || backend_failed || client_failed)
            break;
        status = ajp_read_header(conn->sock, r, maxsize,
                                 (ajp_msg_t **)&(conn->data));
        if (status != APR_SUCCESS) {
            backend_failed = 1;
            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, status, r, APLOGNO(00889)
                          "ajp_read_header failed");
            break;
        }
        result = ajp_parse_type(r, conn->data);
    }
    apr_brigade_destroy(input_brigade);
    apr_brigade_cleanup(output_brigade);
    if (backend_failed || client_failed) {
        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00890)
                      "Processing of request failed backend: %i, client: %i",
                      backend_failed, client_failed);
        conn->close = 1;
        if (data_sent) {
            rv = DONE;
        }
    }
    else if (!request_ended) {
        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00891)
                      "Processing of request didn't terminate cleanly");
        conn->close = 1;
        backend_failed = 1;
        if (data_sent) {
            rv = DONE;
        }
    }
    else if (!conn_reuse) {
        conn->close = 1;
    }
    else {
        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00892)
                      "got response from %pI (%s)",
                      conn->worker->cp->addr,
                      conn->worker->s->hostname);
        if (conf->error_override && ap_is_HTTP_ERROR(r->status)) {
            rv = r->status;
            r->status = HTTP_OK;
            apr_table_setn(r->notes, "proxy-error-override", "1");
        }
        else {
            rv = OK;
        }
    }
    if (backend_failed) {
        ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, APLOGNO(00893)
                      "dialog to %pI (%s) failed",
                      conn->worker->cp->addr,
                      conn->worker->s->hostname);
        if (data_sent) {
            ap_proxy_backend_broke(r, output_brigade);
        } else if (!send_body && (is_idempotent(r) == METHOD_IDEMPOTENT)) {
            rv = HTTP_SERVICE_UNAVAILABLE;
        } else {
            if (APR_STATUS_IS_TIMEUP(status) &&
                    conn->worker->s->ping_timeout_set) {
                apr_table_setn(r->notes, "proxy_timedout", "1");
                rv = HTTP_GATEWAY_TIME_OUT;
            }
            else {
                rv = HTTP_INTERNAL_SERVER_ERROR;
            }
        }
    }
    else if (client_failed) {
        int level = (r->connection->aborted) ? APLOG_DEBUG : APLOG_ERR;
        ap_log_rerror(APLOG_MARK, level, status, r, APLOGNO(02822)
                      "dialog with client %pI failed",
                      r->connection->client_addr);
        if (rv == OK) {
            rv = HTTP_BAD_REQUEST;
        }
    }
    if (data_sent && !r->eos_sent && !r->connection->aborted
            && APR_BRIGADE_EMPTY(output_brigade)) {
        e = apr_bucket_eos_create(r->connection->bucket_alloc);
        APR_BRIGADE_INSERT_TAIL(output_brigade, e);
    }
    if (!APR_BRIGADE_EMPTY(output_brigade)
        && ap_pass_brigade(r->output_filters, output_brigade) != APR_SUCCESS) {
        rv = AP_FILTER_ERROR;
    }
    apr_brigade_destroy(output_brigade);
    if (apr_table_get(r->subprocess_env, "proxy-nokeepalive")) {
        conn->close = 1;
    }
    return rv;
}
['static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,\n                                proxy_conn_rec *conn,\n                                conn_rec *origin,\n                                proxy_dir_conf *conf,\n                                apr_uri_t *uri,\n                                char *url, char *server_portstr)\n{\n    apr_status_t status;\n    int result;\n    apr_bucket *e;\n    apr_bucket_brigade *input_brigade;\n    apr_bucket_brigade *output_brigade;\n    ajp_msg_t *msg;\n    apr_size_t bufsiz = 0;\n    char *buff;\n    char *send_body_chunk_buff;\n    apr_uint16_t size;\n    apr_byte_t conn_reuse = 0;\n    const char *tenc;\n    int havebody = 1;\n    int client_failed = 0;\n    int backend_failed = 0;\n    apr_off_t bb_len;\n    int data_sent = 0;\n    int request_ended = 0;\n    int headers_sent = 0;\n    int rv = OK;\n    apr_int32_t conn_poll_fd;\n    apr_pollfd_t *conn_poll;\n    proxy_server_conf *psf =\n    ap_get_module_config(r->server->module_config, &proxy_module);\n    apr_size_t maxsize = AJP_MSG_BUFFER_SZ;\n    int send_body = 0;\n    apr_off_t content_length = 0;\n    int original_status = r->status;\n    const char *original_status_line = r->status_line;\n    const char *secret = NULL;\n    if (psf->io_buffer_size_set)\n       maxsize = psf->io_buffer_size;\n    if (maxsize > AJP_MAX_BUFFER_SZ)\n       maxsize = AJP_MAX_BUFFER_SZ;\n    else if (maxsize < AJP_MSG_BUFFER_SZ)\n       maxsize = AJP_MSG_BUFFER_SZ;\n    maxsize = APR_ALIGN(maxsize, 1024);\n    if (*conn->worker->s->secret)\n        secret = conn->worker->s->secret;\n    status = ajp_send_header(conn->sock, r, maxsize, uri, secret);\n    if (status != APR_SUCCESS) {\n        conn->close = 1;\n        ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, APLOGNO(00868)\n                      "request failed to %pI (%s)",\n                      conn->worker->cp->addr,\n                      conn->worker->s->hostname);\n        if (status == AJP_EOVERFLOW)\n            return HTTP_BAD_REQUEST;\n        else {\n            if (is_idempotent(r) == METHOD_IDEMPOTENT) {\n                return HTTP_SERVICE_UNAVAILABLE;\n            }\n            return HTTP_INTERNAL_SERVER_ERROR;\n        }\n    }\n    bufsiz = maxsize;\n    status = ajp_alloc_data_msg(r->pool, &buff, &bufsiz, &msg);\n    if (status != APR_SUCCESS) {\n        conn->close = 1;\n        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00869)\n                      "ajp_alloc_data_msg failed");\n        return HTTP_INTERNAL_SERVER_ERROR;\n    }\n    input_brigade = apr_brigade_create(p, r->connection->bucket_alloc);\n    tenc = apr_table_get(r->headers_in, "Transfer-Encoding");\n    if (tenc && (ap_casecmpstr(tenc, "chunked") == 0)) {\n        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00870) "request is chunked");\n    } else {\n        content_length = get_content_length(r);\n        status = ap_get_brigade(r->input_filters, input_brigade,\n                                AP_MODE_READBYTES, APR_BLOCK_READ,\n                                maxsize - AJP_HEADER_SZ);\n        if (status != APR_SUCCESS) {\n            conn->close = 1;\n            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, status, r, APLOGNO(00871)\n                          "ap_get_brigade failed");\n            apr_brigade_destroy(input_brigade);\n            return ap_map_http_request_error(status, HTTP_BAD_REQUEST);\n        }\n        if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(input_brigade))) {\n            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00872) "APR_BUCKET_IS_EOS");\n        }\n        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00873)\n                      "data to read (max %" APR_SIZE_T_FMT\n                      " at %" APR_SIZE_T_FMT ")", bufsiz, msg->pos);\n        status = apr_brigade_flatten(input_brigade, buff, &bufsiz);\n        if (status != APR_SUCCESS) {\n            conn->close = 1;\n            apr_brigade_destroy(input_brigade);\n            ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, APLOGNO(00874)\n                          "apr_brigade_flatten");\n            return HTTP_INTERNAL_SERVER_ERROR;\n        }\n        apr_brigade_cleanup(input_brigade);\n        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00875)\n                      "got %" APR_SIZE_T_FMT " bytes of data", bufsiz);\n        if (bufsiz > 0) {\n            status = ajp_send_data_msg(conn->sock, msg, bufsiz);\n            ajp_msg_log(r, msg, "First ajp_send_data_msg: ajp_ilink_send packet dump");\n            if (status != APR_SUCCESS) {\n                conn->close = 1;\n                apr_brigade_destroy(input_brigade);\n                ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, APLOGNO(00876)\n                              "send failed to %pI (%s)",\n                              conn->worker->cp->addr,\n                              conn->worker->s->hostname);\n                return HTTP_INTERNAL_SERVER_ERROR;\n            }\n            conn->worker->s->transferred += bufsiz;\n            send_body = 1;\n        }\n        else if (content_length > 0) {\n            ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, APLOGNO(00877)\n                          "read zero bytes, expecting"\n                          " %" APR_OFF_T_FMT " bytes",\n                          content_length);\n            conn->close = 1;\n            return HTTP_BAD_REQUEST;\n        }\n    }\n    conn->data = NULL;\n    status = ajp_read_header(conn->sock, r, maxsize,\n                             (ajp_msg_t **)&(conn->data));\n    if (status != APR_SUCCESS) {\n        conn->close = 1;\n        apr_brigade_destroy(input_brigade);\n        ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, APLOGNO(00878)\n                      "read response failed from %pI (%s)",\n                      conn->worker->cp->addr,\n                      conn->worker->s->hostname);\n        if (APR_STATUS_IS_TIMEUP(status) &&\n                conn->worker->s->ping_timeout_set) {\n            return HTTP_GATEWAY_TIME_OUT;\n        }\n        if (!send_body && (is_idempotent(r) == METHOD_IDEMPOTENT)) {\n            return HTTP_SERVICE_UNAVAILABLE;\n        }\n        return HTTP_INTERNAL_SERVER_ERROR;\n    }\n    result = ajp_parse_type(r, conn->data);\n    output_brigade = apr_brigade_create(p, r->connection->bucket_alloc);\n    conn_poll = apr_pcalloc(p, sizeof(apr_pollfd_t));\n    conn_poll->reqevents = APR_POLLIN;\n    conn_poll->desc_type = APR_POLL_SOCKET;\n    conn_poll->desc.s = conn->sock;\n    bufsiz = maxsize;\n    for (;;) {\n        switch (result) {\n            case CMD_AJP13_GET_BODY_CHUNK:\n                if (havebody) {\n                    if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(input_brigade))) {\n                        bufsiz = 0;\n                        havebody = 0;\n                        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, status, r, APLOGNO(00879)\n                                      "APR_BUCKET_IS_EOS");\n                    } else {\n                        status = ap_get_brigade(r->input_filters, input_brigade,\n                                                AP_MODE_READBYTES,\n                                                APR_BLOCK_READ,\n                                                maxsize - AJP_HEADER_SZ);\n                        if (status != APR_SUCCESS) {\n                            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, status, r, APLOGNO(00880)\n                                          "ap_get_brigade failed");\n                            if (APR_STATUS_IS_TIMEUP(status)) {\n                                rv = HTTP_REQUEST_TIME_OUT;\n                            }\n                            else if (status == AP_FILTER_ERROR) {\n                                rv = AP_FILTER_ERROR;\n                            }\n                            client_failed = 1;\n                            break;\n                        }\n                        bufsiz = maxsize;\n                        status = apr_brigade_flatten(input_brigade, buff,\n                                                     &bufsiz);\n                        apr_brigade_cleanup(input_brigade);\n                        if (status != APR_SUCCESS) {\n                            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, status, r, APLOGNO(00881)\n                                         "apr_brigade_flatten failed");\n                            rv = HTTP_INTERNAL_SERVER_ERROR;\n                            client_failed = 1;\n                            break;\n                        }\n                    }\n                    ajp_msg_reset(msg);\n                    status = ajp_send_data_msg(conn->sock, msg, bufsiz);\n                    ajp_msg_log(r, msg, "ajp_send_data_msg after CMD_AJP13_GET_BODY_CHUNK: ajp_ilink_send packet dump");\n                    if (status != APR_SUCCESS) {\n                        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, status, r, APLOGNO(00882)\n                                      "ajp_send_data_msg failed");\n                        backend_failed = 1;\n                        break;\n                    }\n                    conn->worker->s->transferred += bufsiz;\n                } else {\n                    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00883)\n                                  "ap_proxy_ajp_request error read after end");\n                    backend_failed = 1;\n                }\n                break;\n            case CMD_AJP13_SEND_HEADERS:\n                if (headers_sent) {\n                    backend_failed = 1;\n                    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00884)\n                                  "Backend sent headers twice.");\n                    break;\n                }\n                status = ajp_parse_header(r, conf, conn->data);\n                if (status != APR_SUCCESS) {\n                    backend_failed = 1;\n                }\n                else if ((r->status == 401) && conf->error_override) {\n                    const char *buf;\n                    const char *wa = "WWW-Authenticate";\n                    if ((buf = apr_table_get(r->headers_out, wa))) {\n                        apr_table_set(r->err_headers_out, wa, buf);\n                    } else {\n                        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00885)\n                                      "ap_proxy_ajp_request: origin server "\n                                      "sent 401 without WWW-Authenticate header");\n                    }\n                }\n                headers_sent = 1;\n                break;\n            case CMD_AJP13_SEND_BODY_CHUNK:\n                status = ajp_parse_data(r, conn->data, &size, &send_body_chunk_buff);\n                if (status == APR_SUCCESS) {\n                    if (!conf->error_override || !ap_is_HTTP_ERROR(r->status)) {\n                        if (size == 0) {\n                            if (headers_sent) {\n                                e = apr_bucket_flush_create(r->connection->bucket_alloc);\n                                APR_BRIGADE_INSERT_TAIL(output_brigade, e);\n                            }\n                            else {\n                                ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00886)\n                                              "Ignoring flush message "\n                                              "received before headers");\n                            }\n                        }\n                        else {\n                            apr_status_t rv;\n                            if (conf->error_override && !ap_is_HTTP_ERROR(r->status)\n                                    && ap_is_HTTP_ERROR(original_status)) {\n                                r->status = original_status;\n                                r->status_line = original_status_line;\n                            }\n                            e = apr_bucket_transient_create(send_body_chunk_buff, size,\n                                                        r->connection->bucket_alloc);\n                            APR_BRIGADE_INSERT_TAIL(output_brigade, e);\n                            if ((conn->worker->s->flush_packets == flush_on) ||\n                                ((conn->worker->s->flush_packets == flush_auto) &&\n                                ((rv = apr_poll(conn_poll, 1, &conn_poll_fd,\n                                                 conn->worker->s->flush_wait))\n                                                 != APR_SUCCESS) &&\n                                  APR_STATUS_IS_TIMEUP(rv))) {\n                                e = apr_bucket_flush_create(r->connection->bucket_alloc);\n                                APR_BRIGADE_INSERT_TAIL(output_brigade, e);\n                            }\n                            apr_brigade_length(output_brigade, 0, &bb_len);\n                            if (bb_len != -1)\n                                conn->worker->s->read += bb_len;\n                        }\n                        if (headers_sent) {\n                            if (ap_pass_brigade(r->output_filters,\n                                                output_brigade) != APR_SUCCESS) {\n                                ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00887)\n                                              "error processing body.%s",\n                                              r->connection->aborted ?\n                                              " Client aborted connection." : "");\n                                client_failed = 1;\n                            }\n                            data_sent = 1;\n                            apr_brigade_cleanup(output_brigade);\n                        }\n                    }\n                }\n                else {\n                    backend_failed = 1;\n                }\n                break;\n            case CMD_AJP13_END_RESPONSE:\n                status = ajp_parse_reuse(r, conn->data, &conn_reuse);\n                if (status != APR_SUCCESS) {\n                    backend_failed = 1;\n                }\n                if (!conf->error_override || !ap_is_HTTP_ERROR(r->status)) {\n                    e = apr_bucket_eos_create(r->connection->bucket_alloc);\n                    APR_BRIGADE_INSERT_TAIL(output_brigade, e);\n                    if (ap_pass_brigade(r->output_filters,\n                                        output_brigade) != APR_SUCCESS) {\n                        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00888)\n                                      "error processing end");\n                        client_failed = 1;\n                    }\n                    data_sent = 1;\n                }\n                request_ended = 1;\n                break;\n            default:\n                backend_failed = 1;\n                break;\n        }\n        if (r->connection->aborted) {\n            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(02821)\n                          "client connection aborted");\n            if (!headers_sent) {\n                r->status = HTTP_BAD_REQUEST;\n            }\n            client_failed = 1;\n            data_sent = 1;\n            break;\n        }\n        if ((result == CMD_AJP13_END_RESPONSE)\n                || backend_failed || client_failed)\n            break;\n        status = ajp_read_header(conn->sock, r, maxsize,\n                                 (ajp_msg_t **)&(conn->data));\n        if (status != APR_SUCCESS) {\n            backend_failed = 1;\n            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, status, r, APLOGNO(00889)\n                          "ajp_read_header failed");\n            break;\n        }\n        result = ajp_parse_type(r, conn->data);\n    }\n    apr_brigade_destroy(input_brigade);\n    apr_brigade_cleanup(output_brigade);\n    if (backend_failed || client_failed) {\n        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00890)\n                      "Processing of request failed backend: %i, client: %i",\n                      backend_failed, client_failed);\n        conn->close = 1;\n        if (data_sent) {\n            rv = DONE;\n        }\n    }\n    else if (!request_ended) {\n        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00891)\n                      "Processing of request didn\'t terminate cleanly");\n        conn->close = 1;\n        backend_failed = 1;\n        if (data_sent) {\n            rv = DONE;\n        }\n    }\n    else if (!conn_reuse) {\n        conn->close = 1;\n    }\n    else {\n        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00892)\n                      "got response from %pI (%s)",\n                      conn->worker->cp->addr,\n                      conn->worker->s->hostname);\n        if (conf->error_override && ap_is_HTTP_ERROR(r->status)) {\n            rv = r->status;\n            r->status = HTTP_OK;\n            apr_table_setn(r->notes, "proxy-error-override", "1");\n        }\n        else {\n            rv = OK;\n        }\n    }\n    if (backend_failed) {\n        ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, APLOGNO(00893)\n                      "dialog to %pI (%s) failed",\n                      conn->worker->cp->addr,\n                      conn->worker->s->hostname);\n        if (data_sent) {\n            ap_proxy_backend_broke(r, output_brigade);\n        } else if (!send_body && (is_idempotent(r) == METHOD_IDEMPOTENT)) {\n            rv = HTTP_SERVICE_UNAVAILABLE;\n        } else {\n            if (APR_STATUS_IS_TIMEUP(status) &&\n                    conn->worker->s->ping_timeout_set) {\n                apr_table_setn(r->notes, "proxy_timedout", "1");\n                rv = HTTP_GATEWAY_TIME_OUT;\n            }\n            else {\n                rv = HTTP_INTERNAL_SERVER_ERROR;\n            }\n        }\n    }\n    else if (client_failed) {\n        int level = (r->connection->aborted) ? APLOG_DEBUG : APLOG_ERR;\n        ap_log_rerror(APLOG_MARK, level, status, r, APLOGNO(02822)\n                      "dialog with client %pI failed",\n                      r->connection->client_addr);\n        if (rv == OK) {\n            rv = HTTP_BAD_REQUEST;\n        }\n    }\n    if (data_sent && !r->eos_sent && !r->connection->aborted\n            && APR_BRIGADE_EMPTY(output_brigade)) {\n        e = apr_bucket_eos_create(r->connection->bucket_alloc);\n        APR_BRIGADE_INSERT_TAIL(output_brigade, e);\n    }\n    if (!APR_BRIGADE_EMPTY(output_brigade)\n        && ap_pass_brigade(r->output_filters, output_brigade) != APR_SUCCESS) {\n        rv = AP_FILTER_ERROR;\n    }\n    apr_brigade_destroy(output_brigade);\n    if (apr_table_get(r->subprocess_env, "proxy-nokeepalive")) {\n        conn->close = 1;\n    }\n    return rv;\n}']