Re: HttpClient "Name or service not known"

2019-05-07 Thread trtt
Well, [https://github.com/nim-lang/Nim/blob/7f3b686b81f3f7ec060b5de9029e3234f24aa372/lib/pure/httpclient.nim#L373](https://github.com/nim-lang/Nim/blob/7f3b686b81f3f7ec060b5de9029e3234f24aa372/lib/pure/httpclient.nim#L373) $parsed just shows the structure, not the real "toString" \- this is

Re: HttpClient "Name or service not known"

2019-05-07 Thread trtt
[https://github.com/nim-lang/nimble/blob/f17eaef7957da23aab6e375400b37227394a632a/src/nimblepkg/options.nim#L408](https://github.com/nim-lang/nimble/blob/f17eaef7957da23aab6e375400b37227394a632a/src/nimblepkg/options.nim#L408) nimble has this bug too, I'm going to open a github issue.

Re: HttpClient "Name or service not known"

2019-05-07 Thread trtt
Plus: let proxy= getProxy() var client = newHttpClient(proxy = proxy) echo("GPI:" & $proxy.url) Run and a duplicated url "teleports" into the url's path: GPI:(scheme: "", username: "", password: "", hostname: "", port: "", path: "(scheme:

Re: HttpClient "Name or service not known"

2019-05-07 Thread trtt
parseUri doesn't work properly either: var parsed = parseUri(url) var parsed1 = initUri() parsed1.hostname = "10.10.10.10" parsed.port = "8080" echo("PARSEDPROXY1:") echo(parsed1) echo(repr(parsed1))

Re: HttpClient "Name or service not known"

2019-05-07 Thread trtt
Summary: After the when client is HttpClient: appears, the structure of connectionUrl changes. The hostname and port are always empty, repr() shows nothing special.

Re: HttpClient "Name or service not known"

2019-05-07 Thread trtt
I spent some trying to understand this bug but: proc newConnection(client: HttpClient | AsyncHttpClient, url: Uri) {.multisync.} = if client.currentURL.hostname != url.hostname or client.currentURL.scheme != url.scheme or

Re: HttpClient "Name or service not known"

2019-04-18 Thread geotre
Here's a way to replicate the bug: 1. Install mitmproxy and run it 2. Install the generated mitmproxy .pem file onto your machine 3. export http_proxy=http://127.0.0.1:8080 and export https_proxy=http://127.0.0.1:8080 4. Run curl https://forum.nim-lang.org/ outputs the html correctly

Re: HttpClient "Name or service not known"

2019-04-18 Thread dom96
I see. connectionUrl.hostname has something when you echo it the object but not when you echo the field itself, try using repr, it's possible that there is a 0 (end-of-string) character in that string.

Re: HttpClient "Name or service not known"

2019-04-18 Thread trtt
@dom96 I'd like to fix it but in one of my previous comments I presented something that shouldn't happen. If someone has a clue about that issue then I will be able to continue but otherwise I'm in the dark.

Re: HttpClient "Name or service not known"

2019-04-18 Thread dom96
It happens because either: 1\. You are doing something wrong, like not setting the http_proxy env var (Unlikely since it works for you in curl) 2\. There is a bug in the httpclient module (Likely as there were other bugs with the proxy support before) I don't use proxies, I also don't have

Re: HttpClient "Name or service not known"

2019-04-18 Thread trtt
Why does this happen? Can we ever expect proper proxy support for nim? Because if we can't then I might as well just change language or use curl as a replacement.

Re: HttpClient "Name or service not known"

2019-04-17 Thread trtt
I appended these after httpclient.nim:865(when client is HttpClient): when client is HttpClient: echo("httpclient.nim/newConnection") echo("CU:", $connectionUrl) echo("HN:", connectionUrl.hostname) echo("Port0:", connectionUrl.port == "")

Re: HttpClient "Name or service not known"

2019-04-17 Thread trtt
The port is empty too, it just gets a default in the same function.

Re: HttpClient "Name or service not known"

2019-04-17 Thread trtt
What I don't know is what supposed to go there...

Re: HttpClient "Name or service not known"

2019-04-17 Thread dom96
Keep going, check why `address` is `""` :)

Re: HttpClient "Name or service not known"

2019-04-17 Thread trtt
I added this after lib/pure/nativesockets.nim:261: echo "SOCKET:" echo address echo socket_port echo $hints echo $gaiResult Run output: SOCKET: 80 (ai_flags: 0, ai_family: 0, ai_socktype: 1, ai_protocol: 6, ai_addrlen:

Re: HttpClient "Name or service not known"

2019-04-16 Thread dom96
Proxy support in httpclient isn't well tested, if you want to move faster with this please add some debugging code into the httpclient module and compare to see what httpclient sends vs. curl (use `curl -v`)

Re: HttpClient "Name or service not known"

2019-04-15 Thread trtt
There is no proxy authentication.

Re: HttpClient "Name or service not known"

2019-04-15 Thread geotre
The httpclient docs say that only basic authentication is supported at the moment. How do you authenticate with the proxy you are using? Can you give more details on the proxy itself?

Re: HttpClient "Name or service not known"

2019-04-15 Thread trtt
They are set and everything works fine except nim's httpclient.

Re: HttpClient "Name or service not known"

2019-04-15 Thread trtt
I use a proxy. I tried it with -d:ssl too.

Re: HttpClient "Name or service not known"

2019-04-15 Thread geotre
Do you have the proxy details set up in the environment variable http_proxy or https_proxy? Maybe add some echo calls to see if the proxy is being picked up or not

Re: HttpClient "Name or service not known"

2019-04-15 Thread geotre
If I compile with nim c -d:ssl -r test.nim it runs correctly and saves httpclient.html. Does the link work correctly for you in a browser?

HttpClient "Name or service not known"

2019-04-15 Thread trtt
I get this error: Error: an error happened while downloading a file! main.nim(72) main main.nim(66) downloadFile httpclient.nim(1305) downloadFile httpclient.nim(1235) get httpclient.nim(1227) request httpclient.nim(1204)