MCPcopy Create free account
hub / github.com/apache/httpd / ajp_marshal_into_msgb

Function ajp_marshal_into_msgb

modules/proxy/ajp_header.c:217–507  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215 */
216
217static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg,
218 request_rec *r,
219 apr_uri_t *uri,
220 const char *secret)
221{
222 int method;
223 apr_uint32_t i, num_headers = 0;
224 apr_byte_t is_ssl;
225 char *remote_host;
226 const char *session_route, *envvar;
227 const apr_array_header_t *arr = apr_table_elts(r->subprocess_env);
228 const apr_table_entry_t *elts = (const apr_table_entry_t *)arr->elts;
229
230 ap_log_rerror(APLOG_MARK, APLOG_TRACE8, 0, r, "Into ajp_marshal_into_msgb");
231
232 if ((method = sc_for_req_method_by_id(r)) == UNKNOWN_METHOD) {
233 ap_log_rerror(APLOG_MARK, APLOG_TRACE8, 0, r,
234 "ajp_marshal_into_msgb - Sending unknown method %s as request attribute",
235 r->method);
236 method = SC_M_JK_STORED;
237 }
238
239 is_ssl = (apr_byte_t) ap_proxy_conn_is_https(r->connection);
240
241 if (r->headers_in && apr_table_elts(r->headers_in)) {
242 const apr_array_header_t *t = apr_table_elts(r->headers_in);
243 num_headers = t->nelts;
244 }
245
246 remote_host = (char *)ap_get_useragent_host(r, REMOTE_HOST, NULL);
247
248 ajp_msg_reset(msg);
249
250 if (ajp_msg_append_uint8(msg, CMD_AJP13_FORWARD_REQUEST) ||
251 ajp_msg_append_uint8(msg, (apr_byte_t) method) ||
252 ajp_msg_append_string(msg, r->protocol) ||
253 ajp_msg_append_string(msg, uri->path) ||
254 ajp_msg_append_string(msg, r->useragent_ip) ||
255 ajp_msg_append_string(msg, remote_host) ||
256 ajp_msg_append_string(msg, ap_get_server_name(r)) ||
257 ajp_msg_append_uint16(msg, (apr_uint16_t)r->connection->local_addr->port) ||
258 ajp_msg_append_uint8(msg, is_ssl) ||
259 ajp_msg_append_uint16(msg, (apr_uint16_t) num_headers)) {
260
261 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00968)
262 "ajp_marshal_into_msgb: "
263 "Error appending the message beginning");
264 return APR_EGENERAL;
265 }
266
267 for (i = 0 ; i < num_headers ; i++) {
268 int sc;
269 const apr_array_header_t *t = apr_table_elts(r->headers_in);
270 const apr_table_entry_t *elts = (apr_table_entry_t *)t->elts;
271
272 if ((sc = sc_for_req_header(elts[i].key)) != UNKNOWN_METHOD) {
273 if (ajp_msg_append_uint16(msg, (apr_uint16_t)sc)) {
274 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00969)

Callers 1

ajp_send_headerFunction · 0.85

Calls 9

sc_for_req_method_by_idFunction · 0.85
ap_proxy_conn_is_httpsFunction · 0.85
ap_get_useragent_hostFunction · 0.85
ajp_msg_resetFunction · 0.85
ajp_msg_append_uint8Function · 0.85
ap_get_server_nameFunction · 0.85
ajp_msg_append_uint16Function · 0.85
sc_for_req_headerFunction · 0.85
ap_proxy_ssl_valFunction · 0.85

Tested by

no test coverage detected