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