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