[Issue 21064] New: setCookieJar/caInfo in std.net.curl cannot handle the non-ASCII paths

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 21 14:15:56 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=21064

          Issue ID: 21064
           Summary: setCookieJar/caInfo in std.net.curl cannot handle the
                    non-ASCII paths
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: zan77137 at nifty.com

Some of the functions provided by std.net.curl handle paths, such as
setCookieJar and caInfo. But they cannot handle the non-ASCII paths.

-----------------
import std;

void makeCookieFile(string dir)
{
    if (!dir.exists)
        mkdirRecurse(dir);
    auto client = HTTP();
    client.setCookieJar(dir.buildPath("cookie.txt"));
    get("https://dlang.org", client);
}

void main()
{
    auto asciiPath = "abcde";
    auto nonAsciiPath = "あいうえお";
    makeCookieFile(asciiPath);
    makeCookieFile(nonAsciiPath);
    // Assertion failure, the nonAsciiPath is not including anything
    assert(dirEntries(asciiPath,    SpanMode.shallow).map!"a.name".equal(
           dirEntries(nonAsciiPath, SpanMode.shallow).map!"a.name"));
}
-----------------
core.exception.AssertError at src\main.d(19): Assertion failure
-----------------

I did a little research, but I couldn't figure out what character code should
be passed to Curl... Probably that is the system-dependent MBCS(NOT UTF-8).
https://curl.haxx.se/libcurl/c/CURLOPT_COOKIEJAR.html

--


More information about the Digitalmars-d-bugs mailing list