diff options
Diffstat (limited to 'main/SAPI.c')
-rw-r--r-- | main/SAPI.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/main/SAPI.c b/main/SAPI.c index b05b14be5e..d3e855b771 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -1,4 +1,4 @@ -/* +/* +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ @@ -136,7 +136,7 @@ PHP_FUNCTION(header_register_callback) if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &callback_func) == FAILURE) { return; } - + if (!zend_is_callable(callback_func, 0, NULL)) { RETURN_FALSE; } @@ -158,10 +158,10 @@ static void sapi_run_header_callback(void) zend_fcall_info fci; char *callback_error = NULL; zval retval; - + if (zend_fcall_info_init(&SG(callback_func), 0, &fci, &SG(fci_cache), NULL, &callback_error) == SUCCESS) { fci.retval = &retval; - + error = zend_call_function(&fci, &SG(fci_cache)); if (error == FAILURE) { goto callback_failed; @@ -172,10 +172,10 @@ static void sapi_run_header_callback(void) callback_failed: php_error_docref(NULL, E_WARNING, "Could not call the sapi_header_callback"); } - + if (callback_error) { efree(callback_error); - } + } } SAPI_API void sapi_handle_post(void *arg) @@ -401,11 +401,11 @@ SAPI_API void sapi_activate_headers_only(void) 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), + 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_response_code = 200; */ SG(sapi_headers).http_status_line = NULL; SG(sapi_headers).mimetype = NULL; SG(read_post_bytes) = 0; @@ -417,7 +417,7 @@ SAPI_API void sapi_activate_headers_only(void) SG(global_request_time) = 0; /* - * It's possible to override this general case in the activate() callback, + * 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")) { @@ -503,7 +503,7 @@ static void sapi_send_headers_free(void) SG(sapi_headers).http_status_line = NULL; } } - + SAPI_API void sapi_deactivate(void) { zend_llist_destroy(&SG(sapi_headers).headers); @@ -575,7 +575,7 @@ static int sapi_extract_response_code(const char *header_line) break; } } - + return code; } @@ -595,7 +595,7 @@ static void sapi_update_response_code(int ncode) SG(sapi_headers).http_response_code = ncode; } -/* +/* * since zend_llist_del_element only remove one matched item once, * we should remove them by ourself */ @@ -631,7 +631,7 @@ SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bo { sapi_header_line ctr = {0}; int r; - + ctr.line = header_line; ctr.line_len = header_line_len; @@ -725,7 +725,7 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg) } while(header_line_len && isspace(header_line[header_line_len-1])); header_line[header_line_len]='\0'; } - + if (op == SAPI_HEADER_DELETE) { if (strchr(header_line, ':')) { efree(header_line); @@ -768,7 +768,7 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg) sapi_header.header_len = header_line_len; /* Check the header for a few cases that we have special support for in SAPI */ - if (header_line_len>=5 + if (header_line_len>=5 && !strncasecmp(header_line, "HTTP/", 5)) { /* filter out the response code */ sapi_update_response_code(sapi_extract_response_code(header_line)); @@ -831,8 +831,8 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg) /* Return a Found Redirect if one is not already specified */ if (http_response_code) { /* user specified redirect code */ sapi_update_response_code(http_response_code); - } else if (SG(request_info).proto_num > 1000 && - SG(request_info).request_method && + } else if (SG(request_info).proto_num > 1000 && + SG(request_info).request_method && strcmp(SG(request_info).request_method, "HEAD") && strcmp(SG(request_info).request_method, "GET")) { sapi_update_response_code(303); @@ -1021,7 +1021,7 @@ SAPI_API zend_stat_t *sapi_get_stat(void) SAPI_API char *sapi_getenv(char *name, size_t name_len) { - if (sapi_module.getenv) { + if (sapi_module.getenv) { char *value, *tmp = sapi_module.getenv(name, name_len); if (tmp) { value = estrdup(tmp); |