From: Sascha Schumann Date: Wed, 15 Jan 2003 11:28:25 +0000 (+0000) Subject: MFH 1.161 X-Git-Tag: PHP_4_3_before_13561_fix~70 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9c9d4b217788f9d6091219fedf82b9ca94e8c831;p=php MFH 1.161 --- diff --git a/main/SAPI.c b/main/SAPI.c index f1c3ea581a..a11f98c953 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -278,10 +278,42 @@ SAPI_API size_t sapi_apply_default_charset(char **mimetype, size_t len TSRMLS_DC return 0; } +SAPI_API void sapi_activate_headers_only(TSRMLS_D) +{ + if (SG(request_info).headers_read == 1) + return; + SG(request_info).headers_read = 1; + zend_llist_init(&SG(sapi_headers).headers, sizeof(sapi_header_struct), + (void (*)(void *)) sapi_free_header, 0); + SG(sapi_headers).send_default_content_type = 1; + + /* SG(sapi_headers).http_response_code = 200; */ + SG(sapi_headers).http_status_line = NULL; + SG(request_info).current_user = NULL; + SG(request_info).current_user_length = 0; + SG(request_info).no_headers = 0; + + /* + * It's possible to override this general case in the activate() callback, + * if necessary. + */ + if (SG(request_info).request_method && !strcmp(SG(request_info).request_method, "HEAD")) { + SG(request_info).headers_only = 1; + } else { + SG(request_info).headers_only = 0; + } + if (SG(server_context)) { + SG(request_info).cookie_data = sapi_module.read_cookies(TSRMLS_C); + if (sapi_module.activate) { + sapi_module.activate(TSRMLS_C); + } + } +} /* * Called from php_request_startup() for every request. */ + SAPI_API void sapi_activate(TSRMLS_D) { zend_llist_init(&SG(sapi_headers).headers, sizeof(sapi_header_struct), (void (*)(void *)) sapi_free_header, 0); @@ -391,6 +423,9 @@ SAPI_API void sapi_deactivate(TSRMLS_D) SG(sapi_headers).mimetype = NULL; } sapi_send_headers_free(TSRMLS_C); + SG(sapi_started) = 0; + SG(headers_sent) = 0; + SG(request_info).headers_read = 0; } @@ -816,6 +851,24 @@ SAPI_API char *sapi_getenv(char *name, size_t name_len TSRMLS_DC) } } +SAPI_API int sapi_get_fd(int *fd TSRMLS_DC) +{ + if (sapi_module.get_fd) { + return sapi_module.get_fd(fd TSRMLS_CC); + } else { + return -1; + } +} + +SAPI_API int sapi_force_http_10(TSRMLS_D) +{ + if (sapi_module.force_http_10) { + return sapi_module.force_http_10(TSRMLS_C); + } else { + return -1; + } +} + /* * Local variables: * tab-width: 4