@@ -183,6 +183,11 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
183
183
return NULL ;
184
184
}
185
185
186
+ /* Should we send the entire path in the request line, default to no. */
187
+ if (context && (tmpzval = php_stream_context_get_option (context , "http" , "request_fulluri" )) != NULL ) {
188
+ request_fulluri = zend_is_true (tmpzval );
189
+ }
190
+
186
191
use_ssl = resource -> scheme && (ZSTR_LEN (resource -> scheme ) > 4 ) && ZSTR_VAL (resource -> scheme )[4 ] == 's' ;
187
192
/* choose default ports */
188
193
if (use_ssl && resource -> port == 0 )
@@ -201,6 +206,13 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
201
206
}
202
207
}
203
208
209
+ if (request_fulluri && (strchr (path , '\n' ) != NULL || strchr (path , '\r' ) != NULL )) {
210
+ php_stream_wrapper_log_error (wrapper , options , "HTTP wrapper full URI path does not allow CR or LF characters" );
211
+ php_url_free (resource );
212
+ zend_string_release (transport_string );
213
+ return NULL ;
214
+ }
215
+
204
216
if (context && (tmpzval = php_stream_context_get_option (context , wrapper -> wops -> label , "timeout" )) != NULL ) {
205
217
double d = zval_get_double (tmpzval );
206
218
#ifndef PHP_WIN32
@@ -381,12 +393,6 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
381
393
smart_str_appends (& req_buf , "GET " );
382
394
}
383
395
384
- /* Should we send the entire path in the request line, default to no. */
385
- if (!request_fulluri && context &&
386
- (tmpzval = php_stream_context_get_option (context , "http" , "request_fulluri" )) != NULL ) {
387
- request_fulluri = zend_is_true (tmpzval );
388
- }
389
-
390
396
if (request_fulluri ) {
391
397
/* Ask for everything */
392
398
smart_str_appends (& req_buf , path );
0 commit comments