mirror of
https://github.com/curl/curl.git
synced 2026-08-25 01:03:31 +03:00
parent
e2ca8408c4
commit
f1959ae962
3 changed files with 16 additions and 2 deletions
|
|
@ -876,13 +876,19 @@ UNITTEST CURLUcode parse_file(const char *url, size_t urllen, CURLU *u,
|
|||
path = &url[5];
|
||||
pathlen = urllen - 5;
|
||||
|
||||
/* RFC 8089: file-hier-part = ( "//" auth-path ) / local-path, where
|
||||
local-path also starts with a "/". So reject anything that doesn't
|
||||
start with at least one "/" */
|
||||
if(path[0] != '/')
|
||||
return CURLUE_BAD_FILE_URL;
|
||||
|
||||
/* Extra handling URLs with an authority component (i.e. that start with
|
||||
* "file://")
|
||||
*
|
||||
* We allow omitted hostname (e.g. file:/<path>) -- valid according to
|
||||
* RFC 8089, but not the (current) WHAT-WG URL spec.
|
||||
*/
|
||||
if(path[0] == '/' && path[1] == '/') {
|
||||
if(path[1] == '/') {
|
||||
/* swallow the two slashes */
|
||||
const char *ptr = &path[2];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue