Thread overview
std.net.curl broken?
Jun 23, 2013
Benjamin Thaut
Jun 23, 2013
Vladimir Panteleev
Jun 23, 2013
Benjamin Thaut
June 23, 2013
I just wanted to get the contents of a smiple html page using std.net.curl (on Windows)

So I did (exactly like in the library documentation example)

string contents = get("dlang.org");

But this won't even compile, not with dmd 2.062 and not with 2.063

main.d(8): Error: cannot implicitly convert expression (get("dlang.org", AutoProtocol())) of type char[] to string
C:\digital-mars\dmd2-63\windows\bin\..\..\src\phobos\std\range.d(611): Error: static assert  "Cannot put a const(dchar)
into a Appender!(char[])"
C:\digital-mars\dmd2-63\windows\bin\..\..\src\phobos\std\format.d(2160): 

instantiated from here: put!(Appender!(char[]), const(dchar))
C:\digital-mars\dmd2-63\windows\bin\..\..\src\phobos\std\format.d(2207): 

instantiated from here: formatChar!(Appender!(char[]))
C:\digital-mars\dmd2-63\windows\bin\..\..\src\phobos\std\typecons.d(581): 

instantiated from here: formatElement!(Appender!(string), char[], char)
C:\digital-mars\dmd2-63\windows\bin\..\..\src\phobos\std\net\curl.d(1873):        ... (4 instantiations, -v to show) ...
C:\digital-mars\dmd2-63\windows\bin\..\..\src\phobos\std\net\curl.d(374): 

instantiated from here: get!(FTP, char)
main.d(8):
instantiated from here: get!(AutoProtocol, char)


Are the exampels not tested? What is wrong here?

Kind Regards
Benjamin Thaut
June 23, 2013
On Sunday, 23 June 2013 at 12:08:08 UTC, Benjamin Thaut wrote:
> I just wanted to get the contents of a smiple html page using std.net.curl (on Windows)
>
> So I did (exactly like in the library documentation example)
>
> string contents = get("dlang.org");

Looks like a documentation bug. `get("dlang.org")` will return a char[], not a string.

The unrelated errors in std.range an std.format are caused by a DMD bug (7904, I believe).
June 23, 2013
Am 23.06.2013 14:08, schrieb Benjamin Thaut:
> I just wanted to get the contents of a smiple html page using
> std.net.curl (on Windows)
>
> So I did (exactly like in the library documentation example)
>
> string contents = get("dlang.org");
>
> But this won't even compile, not with dmd 2.062 and not with 2.063
>
> main.d(8): Error: cannot implicitly convert expression (get("dlang.org",
> AutoProtocol())) of type char[] to string
> C:\digital-mars\dmd2-63\windows\bin\..\..\src\phobos\std\range.d(611):
> Error: static assert  "Cannot put a const(dchar)
> into a Appender!(char[])"
> C:\digital-mars\dmd2-63\windows\bin\..\..\src\phobos\std\format.d(2160):
> instantiated from here: put!(Appender!(char[]), const(dchar))
> C:\digital-mars\dmd2-63\windows\bin\..\..\src\phobos\std\format.d(2207):
> instantiated from here: formatChar!(Appender!(char[]))
> C:\digital-mars\dmd2-63\windows\bin\..\..\src\phobos\std\typecons.d(581):
> instantiated from here: formatElement!(Appender!(string), char[], char)
> C:\digital-mars\dmd2-63\windows\bin\..\..\src\phobos\std\net\curl.d(1873):
>         ... (4 instantiations, -v to show) ...
> C:\digital-mars\dmd2-63\windows\bin\..\..\src\phobos\std\net\curl.d(374):
> instantiated from here: get!(FTP, char)
> main.d(8):
> instantiated from here: get!(AutoProtocol, char)
>
>
> Are the exampels not tested? What is wrong here?
>
> Kind Regards
> Benjamin Thaut

Nevermind, I found the problem, all the error message noise made me miss it.