@@ -212,6 +212,11 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
212
212
return NULL ;
213
213
}
214
214
215
+ /* Should we send the entire path in the request line, default to no. */
216
+ if (context && (tmpzval = php_stream_context_get_option (context , "http" , "request_fulluri" )) != NULL ) {
217
+ request_fulluri = zend_is_true (tmpzval );
218
+ }
219
+
215
220
use_ssl = (ZSTR_LEN (resource -> scheme ) > 4 ) && ZSTR_VAL (resource -> scheme )[4 ] == 's' ;
216
221
/* choose default ports */
217
222
if (use_ssl && resource -> port == 0 )
@@ -230,6 +235,13 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
230
235
}
231
236
}
232
237
238
+ if (request_fulluri && (strchr (path , '\n' ) != NULL || strchr (path , '\r' ) != NULL )) {
239
+ php_stream_wrapper_log_error (wrapper , options , "HTTP wrapper full URI path does not allow CR or LF characters" );
240
+ php_url_free (resource );
241
+ zend_string_release (transport_string );
242
+ return NULL ;
243
+ }
244
+
233
245
if (context && (tmpzval = php_stream_context_get_option (context , wrapper -> wops -> label , "timeout" )) != NULL ) {
234
246
double d = zval_get_double (tmpzval );
235
247
#ifndef PHP_WIN32
@@ -376,12 +388,6 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
376
388
smart_str_appends (& req_buf , "GET " );
377
389
}
378
390
379
- /* Should we send the entire path in the request line, default to no. */
380
- if (!request_fulluri && context &&
381
- (tmpzval = php_stream_context_get_option (context , "http" , "request_fulluri" )) != NULL ) {
382
- request_fulluri = zend_is_true (tmpzval );
383
- }
384
-
385
391
if (request_fulluri ) {
386
392
/* Ask for everything */
387
393
smart_str_appends (& req_buf , path );
0 commit comments