282 //----------------------------------------------------------------------------- |
284 //----------------------------------------------------------------------------- |
283 // cgi_common_vars |
285 // cgi_common_vars |
284 //----------------------------------------------------------------------------- |
286 //----------------------------------------------------------------------------- |
285 |
287 |
286 char** cgi_common_vars(Session *sn, Request *rq, char **env) |
288 char** cgi_common_vars(Session *sn, Request *rq, char **env) |
287 { |
289 { |
288 // TODO: enable code and add cgi_client_auth_vars() |
|
289 return env; |
|
290 #if 0 |
|
291 char *t; |
290 char *t; |
292 int x; |
291 int x; |
293 |
292 |
294 env = util_env_create(env, MAX_CGI_COMMON_VARS, &x); |
293 env = util_env_create(env, MAX_CGI_COMMON_VARS, &x); |
295 |
294 |
|
295 /* |
296 if (!_env_initialized) cgi_env_init(); |
296 if (!_env_initialized) cgi_env_init(); |
297 if (_env_path) env[x++] = util_env_str("PATH", _env_path); |
297 if (_env_path) env[x++] = util_env_str("PATH", _env_path); |
298 if (_env_tz) env[x++] = util_env_str("TZ", _env_tz); |
298 if (_env_tz) env[x++] = util_env_str("TZ", _env_tz); |
299 if (_env_lang) env[x++] = util_env_str("LANG", _env_lang); |
299 if (_env_lang) env[x++] = util_env_str("LANG", _env_lang); |
300 if (_env_ldpath) env[x++] = util_env_str(LIBRARY_PATH, _env_ldpath); |
300 if (_env_ldpath) env[x++] = util_env_str(LIBRARY_PATH, _env_ldpath); |
301 env[x++] = util_env_str("SERVER_SOFTWARE", PRODUCT_HEADER_ID"/"PRODUCT_VERSION_ID); |
301 env[x++] = util_env_str("SERVER_SOFTWARE", PRODUCT_HEADER_ID"/"PRODUCT_VERSION_ID); |
302 |
302 */ // TODO: enable |
303 NSString srvName, portStr; |
303 |
304 char buf1[256], buf2[64]; |
304 //NSString srvName, portStr; |
305 srvName.useStatic(buf1, sizeof(buf1), 0); |
305 //char buf1[256], buf2[64]; |
306 portStr.useStatic(buf2, sizeof(buf2), 0); |
306 //srvName.useStatic(buf1, sizeof(buf1), 0); |
307 GetServerHostnameAndPort(*rq, *sn, srvName, portStr); |
307 //portStr.useStatic(buf2, sizeof(buf2), 0); |
308 env[x++] = util_env_str("SERVER_PORT", (char*)(const char*)portStr); |
308 //GetServerHostnameAndPort(*rq, *sn, srvName, portStr); |
309 env[x++] = util_env_str("SERVER_NAME", (char*)(const char*)srvName); |
309 char *scheme; |
310 |
310 char *host; |
311 t = http_uri2url_dynamic("","",sn,rq); |
311 uint16_t port; |
312 env[x++] = util_env_str("SERVER_URL", t); |
312 http_get_scheme_host_port(sn, rq, &scheme, &host, &port); |
313 FREE(t); |
313 char portstr[8]; |
|
314 snprintf(portstr, 8, "%" PRIu16, (int)port); |
|
315 env[x++] = util_env_str("SERVER_PORT", host); |
|
316 env[x++] = util_env_str("SERVER_NAME", portstr); |
|
317 |
|
318 //t = http_uri2url_dynamic("","",sn,rq); |
|
319 //env[x++] = util_env_str("SERVER_URL", t); |
|
320 //FREE(t); |
314 |
321 |
315 char *ip; |
322 char *ip; |
316 ip = pblock_findval("ip", sn->client); |
323 ip = pblock_findval("ip", sn->client); |
317 t = session_dns(sn); |
324 t = session_dns(sn); |
318 env[x++] = util_env_str("REMOTE_HOST", (t ? t : ip)); |
325 env[x++] = util_env_str("REMOTE_HOST", (t ? t : ip)); |
340 if (t = pblock_findval("status", rq->orig_rq->srvhdrs)) { |
347 if (t = pblock_findval("status", rq->orig_rq->srvhdrs)) { |
341 env[x++] = util_env_str("REDIRECT_STATUS", t); |
348 env[x++] = util_env_str("REDIRECT_STATUS", t); |
342 } |
349 } |
343 } |
350 } |
344 |
351 |
|
352 #if 0 |
345 if (GetSecurity(sn)) { |
353 if (GetSecurity(sn)) { |
346 env[x++] = util_env_str("HTTPS", "ON"); |
354 env[x++] = util_env_str("HTTPS", "ON"); |
347 |
355 |
348 if (t = pblock_findval("keysize", sn->client)) |
356 if (t = pblock_findval("keysize", sn->client)) |
349 env[x++] = util_env_str("HTTPS_KEYSIZE", t); |
357 env[x++] = util_env_str("HTTPS_KEYSIZE", t); |