|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-07-25 05:48 UTC] mattias at sudac dot org
[2003-07-25 06:16 UTC] magnus@php.net
[2011-01-01 21:06 UTC] jani@php.net
-Package: Feature/Change Request
+Package: Other web server
[2017-01-08 06:23 UTC] krakjoe@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: krakjoe
[2017-01-08 06:23 UTC] krakjoe@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 19:00:01 2025 UTC |
Description: ------------ Hello I think this is a better-then-nothing implementation of getenv for the thttpd SAPI. The patch should proabably work with both rev 1.77.2.13.2.2 and 1.91 of thttpd.c --- thttpd.c.orig 2003-07-25 10:56:54.000000000 +0200 +++ thttpd.c 2003-07-25 11:02:00.000000000 +0200 @@ -368,6 +368,20 @@ return SUCCESS; } +/* This implementation will return values of environment variables matched in the + * $_SERVER array, if not return NULL and it will fallback to normal libc getenv. + * By doing this getenv("REMOTE_ADDR") and others will work fine. + */ +static char *sapi_thttpd_getenv(char *name, size_t name_len TSRMLS_DC) +{ + zval **val = NULL; + + if(zend_hash_find(HASH_OF(PG(http_globals)[TRACK_VARS_SERVER]),name,name_len+1,(void**)&v + return Z_STRVAL_PP(val); + else + return NULL; +} + static sapi_module_struct thttpd_sapi_module = { "thttpd", "thttpd", @@ -381,7 +395,7 @@ sapi_thttpd_ub_write, NULL, NULL, /* get uid */ - NULL, /* getenv */ + sapi_thttpd_getenv, /* getenv */ php_error,