diff options
author | Zeev Suraski <zeev@php.net> | 2001-07-28 11:36:37 +0000 |
---|---|---|
committer | Zeev Suraski <zeev@php.net> | 2001-07-28 11:36:37 +0000 |
commit | d87cc976e1156b839fc6d4aa6b473a126802b8e3 (patch) | |
tree | 8acb068dd7458e1c8df3a7d8ecb87d065990fdb1 /sapi/phttpd/phttpd.c | |
parent | b4f3b9d3ce9f55cf040fb5aa8f201c64646cab43 (diff) | |
download | php-git-d87cc976e1156b839fc6d4aa6b473a126802b8e3.tar.gz |
Redesigned thread safety mechanism - nua nua
Diffstat (limited to 'sapi/phttpd/phttpd.c')
-rw-r--r-- | sapi/phttpd/phttpd.c | 51 |
1 files changed, 22 insertions, 29 deletions
diff --git a/sapi/phttpd/phttpd.c b/sapi/phttpd/phttpd.c index 7ea34fc795..a7fbebcde1 100644 --- a/sapi/phttpd/phttpd.c +++ b/sapi/phttpd/phttpd.c @@ -38,12 +38,7 @@ typedef struct { static int ph_globals_id; -#define PHLS_D phttpd_globals_struct *ph_context -#define PHLS_DC , PHLS_D -#define PHLS_C ph_context -#define PHLS_CC , PHLS_C -#define PHG(v) (ph_context->v) -#define PHLS_FETCH() phttpd_globals_struct *ph_context = ts_resource(ph_globals_id) +#define PHG(v) TSRMG(ph_globals_id, phttpd_globals_struct *, v) static int php_phttpd_startup(sapi_module_struct *sapi_module) @@ -65,7 +60,7 @@ static int php_phttpd_sapi_ub_write(const char *str, uint str_length) { int sent_bytes; - PHLS_FETCH(); + TSRMLS_FETCH(); sent_bytes = fd_write(PHG(cip)->fd,str,str_length); @@ -77,11 +72,11 @@ php_phttpd_sapi_ub_write(const char *str, uint str_length) } static int -php_phttpd_sapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers SLS_DC) +php_phttpd_sapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC) { char *header_name, *header_content; char *p; - PHLS_FETCH(); + TSRMLS_FETCH(); http_sendheaders(PHG(cip)->fd,PHG(cip), SG(sapi_headers).http_response_code, NULL); @@ -105,9 +100,9 @@ php_phttpd_sapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_str } static int -php_phttpd_sapi_send_headers(sapi_headers_struct *sapi_headers SLS_DC) +php_phttpd_sapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) { - PHLS_FETCH(); + TSRMLS_FETCH(); if (SG(sapi_headers).send_default_content_type) { fd_printf(PHG(cip)->fd,"Content-Type: text/html\n"); @@ -119,13 +114,13 @@ php_phttpd_sapi_send_headers(sapi_headers_struct *sapi_headers SLS_DC) } static char * -php_phttpd_sapi_read_cookies(SLS_D) +php_phttpd_sapi_read_cookies(TSRMLS_D) { /* int i; char *http_cookie = NULL; - NSLS_FETCH(); + NTSRMLS_FETCH(); i = Ns_SetIFind(NSG(conn->headers), "cookie"); if(i != -1) { @@ -140,12 +135,12 @@ php_phttpd_sapi_read_cookies(SLS_D) } static int -php_phttpd_sapi_read_post(char *buf, uint count_bytes SLS_DC) +php_phttpd_sapi_read_post(char *buf, uint count_bytes TSRMLS_DC) { /* uint max_read; uint total_read = 0; - NSLS_FETCH(); + NTSRMLS_FETCH(); max_read = MIN(NSG(data_avail), count_bytes); @@ -197,7 +192,7 @@ static sapi_module_struct phttpd_sapi_module = { }; static void -php_phttpd_request_ctor(PHLS_D SLS_DC) +php_phttpd_request_ctor(TSRMLS_D TSRMLS_DC) { memset(&SG(request_info),0,sizeof(sapi_globals_struct)); /* pfusch! */ @@ -248,23 +243,21 @@ php_phttpd_request_ctor(PHLS_D SLS_DC) } static void -php_phttpd_request_dtor(PHLS_D SLS_DC) +php_phttpd_request_dtor(TSRMLS_D TSRMLS_DC) { free(SG(request_info).path_translated); } -int php_doit(PHLS_D SLS_DC) +int php_doit(TSRMLS_D TSRMLS_DC) { struct stat sb; zend_file_handle file_handle; struct httpinfo *hip = PHG(cip)->hip; - - CLS_FETCH(); TSRMLS_FETCH(); - PLS_FETCH(); + TSRMLS_FETCH(); - if (php_request_startup(CLS_C TSRMLS_CC PLS_CC SLS_CC) == FAILURE) { + if (php_request_startup(TSRMLS_C) == FAILURE) { return -1; } @@ -273,9 +266,9 @@ int php_doit(PHLS_D SLS_DC) file_handle.free_filename = 0; /* - php_phttpd_hash_environment(PHLS_C CLS_CC TSRMLS_CC PLS_CC SLS_CC); + php_phttpd_hash_environment(TSRMLS_C); */ - php_execute_script(&file_handle CLS_CC TSRMLS_CC PLS_CC); + php_execute_script(&file_handle TSRMLS_CC); php_request_shutdown(NULL); return SG(sapi_headers).http_response_code; @@ -301,17 +294,17 @@ int pm_request(struct connectioninfo *cip) { struct httpinfo *hip = cip->hip; int status; - PHLS_FETCH(); - SLS_FETCH(); + TSRMLS_FETCH(); + TSRMLS_FETCH(); if (strcasecmp(hip->method, "GET") == 0 || strcasecmp(hip->method, "HEAD") == 0 || strcasecmp(hip->method, "POST") == 0) { PHG(cip) = cip; - php_phttpd_request_ctor(PHLS_C SLS_CC); - status = php_doit(PHLS_C SLS_CC); - php_phttpd_request_dtor(PHLS_C SLS_CC); + php_phttpd_request_ctor(TSRMLS_C); + status = php_doit(TSRMLS_C); + php_phttpd_request_dtor(TSRMLS_C); return status; } else { |