From: Mladen Turk Date: Tue, 24 Aug 2004 11:55:23 +0000 (+0000) Subject: Implement REQ_ATTRIBUTE using request rec environment table, X-Git-Tag: STRIKER_2_1_0_RC1~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=41b64427f707a0ea7e7551689db998068ade5163;p=thirdparty%2Fapache%2Fhttpd.git Implement REQ_ATTRIBUTE using request rec environment table, so we can use standard SetEnv directive for that. The ajp specific attributes has to be prefixed using 'AJP_', and are passed withouth that prefix to the backend. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@104788 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/proxy/ajp_header.c b/modules/proxy/ajp_header.c index 5b5b79392b0..5ff3dd50748 100644 --- a/modules/proxy/ajp_header.c +++ b/modules/proxy/ajp_header.c @@ -212,6 +212,8 @@ static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg, char *remote_host; char *uri; const char *session_route; + 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_DEBUG, 0, r->server, "Into ajp_marshal_into_msgb"); @@ -390,22 +392,22 @@ static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg, } } */ - - /* XXXX ignored for the moment - if (s->num_attributes > 0) { - for (i = 0 ; i < s->num_attributes ; i++) { - if (ajp_msg_append_uint8(msg, SC_A_REQ_ATTRIBUTE) || - ajp_msg_append_string(msg, s->attributes_names[i]) || - ajp_msg_append_string(msg, s->attributes_values[i])) { + /* Use the environment vars prefixed with AJP_ + * and pass it to the header striping that prefix. + */ + for (i = 0; i < (apr_uint32_t)arr->nelts; i++) { + if (!strncmp(elts[i].key, "AJP_", 4)) { + 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, - "Error ajp_marshal_into_msgb - " - "Error appending attribute %s=%s", - s->attributes_names[i], s->attributes_values[i]); + "Error ajp_marshal_into_msgb - " + "Error appending attribute %s=%s", + elts[i].key, elts[i].val); return APR_EGENERAL; } } } - */ if (ajp_msg_append_uint8(msg, SC_A_ARE_DONE)) { ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,