Thread overview | |||||
---|---|---|---|---|---|
|
February 03, 2021 std.net.curl and HTTP.responseHeaders | ||||
---|---|---|---|---|
| ||||
Header requests to Wikipedia give 405 error for some reason. ``` import std.stdio, std.net.curl; void main() { auto url = "https://en.wikipedia.org/wiki/Passenger_pigeon"; auto http = HTTP(); options(url, http); writeln(http.responseHeaders); } ``` Output: ``` std.net.curl.HTTPStatusException@/usr/include/dmd/phobos/std/net/curl.d(1097): HTTP request returned status code 405 () ``` Perhaps some special HTTP configuration is needed? |
February 04, 2021 Re: std.net.curl and HTTP.responseHeaders | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vindex | On Wednesday, 3 February 2021 at 19:25:18 UTC, Vindex wrote: > Output: > ``` > std.net.curl.HTTPStatusException@/usr/include/dmd/phobos/std/net/curl.d(1097): HTTP request returned status code 405 () > ``` > > Perhaps some special HTTP configuration is needed? Is this closer to what you want? import std.stdio, std.net.curl; void main() { enum url = "https://en.wikipedia.org/wiki/Passenger_pigeon"; auto http = HTTP(url); http.perform(); writeln(http.responseHeaders); } |
February 04, 2021 Re: std.net.curl and HTTP.responseHeaders | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anonymouse | Thank you! For other sites, the first solution somehow worked (I did it following the example from the documentation). |
Copyright © 1999-2021 by the D Language Foundation