From: Michael Wallner Date: Tue, 1 Oct 2013 09:11:48 +0000 (+0200) Subject: Merge branch 'PHP-5.5' X-Git-Tag: php-5.6.0alpha1~211^2~31^2~6^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d29a01de3f35a33c539a805e28a22a6514924a19;p=php Merge branch 'PHP-5.5' * PHP-5.5: Fixed bug #61548 Conflicts: ext/standard/http_fopen_wrapper.c --- d29a01de3f35a33c539a805e28a22a6514924a19 diff --cc ext/standard/http_fopen_wrapper.c index 8762fa4849,4605e7494f..f5184ceec6 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@@ -85,8 -84,31 +85,33 @@@ #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;