avformat/http: make sure URL path contains a slash
It is explicitly required by the HTTP RFC. Without this patch URLs like http://example.com?query will not work. Fixes ticket #8466. Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
		
							parent
							
								
									987ce96d41
								
							
						
					
					
						commit
						a3d8875df1
					
				| @ -193,7 +193,7 @@ static int http_open_cnx_internal(URLContext *h, AVDictionary **options) | |||||||
|     char *hashmark; |     char *hashmark; | ||||||
|     char hostname[1024], hoststr[1024], proto[10]; |     char hostname[1024], hoststr[1024], proto[10]; | ||||||
|     char auth[1024], proxyauth[1024] = ""; |     char auth[1024], proxyauth[1024] = ""; | ||||||
|     char path1[MAX_URL_SIZE]; |     char path1[MAX_URL_SIZE], sanitized_path[MAX_URL_SIZE]; | ||||||
|     char buf[1024], urlbuf[MAX_URL_SIZE]; |     char buf[1024], urlbuf[MAX_URL_SIZE]; | ||||||
|     int port, use_proxy, err, location_changed = 0; |     int port, use_proxy, err, location_changed = 0; | ||||||
|     HTTPContext *s = h->priv_data; |     HTTPContext *s = h->priv_data; | ||||||
| @ -220,10 +220,14 @@ static int http_open_cnx_internal(URLContext *h, AVDictionary **options) | |||||||
|     if (hashmark) |     if (hashmark) | ||||||
|         *hashmark = '\0'; |         *hashmark = '\0'; | ||||||
| 
 | 
 | ||||||
|     if (path1[0] == '\0') |     if (path1[0] == '\0') { | ||||||
|         path = "/"; |         path = "/"; | ||||||
|     else |     } else if (path1[0] == '?') { | ||||||
|  |         snprintf(sanitized_path, sizeof(sanitized_path), "/%s", path1); | ||||||
|  |         path = sanitized_path; | ||||||
|  |     } else { | ||||||
|         path = path1; |         path = path1; | ||||||
|  |     } | ||||||
|     local_path = path; |     local_path = path; | ||||||
|     if (use_proxy) { |     if (use_proxy) { | ||||||
|         /* Reassemble the request URL without auth string - we don't
 |         /* Reassemble the request URL without auth string - we don't
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user