version 1.1.1.2, 2012/05/29 12:34:35
|
version 1.1.1.3, 2013/07/22 01:32:11
|
Line 2
|
Line 2
|
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| PHP Version 5 | |
| PHP Version 5 | |
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| Copyright (c) 1997-2012 The PHP Group | | | Copyright (c) 1997-2013 The PHP Group | |
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| This source file is subject to version 3.01 of the PHP license, | |
| This source file is subject to version 3.01 of the PHP license, | |
| that is bundled with this package in the file LICENSE, and is | |
| that is bundled with this package in the file LICENSE, and is | |
Line 587 static void sapi_update_response_code(int ncode TSRMLS
|
Line 587 static void sapi_update_response_code(int ncode TSRMLS
|
SG(sapi_headers).http_response_code = ncode; |
SG(sapi_headers).http_response_code = ncode; |
} |
} |
|
|
static int sapi_find_matching_header(void *element1, void *element2) | /* |
{ | * since zend_llist_del_element only remove one matched item once, |
int len = strlen((char*)element2); | * we should remove them by ourself |
return strncasecmp(((sapi_header_struct*)element1)->header, (char*)element2, len) == 0 && ((sapi_header_struct*)element1)->header[len] == ':'; | */ |
| static void sapi_remove_header(zend_llist *l, char *name, uint len) { |
| sapi_header_struct *header; |
| zend_llist_element *next; |
| zend_llist_element *current=l->head; |
| |
| while (current) { |
| header = (sapi_header_struct *)(current->data); |
| next = current->next; |
| if (header->header_len > len && header->header[len] == ':' |
| && !strncasecmp(header->header, name, len)) { |
| if (current->prev) { |
| current->prev->next = next; |
| } else { |
| l->head = next; |
| } |
| if (next) { |
| next->prev = current->prev; |
| } else { |
| l->tail = current->prev; |
| } |
| sapi_free_header(header); |
| efree(current); |
| --l->count; |
| } |
| current = next; |
| } |
} |
} |
|
|
SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bool duplicate, zend_bool replace TSRMLS_DC) |
SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bool duplicate, zend_bool replace TSRMLS_DC) |
Line 621 static void sapi_header_add_op(sapi_header_op_enum op,
|
Line 647 static void sapi_header_add_op(sapi_header_op_enum op,
|
char sav = *colon_offset; |
char sav = *colon_offset; |
|
|
*colon_offset = 0; |
*colon_offset = 0; |
zend_llist_del_element(&SG(sapi_headers).headers, sapi_header->header, (int(*)(void*, void*))sapi_find_matching_header); | sapi_remove_header(&SG(sapi_headers).headers, sapi_header->header, strlen(sapi_header->header)); |
*colon_offset = sav; |
*colon_offset = sav; |
} |
} |
} |
} |
Line 703 SAPI_API int sapi_header_op(sapi_header_op_enum op, vo
|
Line 729 SAPI_API int sapi_header_op(sapi_header_op_enum op, vo
|
sapi_header.header_len = header_line_len; |
sapi_header.header_len = header_line_len; |
sapi_module.header_handler(&sapi_header, op, &SG(sapi_headers) TSRMLS_CC); |
sapi_module.header_handler(&sapi_header, op, &SG(sapi_headers) TSRMLS_CC); |
} |
} |
zend_llist_del_element(&SG(sapi_headers).headers, header_line, (int(*)(void*, void*))sapi_find_matching_header); | sapi_remove_header(&SG(sapi_headers).headers, header_line, header_line_len); |
efree(header_line); |
efree(header_line); |
return SUCCESS; |
return SUCCESS; |
} else { |
} else { |
Line 990 SAPI_API char *sapi_getenv(char *name, size_t name_len
|
Line 1016 SAPI_API char *sapi_getenv(char *name, size_t name_len
|
} else { |
} else { |
return NULL; |
return NULL; |
} |
} |
sapi_module.input_filter(PARSE_ENV, name, &value, strlen(value), NULL TSRMLS_CC); | if (sapi_module.input_filter) { |
| sapi_module.input_filter(PARSE_STRING, name, &value, strlen(value), NULL TSRMLS_CC); |
| } |
return value; |
return value; |
} |
} |
return NULL; |
return NULL; |