From: Stefan Fritsch Date: Fri, 18 Nov 2011 22:06:26 +0000 (+0000) Subject: Backport r1203878: X-Git-Tag: 2.3.16~140 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=19decefbd6eff57d7c27481da79c668c1e647caa;p=apache Backport r1203878: More ap_log_rerror() usage and axe some more AJP: prefixes git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1203881 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/proxy/ajp_header.c b/modules/proxy/ajp_header.c index 0c8a333dd4..c40a88a496 100644 --- a/modules/proxy/ajp_header.c +++ b/modules/proxy/ajp_header.c @@ -223,11 +223,10 @@ static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg, const apr_array_header_t *arr = apr_table_elts(r->subprocess_env); const apr_table_entry_t *elts = (const apr_table_entry_t *)arr->elts; - ap_log_error(APLOG_MARK, APLOG_TRACE8, 0, r->server, - "Into ajp_marshal_into_msgb"); + ap_log_rerror(APLOG_MARK, APLOG_TRACE8, 0, r, "Into ajp_marshal_into_msgb"); if ((method = sc_for_req_method_by_id(r)) == UNKNOWN_METHOD) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_marshal_into_msgb - No such method %s", r->method); return AJP_EBAD_METHOD; @@ -255,7 +254,7 @@ static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg, ajp_msg_append_uint8(msg, is_ssl) || ajp_msg_append_uint16(msg, (apr_uint16_t) num_headers)) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_marshal_into_msgb: " "Error appending the message begining"); return APR_EGENERAL; @@ -268,7 +267,7 @@ static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg, if ((sc = sc_for_req_header(elts[i].key)) != UNKNOWN_METHOD) { if (ajp_msg_append_uint16(msg, (apr_uint16_t)sc)) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_marshal_into_msgb: " "Error appending the header name"); return AJP_EOVERFLOW; @@ -276,7 +275,7 @@ static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg, } else { if (ajp_msg_append_string(msg, elts[i].key)) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_marshal_into_msgb: " "Error appending the header name"); return AJP_EOVERFLOW; @@ -284,12 +283,12 @@ static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg, } if (ajp_msg_append_string(msg, elts[i].val)) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_marshal_into_msgb: " "Error appending the header value"); return AJP_EOVERFLOW; } - ap_log_error(APLOG_MARK, APLOG_TRACE5, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_TRACE5, 0, r, "ajp_marshal_into_msgb: Header[%d] [%s] = [%s]", i, elts[i].key, elts[i].val); } @@ -298,7 +297,7 @@ static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg, if (s->secret) { if (ajp_msg_append_uint8(msg, SC_A_SECRET) || ajp_msg_append_string(msg, s->secret)) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "Error ajp_marshal_into_msgb - " "Error appending secret"); return APR_EGENERAL; @@ -309,7 +308,7 @@ static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg, if (r->user) { if (ajp_msg_append_uint8(msg, SC_A_REMOTE_USER) || ajp_msg_append_string(msg, r->user)) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_marshal_into_msgb: " "Error appending the remote user"); return AJP_EOVERFLOW; @@ -318,7 +317,7 @@ static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg, if (r->ap_auth_type) { if (ajp_msg_append_uint8(msg, SC_A_AUTH_TYPE) || ajp_msg_append_string(msg, r->ap_auth_type)) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_marshal_into_msgb: " "Error appending the auth type"); return AJP_EOVERFLOW; @@ -328,7 +327,7 @@ static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg, if (uri->query) { if (ajp_msg_append_uint8(msg, SC_A_QUERY_STRING) || ajp_msg_append_string(msg, uri->query)) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_marshal_into_msgb: " "Error appending the query string"); return AJP_EOVERFLOW; @@ -337,7 +336,7 @@ static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg, if ((session_route = apr_table_get(r->notes, "session-route"))) { if (ajp_msg_append_uint8(msg, SC_A_JVM_ROUTE) || ajp_msg_append_string(msg, session_route)) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_marshal_into_msgb: " "Error appending the jvm route"); return AJP_EOVERFLOW; @@ -360,9 +359,9 @@ static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg, && envvar[0]) { if (ajp_msg_append_uint8(msg, SC_A_SSL_CERT) || ajp_msg_append_string(msg, envvar)) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, - "ajp_marshal_into_msgb: " - "Error appending the SSL certificates"); + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, + "ajp_marshal_into_msgb: " + "Error appending the SSL certificates"); return AJP_EOVERFLOW; } } @@ -372,9 +371,9 @@ static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg, && envvar[0]) { if (ajp_msg_append_uint8(msg, SC_A_SSL_CIPHER) || ajp_msg_append_string(msg, envvar)) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, - "ajp_marshal_into_msgb: " - "Error appending the SSL ciphers"); + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, + "ajp_marshal_into_msgb: " + "Error appending the SSL ciphers"); return AJP_EOVERFLOW; } } @@ -384,9 +383,9 @@ static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg, && envvar[0]) { if (ajp_msg_append_uint8(msg, SC_A_SSL_SESSION) || ajp_msg_append_string(msg, envvar)) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, - "ajp_marshal_into_msgb: " - "Error appending the SSL session"); + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, + "ajp_marshal_into_msgb: " + "Error appending the SSL session"); return AJP_EOVERFLOW; } } @@ -398,9 +397,9 @@ static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg, if (ajp_msg_append_uint8(msg, SC_A_SSL_KEY_SIZE) || ajp_msg_append_uint16(msg, (unsigned short) atoi(envvar))) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, - "Error ajp_marshal_into_msgb - " - "Error appending the SSL key size"); + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, + "ajp_marshal_into_msgb: " + "Error appending the SSL key size"); return APR_EGENERAL; } } @@ -418,7 +417,7 @@ static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg, if (ajp_msg_append_uint8(msg, SC_A_REQ_ATTRIBUTE) || ajp_msg_append_string(msg, key) || ajp_msg_append_string(msg, val)) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_marshal_into_msgb: " "Error appending attribute %s=%s", key, val); @@ -433,7 +432,7 @@ static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg, if (ajp_msg_append_uint8(msg, SC_A_REQ_ATTRIBUTE) || ajp_msg_append_string(msg, elts[i].key + 4) || ajp_msg_append_string(msg, elts[i].val)) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_marshal_into_msgb: " "Error appending attribute %s=%s", elts[i].key, elts[i].val); @@ -443,13 +442,13 @@ static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg, } if (ajp_msg_append_uint8(msg, SC_A_ARE_DONE)) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_marshal_into_msgb: " "Error appending the message end"); return AJP_EOVERFLOW; } - ap_log_error(APLOG_MARK, APLOG_TRACE8, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_TRACE8, 0, r, "ajp_marshal_into_msgb: Done"); return APR_SUCCESS; } @@ -498,7 +497,7 @@ static apr_status_t ajp_unmarshal_response(ajp_msg_t *msg, rc = ajp_msg_get_uint16(msg, &status); if (rc != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_unmarshal_response: Null status"); return rc; } @@ -515,7 +514,7 @@ static apr_status_t ajp_unmarshal_response(ajp_msg_t *msg, r->status_line = NULL; } - ap_log_error(APLOG_MARK, APLOG_TRACE4, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_TRACE4, 0, r, "ajp_unmarshal_response: status = %d", status); rc = ajp_msg_get_uint16(msg, &num_headers); @@ -536,7 +535,7 @@ static apr_status_t ajp_unmarshal_response(ajp_msg_t *msg, num_headers = 0; } - ap_log_error(APLOG_MARK, APLOG_TRACE4, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_TRACE4, 0, r, "ajp_unmarshal_response: Number of headers is = %d", num_headers); @@ -553,7 +552,7 @@ static apr_status_t ajp_unmarshal_response(ajp_msg_t *msg, ajp_msg_get_uint16(msg, &name); stringname = long_res_header_for_sc(name); if (stringname == NULL) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_unmarshal_response: " "No such sc (%08x)", name); @@ -563,7 +562,7 @@ static apr_status_t ajp_unmarshal_response(ajp_msg_t *msg, name = 0; rc = ajp_msg_get_string(msg, &stringname); if (rc != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_unmarshal_response: " "Null header name"); return rc; @@ -573,7 +572,7 @@ static apr_status_t ajp_unmarshal_response(ajp_msg_t *msg, rc = ajp_msg_get_string(msg, &value); if (rc != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_unmarshal_response: " "Null header value"); return rc; @@ -594,7 +593,7 @@ static apr_status_t ajp_unmarshal_response(ajp_msg_t *msg, } ap_xlate_proto_from_ascii(value, strlen(value)); - ap_log_error(APLOG_MARK, APLOG_TRACE5, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_TRACE5, 0, r, "ajp_unmarshal_response: Header[%d] [%s] = [%s]", i, stringname, value); @@ -604,7 +603,7 @@ static apr_status_t ajp_unmarshal_response(ajp_msg_t *msg, if (strcasecmp(stringname, "Content-Type") == 0) { /* add corresponding filter */ ap_set_content_type(r, apr_pstrdup(r->pool, value)); - ap_log_error(APLOG_MARK, APLOG_TRACE5, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_TRACE5, 0, r, "ajp_unmarshal_response: ap_set_content_type to '%s'", value); } } @@ -625,14 +624,14 @@ apr_status_t ajp_send_header(apr_socket_t *sock, rc = ajp_msg_create(r->pool, buffsize, &msg); if (rc != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_send_header: ajp_msg_create failed"); return rc; } rc = ajp_marshal_into_msgb(msg, r, uri); if (rc != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_send_header: ajp_marshal_into_msgb failed"); return rc; } @@ -640,7 +639,7 @@ apr_status_t ajp_send_header(apr_socket_t *sock, rc = ajp_ilink_send(sock, msg); ajp_msg_log(r, msg, "ajp_send_header: ajp_ilink_send packet dump"); if (rc != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_send_header: ajp_ilink_send failed"); return rc; } @@ -662,7 +661,7 @@ apr_status_t ajp_read_header(apr_socket_t *sock, if (*msg) { rc = ajp_msg_reuse(*msg); if (rc != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_read_header: ajp_msg_reuse failed"); return rc; } @@ -670,7 +669,7 @@ apr_status_t ajp_read_header(apr_socket_t *sock, else { rc = ajp_msg_create(r->pool, buffsize, msg); if (rc != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_read_header: ajp_msg_create failed"); return rc; } @@ -678,13 +677,13 @@ apr_status_t ajp_read_header(apr_socket_t *sock, ajp_msg_reset(*msg); rc = ajp_ilink_receive(sock, *msg); if (rc != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_read_header: ajp_ilink_receive failed"); return rc; } ajp_msg_log(r, *msg, "ajp_read_header: ajp_ilink_receive packet dump"); rc = ajp_msg_peek_uint8(*msg, &result); - ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "ajp_read_header: ajp_ilink_received %s (0x%02x)", ajp_type_str(result), result); return APR_SUCCESS; @@ -695,7 +694,7 @@ int ajp_parse_type(request_rec *r, ajp_msg_t *msg) { apr_byte_t result; ajp_msg_peek_uint8(msg, &result); - ap_log_error(APLOG_MARK, APLOG_TRACE6, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_TRACE6, 0, r, "ajp_parse_type: got %s (0x%02x)", ajp_type_str(result), result); return (int) result; @@ -710,12 +709,12 @@ apr_status_t ajp_parse_header(request_rec *r, proxy_dir_conf *conf, rc = ajp_msg_get_uint8(msg, &result); if (rc != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_parse_headers: ajp_msg_get_byte failed"); return rc; } if (result != CMD_AJP13_SEND_HEADERS) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_parse_headers: wrong type %s (0x%02x) expecting %s (0x%02x)", ajp_type_str(result), result, ajp_type_str(CMD_AJP13_SEND_HEADERS), CMD_AJP13_SEND_HEADERS); @@ -734,12 +733,12 @@ apr_status_t ajp_parse_data(request_rec *r, ajp_msg_t *msg, rc = ajp_msg_get_uint8(msg, &result); if (rc != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_parse_data: ajp_msg_get_byte failed"); return rc; } if (result != CMD_AJP13_SEND_BODY_CHUNK) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_parse_data: wrong type %s (0x%02x) expecting %s (0x%02x)", ajp_type_str(result), result, ajp_type_str(CMD_AJP13_SEND_BODY_CHUNK), CMD_AJP13_SEND_BODY_CHUNK); @@ -761,7 +760,7 @@ apr_status_t ajp_parse_data(request_rec *r, ajp_msg_t *msg, */ expected_len = msg->len - (AJP_HEADER_LEN + AJP_HEADER_SZ_LEN + 1 + 1); if (*len != expected_len) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_parse_data: Wrong chunk length. Length of chunk is %i," " expected length is %i.", *len, expected_len); return AJP_EBAD_HEADER; @@ -779,12 +778,12 @@ apr_status_t ajp_parse_reuse(request_rec *r, ajp_msg_t *msg, rc = ajp_msg_get_uint8(msg, &result); if (rc != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_parse_reuse: ajp_msg_get_byte failed"); return rc; } if (result != CMD_AJP13_END_RESPONSE) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_parse_reuse: wrong type %s (0x%02x) expecting %s (0x%02x)", ajp_type_str(result), result, ajp_type_str(CMD_AJP13_END_RESPONSE), CMD_AJP13_END_RESPONSE); diff --git a/modules/proxy/ajp_utils.c b/modules/proxy/ajp_utils.c index f89b10f61f..b9ccab5d09 100644 --- a/modules/proxy/ajp_utils.c +++ b/modules/proxy/ajp_utils.c @@ -30,19 +30,19 @@ apr_status_t ajp_handle_cping_cpong(apr_socket_t *sock, apr_interval_time_t org; apr_byte_t result; - ap_log_error(APLOG_MARK, APLOG_TRACE8, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_TRACE8, 0, r, "Into ajp_handle_cping_cpong"); rc = ajp_msg_create(r->pool, AJP_PING_PONG_SZ, &msg); if (rc != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_handle_cping_cpong: ajp_msg_create failed"); return rc; } rc = ajp_msg_serialize_cping(msg); if (rc != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_handle_cping_cpong: ajp_marshal_into_msgb failed"); return rc; } @@ -50,14 +50,14 @@ apr_status_t ajp_handle_cping_cpong(apr_socket_t *sock, rc = ajp_ilink_send(sock, msg); ajp_msg_log(r, msg, "ajp_handle_cping_cpong: ajp_ilink_send packet dump"); if (rc != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_handle_cping_cpong: ajp_ilink_send failed"); return rc; } rc = apr_socket_timeout_get(sock, &org); if (rc != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_handle_cping_cpong: apr_socket_timeout_get failed"); return rc; } @@ -65,7 +65,7 @@ apr_status_t ajp_handle_cping_cpong(apr_socket_t *sock, /* Set CPING/CPONG response timeout */ rc = apr_socket_timeout_set(sock, timeout); if (rc != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_handle_cping_cpong: apr_socket_timeout_set failed"); return rc; } @@ -74,7 +74,7 @@ apr_status_t ajp_handle_cping_cpong(apr_socket_t *sock, /* Read CPONG reply */ rv = ajp_ilink_receive(sock, msg); if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_handle_cping_cpong: ajp_ilink_receive failed"); goto cleanup; } @@ -82,12 +82,12 @@ apr_status_t ajp_handle_cping_cpong(apr_socket_t *sock, ajp_msg_log(r, msg, "ajp_handle_cping_cpong: ajp_ilink_receive packet dump"); rv = ajp_msg_get_uint8(msg, &result); if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_handle_cping_cpong: invalid CPONG message"); goto cleanup; } if (result != CMD_AJP13_CPONG) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_handle_cping_cpong: awaited CPONG, received %d ", result); rv = APR_EGENERAL; @@ -98,12 +98,12 @@ cleanup: /* Restore original socket timeout */ rc = apr_socket_timeout_set(sock, org); if (rc != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "ajp_handle_cping_cpong: apr_socket_timeout_set failed"); return rc; } - ap_log_error(APLOG_MARK, APLOG_TRACE8, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_TRACE8, 0, r, "ajp_handle_cping_cpong: Done"); return rv; } diff --git a/modules/proxy/mod_proxy_ajp.c b/modules/proxy/mod_proxy_ajp.c index f965d26323..350ab4f9c0 100644 --- a/modules/proxy/mod_proxy_ajp.c +++ b/modules/proxy/mod_proxy_ajp.c @@ -42,8 +42,7 @@ static int proxy_ajp_canon(request_rec *r, char *url) return DECLINED; } - ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server, - "AJP: canonicalising URL %s", url); + ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "canonicalising URL %s", url); /* * do syntactic check. @@ -51,8 +50,7 @@ static int proxy_ajp_canon(request_rec *r, char *url) */ err = ap_proxy_canon_netloc(r->pool, &url, NULL, NULL, &host, &port); if (err) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, - "error parsing URL %s: %s", + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "error parsing URL %s: %s", url, err); return HTTP_BAD_REQUEST; } @@ -210,10 +208,10 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r, status = ajp_send_header(conn->sock, r, maxsize, uri); if (status != APR_SUCCESS) { conn->close++; - ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server, - "AJP: request failed to %pI (%s)", - conn->worker->cp->addr, - conn->worker->s->hostname); + ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, + "request failed to %pI (%s)", + conn->worker->cp->addr, + conn->worker->s->hostname); if (status == AJP_EOVERFLOW) return HTTP_BAD_REQUEST; else if (status == AJP_EBAD_METHOD) { @@ -237,8 +235,8 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r, if (status != APR_SUCCESS) { /* We had a failure: Close connection to backend */ conn->close++; - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "ajp_alloc_data_msg failed"); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "ajp_alloc_data_msg failed"); return HTTP_INTERNAL_SERVER_ERROR; } @@ -247,8 +245,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r, tenc = apr_table_get(r->headers_in, "Transfer-Encoding"); 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, - "request is chunked"); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "request is chunked"); } else { /* Get client provided Content-Length header */ content_length = get_content_length(r); @@ -259,36 +256,35 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r, if (status != APR_SUCCESS) { /* We had a failure: Close connection to backend */ conn->close++; - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "ap_get_brigade failed"); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "ap_get_brigade failed"); apr_brigade_destroy(input_brigade); return HTTP_BAD_REQUEST; } /* have something */ if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(input_brigade))) { - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "APR_BUCKET_IS_EOS"); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "APR_BUCKET_IS_EOS"); } /* Try to send something */ - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "data to read (max %" APR_SIZE_T_FMT - " at %" APR_SIZE_T_FMT ")", bufsiz, msg->pos); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "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) { /* We had a failure: Close connection to backend */ conn->close++; apr_brigade_destroy(input_brigade); - ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server, - "apr_brigade_flatten"); + ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, + "apr_brigade_flatten"); return HTTP_INTERNAL_SERVER_ERROR; } apr_brigade_cleanup(input_brigade); - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "got %" APR_SIZE_T_FMT " bytes of data", bufsiz); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "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"); @@ -296,10 +292,10 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r, /* We had a failure: Close connection to backend */ conn->close++; apr_brigade_destroy(input_brigade); - ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server, - "send failed to %pI (%s)", - conn->worker->cp->addr, - conn->worker->s->hostname); + ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, + "send failed to %pI (%s)", + conn->worker->cp->addr, + conn->worker->s->hostname); /* * It is fatal when we failed to send a (part) of the request * body. @@ -310,10 +306,10 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r, send_body = 1; } else if (content_length > 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server, - "read zero bytes, expecting" - " %" APR_OFF_T_FMT " bytes", - content_length); + ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, + "read zero bytes, expecting" + " %" APR_OFF_T_FMT " bytes", + content_length); /* * We can only get here if the client closed the connection * to us without sending the body. @@ -336,10 +332,10 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r, /* We had a failure: Close connection to backend */ conn->close++; apr_brigade_destroy(input_brigade); - ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server, - "read response failed from %pI (%s)", - conn->worker->cp->addr, - conn->worker->s->hostname); + ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, + "read response failed from %pI (%s)", + conn->worker->cp->addr, + conn->worker->s->hostname); /* If we had a successful cping/cpong and then a timeout * we assume it is a request that cause a back-end timeout, @@ -383,17 +379,16 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r, /* This is the end */ bufsiz = 0; havebody = 0; - ap_log_error(APLOG_MARK, APLOG_DEBUG, status, r->server, - "APR_BUCKET_IS_EOS"); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, status, r, + "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_error(APLOG_MARK, APLOG_DEBUG, status, - r->server, - "ap_get_brigade failed"); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, status, r, + "ap_get_brigade failed"); output_failed = 1; break; } @@ -402,8 +397,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r, &bufsiz); apr_brigade_cleanup(input_brigade); if (status != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_DEBUG, status, - r->server, + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, status, r, "apr_brigade_flatten failed"); output_failed = 1; break; @@ -415,8 +409,8 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r, 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_error(APLOG_MARK, APLOG_DEBUG, status, r->server, - "ajp_send_data_msg failed"); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, status, r, + "ajp_send_data_msg failed"); backend_failed = 1; break; } @@ -426,8 +420,8 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r, * 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, - "ap_proxy_ajp_request error read after end"); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "ap_proxy_ajp_request error read after end"); backend_failed = 1; } break; @@ -437,8 +431,8 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r, * Backend already send us the headers. */ backend_failed = 1; - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "Backend sent headers twice."); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "Backend sent headers twice."); break; } /* AJP13_SEND_HEADERS: process them */ @@ -452,9 +446,9 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r, if ((buf = apr_table_get(r->headers_out, wa))) { apr_table_set(r->err_headers_out, wa, buf); } else { - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "ap_proxy_ajp_request: origin server " - "sent 401 without WWW-Authenticate header"); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "ap_proxy_ajp_request: origin server " + "sent 401 without WWW-Authenticate header"); } } headers_sent = 1; @@ -476,8 +470,9 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r, APR_BRIGADE_INSERT_TAIL(output_brigade, e); } else { - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "Ignoring flush message received before headers"); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "Ignoring flush message " + "received before headers"); } } else { @@ -583,8 +578,8 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r, (ajp_msg_t **)&(conn->data)); if (status != APR_SUCCESS) { backend_failed = 1; - ap_log_error(APLOG_MARK, APLOG_DEBUG, status, r->server, - "ajp_read_header failed"); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, status, r, + "ajp_read_header failed"); break; } result = ajp_parse_type(r, conn->data); @@ -598,9 +593,9 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r, apr_brigade_cleanup(output_brigade); if (backend_failed || output_failed) { - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "Processing of request failed backend: %i, " - "output: %i", backend_failed, output_failed); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "Processing of request failed backend: %i, " + "output: %i", backend_failed, output_failed); /* We had a failure: Close connection to backend */ conn->close++; /* Return DONE to avoid error messages being added to the stream */ @@ -609,8 +604,8 @@ 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, - "Processing of request didn't terminate cleanly"); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "Processing of request didn't terminate cleanly"); /* We had a failure: Close connection to backend */ conn->close++; backend_failed = 1; @@ -624,10 +619,10 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r, conn->close++; } else { - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "got response from %pI (%s)", - conn->worker->cp->addr, - conn->worker->s->hostname); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "got response from %pI (%s)", + conn->worker->cp->addr, + conn->worker->s->hostname); if (conf->error_override && ap_is_HTTP_ERROR(r->status)) { /* clear r->status for override error, otherwise ErrorDocument @@ -643,10 +638,10 @@ 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, - "dialog to %pI (%s) failed", - conn->worker->cp->addr, - conn->worker->s->hostname); + ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, + "dialog to %pI (%s) failed", + conn->worker->cp->addr, + conn->worker->s->hostname); /* * If we already send data, signal a broken backend connection * upwards in the chain. @@ -726,12 +721,10 @@ 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, - "AJP: 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, - "AJP: serving URL %s", url); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "serving URL %s", url); /* create space for state information */ status = ap_proxy_acquire_connection(scheme, &backend, worker, @@ -761,9 +754,9 @@ 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, - "AJP: failed to make connection to backend: %s", - backend->hostname); + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, + "failed to make connection to backend: %s", + backend->hostname); status = HTTP_SERVICE_UNAVAILABLE; break; } @@ -780,10 +773,9 @@ 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, - "AJP: cping/cpong failed to %pI (%s)", - worker->cp->addr, - worker->s->hostname); + ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, + "cping/cpong failed to %pI (%s)", + worker->cp->addr, worker->s->hostname); status = HTTP_SERVICE_UNAVAILABLE; retry++; continue; diff --git a/modules/proxy/mod_proxy_express.c b/modules/proxy/mod_proxy_express.c index 7dbc50d1d0..2d874f9d0e 100644 --- a/modules/proxy/mod_proxy_express.c +++ b/modules/proxy/mod_proxy_express.c @@ -122,16 +122,15 @@ static int xlate_name(request_rec *r) return DECLINED; } - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy_express: Enabled"); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "proxy_express: Enabled"); if (!sconf->dbmfile || (r->filename && strncmp(r->filename, "proxy:", 6) == 0)) { /* it should be go on as an internal proxy request */ return DECLINED; } - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy_express: Opening DBM file: %s (%s)", - sconf->dbmfile, sconf->dbmtype); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "proxy_express: Opening DBM file: %s (%s)", + sconf->dbmfile, sconf->dbmtype); rv = apr_dbm_open_ex(&db, sconf->dbmtype, sconf->dbmfile, APR_DBM_READONLY, APR_OS_DEFAULT, r->pool); if (rv != APR_SUCCESS) { @@ -139,8 +138,8 @@ static int xlate_name(request_rec *r) } name = ap_get_server_name(r); - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy_express: looking for %s", name); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "proxy_express: looking for %s", name); key.dptr = (char *)name; key.dsize = strlen(key.dptr); @@ -155,14 +154,14 @@ static int xlate_name(request_rec *r) return DECLINED; } - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy_express: found %s -> %s", name, backend); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "proxy_express: found %s -> %s", name, backend); r->filename = apr_pstrcat(r->pool, "proxy:", backend, r->uri, NULL); r->handler = "proxy-server"; r->proxyreq = PROXYREQ_REVERSE; - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy_express: rewritten as: %s", r->filename); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "proxy_express: rewritten as: %s", r->filename); ralias = (struct proxy_alias *)dconf->raliases->elts; /* @@ -183,8 +182,8 @@ static int xlate_name(request_rec *r) /* Didn't find one... add it */ if (!ralias) { - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy_express: adding PPR entry"); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "proxy_express: adding PPR entry"); ralias = apr_array_push(dconf->raliases); ralias->fake = "/"; ralias->real = apr_pstrdup(dconf->raliases->pool, backend);