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