curl / Mailing Lists / curl-library / Single Mail

curl-library

Any way to make file:// urls use a relative path?

From: Tetetest <tetetest_at_rambler.ru>
Date: Sun, 18 Mar 2018 21:27:22 +0300

Hello,

In libcurl 7.48.0, I could read a file from current working
directory by using "file://filename.ext" URL. After upgrading to 7.59.0,
this is no longer possible:

file://filename.ext gets error: "Invalid file://hostname/, expected localhost or
127.0.0.1 or none".

Is there any way at all to use relative paths with file://?

Here are variants I tried:

file:///filename.ext - Couldn't open file /filename.ext
file://./filename.ext - "Invalid file://hostname/, expected localhost or
127.0.0.1 or none".
file:filename.ext - Couldn't open file /filename.ext. Ironically,
effective URL reported by libCurl is "file:/filename.ext" (notice the
slash).
file:/filename.ext - Couldn't open file /filename.ext. Effective URL
is "file:/filename.ext" as expected.
file://localhost/filename.ext - Couldn't open file /filename.ext.
file://localhost//filename.ext - Couldn't open file /filename.ext
(effective URL = file://localhost//filename.ext).
file://localhost/./filename.ext - Couldn't open file /filename.ext
(effective URL = file:///filename.ext)

On windows, using drive letters does not help:
file:c:filename.ext - Couldn't open file /c:filename.ext (effective
URL = file:/c:filename.ext)
file:/c:filename.ext - Couldn't open file /c:filename.ext (effective
URL = file:/c:filename.ext)
file://c:filename.ext - Invalid file://hostname/, expected localhost
or 127.0.0.1 or none (effective URL = file://c:filename.ext)
file:///c:filename.ext - Couldn't open file /c:filename.ext (effective
URL = file:///c:filename.ext)
file:c:/filename.ext - Couldn't open file /c:/filename.ext (effective
URL = file:/c:/filename.ext), and so on.

-- 
Best regards,
 Tetetest                          mailto:tetetest_at_rambler.ru
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2018-03-18