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

Function http2env

server/util_script.c:56–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54#define APLOG_MODULE_INDEX AP_CORE_MODULE_INDEX
55
56static char *http2env(request_rec *r, const char *w)
57{
58 char *res = (char *)apr_palloc(r->pool, sizeof("HTTP_") + strlen(w));
59 char *cp = res;
60 char c;
61
62 *cp++ = 'H';
63 *cp++ = 'T';
64 *cp++ = 'T';
65 *cp++ = 'P';
66 *cp++ = '_';
67
68 while ((c = *w++) != 0) {
69 if (apr_isalnum(c)) {
70 *cp++ = apr_toupper(c);
71 }
72 else if (c == '-') {
73 *cp++ = '_';
74 }
75 else {
76 if (APLOGrtrace1(r))
77 ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r,
78 "Not exporting header with invalid name as envvar: %s",
79 ap_escape_logitem(r->pool, w));
80 return NULL;
81 }
82 }
83 *cp = 0;
84
85 return res;
86}
87
88static void add_unless_null(apr_table_t *table, const char *name, const char *val)
89{

Callers 1

ifFunction · 0.85

Calls 1

ap_escape_logitemFunction · 0.85

Tested by

no test coverage detected