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

Function send_environment

modules/aaa/mod_authnz_fcgi.c:291–389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

289}
290
291static apr_status_t send_environment(apr_socket_t *s,
292 const fcgi_provider_conf *conf,
293 request_rec *r, apr_uint16_t request_id,
294 apr_pool_t *temp_pool)
295{
296 const char *fn = "send_environment";
297 const apr_array_header_t *envarr;
298 const apr_table_entry_t *elts;
299 struct iovec vec[2];
300 ap_fcgi_header header;
301 unsigned char farray[AP_FCGI_HEADER_LEN];
302 char *body;
303 apr_status_t rv;
304 apr_size_t avail_len, len, required_len;
305 int i, next_elem, starting_elem;
306
307 envarr = apr_table_elts(r->subprocess_env);
308 elts = (const apr_table_entry_t *) envarr->elts;
309
310 if (APLOG_R_IS_LEVEL(r, APLOG_TRACE2)) {
311
312 for (i = 0; i < envarr->nelts; ++i) {
313 if (!elts[i].key) {
314 continue;
315 }
316 ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r,
317 "%s: '%s': '%s'",
318 fn, elts[i].key,
319 !strcmp(elts[i].key, "REMOTE_PASSWD") ?
320 "XXXXXXXX" : elts[i].val);
321 }
322 }
323
324 /* Send envvars over in as many FastCGI records as it takes, */
325 next_elem = 0; /* starting with the first one */
326
327 avail_len = 16 * 1024; /* our limit per record, which could have been up
328 * to AP_FCGI_MAX_CONTENT_LEN
329 */
330
331 while (next_elem < envarr->nelts) {
332 starting_elem = next_elem;
333 required_len = ap_fcgi_encoded_env_len(r->subprocess_env,
334 avail_len,
335 &next_elem);
336
337 if (!required_len) {
338 if (next_elem < envarr->nelts) {
339 ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
340 APLOGNO(02499) "couldn't encode envvar '%s' in %"
341 APR_SIZE_T_FMT " bytes",
342 elts[next_elem].key, avail_len);
343 /* skip this envvar and continue */
344 ++next_elem;
345 continue;
346 }
347 /* only an unused element at the end of the array */
348 break;

Callers 1

req_rspFunction · 0.70

Calls 5

ap_fcgi_encoded_env_lenFunction · 0.85
ap_fcgi_encode_envFunction · 0.85
ap_fcgi_fill_in_headerFunction · 0.85
ap_fcgi_header_to_arrayFunction · 0.85
sendv_dataFunction · 0.85

Tested by

no test coverage detected