]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-5.5'
authorMichael Wallner <mike@php.net>
Tue, 1 Oct 2013 09:11:48 +0000 (11:11 +0200)
committerMichael Wallner <mike@php.net>
Tue, 1 Oct 2013 09:11:48 +0000 (11:11 +0200)
* PHP-5.5:
  Fixed bug #61548

Conflicts:
ext/standard/http_fopen_wrapper.c

1  2 
ext/standard/http_fopen_wrapper.c

index 8762fa4849db1f61736567432d5dd80909808f65,4605e7494fa3de7673f40c0aabd4c8d644f49b79..f5184ceec601907cc5aa040361c1795f8c96b796
  #define HTTP_WRAPPER_HEADER_INIT    1
  #define HTTP_WRAPPER_REDIRECTED     2
  
- php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, const char *path, const char *mode, int options,
-                                                                               char **opened_path, php_stream_context *context, int redirect_max, int flags STREAMS_DC TSRMLS_DC) /* {{{ */
+ static inline void strip_header(char *header_bag, char *lc_header_bag,
+               const char *lc_header_name)
+ {
+       char *lc_header_start = strstr(lc_header_bag, lc_header_name);
+       char *header_start = header_bag + (lc_header_start - lc_header_bag);
+       if (lc_header_start
+       && (lc_header_start == lc_header_bag || *(lc_header_start-1) == '\n')
+       ) {
+               char *lc_eol = strchr(lc_header_start, '\n');
+               char *eol = header_start + (lc_eol - lc_header_start);
+               if (lc_eol) {
+                       size_t eollen = strlen(lc_eol);
+                       memmove(lc_header_start, lc_eol+1, eollen);
+                       memmove(header_start, eol+1, eollen);
+               } else {
+                       *lc_header_start = '\0';
+                       *header_start = '\0';
+               }
+       }
+ }
 -php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context, int redirect_max, int flags STREAMS_DC TSRMLS_DC) /* {{{ */
++php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, 
++              const char *path, const char *mode, int options, char **opened_path, 
++              php_stream_context *context, int redirect_max, int flags STREAMS_DC TSRMLS_DC) /* {{{ */
  {
        php_stream *stream = NULL;
        php_url *resource = NULL;