]> granicus.if.org Git - php/commitdiff
Add sapi_add_header_ex, which lets you specify whether you want
authorSascha Schumann <sas@php.net>
Thu, 26 Oct 2000 18:18:21 +0000 (18:18 +0000)
committerSascha Schumann <sas@php.net>
Thu, 26 Oct 2000 18:18:21 +0000 (18:18 +0000)
to add or replace a header.

main/SAPI.c
main/SAPI.h

index afe98f35c7f43d6d9f962c09b38012aef3e90b45..563f1cd072b0e9c9786e4017cb3e4a75d9e28e05 100644 (file)
@@ -356,7 +356,7 @@ static int sapi_extract_response_code(const char *header_line)
 /* This function expects a *duplicated* string, that was previously emalloc()'d.
  * Pointers sent to this functions will be automatically freed by the framework.
  */
-SAPI_API int sapi_add_header(char *header_line, uint header_line_len, zend_bool duplicate)
+SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bool duplicate, zend_bool replace)
 {
        int retval, free_header = 0;
        sapi_header_struct sapi_header;
@@ -390,6 +390,7 @@ SAPI_API int sapi_add_header(char *header_line, uint header_line_len, zend_bool
 
        sapi_header.header = header_line;
        sapi_header.header_len = header_line_len;
+       sapi_header.replace = replace;
 
        /* Check the header for a few cases that we have special support for in SAPI */
        if (header_line_len>=5 
index 918912b717070d2a598d5cbe2fb9b5bd5e607759..e551a32165f5fd40c588ef0d37c0942e4ecb7f08 100644 (file)
@@ -41,6 +41,7 @@
 typedef struct {
        char *header;
        uint header_len;
+       zend_bool replace;
 } sapi_header_struct;
 
 
@@ -130,7 +131,9 @@ SAPI_API void sapi_activate(SLS_D);
 SAPI_API void sapi_deactivate(SLS_D);
 SAPI_API void sapi_initialize_empty_request(SLS_D);
 
-SAPI_API int sapi_add_header(char *header_line, uint header_line_len, zend_bool duplicate);
+SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bool duplicate, zend_bool replace);
+#define sapi_add_header(header_line, header_line_len, duplicate) \
+       sapi_add_header_ex((header_line), (header_line_len), (duplicate), 1)
 SAPI_API int sapi_send_headers(void);
 SAPI_API void sapi_free_header(sapi_header_struct *sapi_header);
 SAPI_API void sapi_handle_post(void *arg SLS_DC);