Commit Graph

125 Commits

Author SHA1 Message Date
Dominik Picheta
ac67f5eda5 Fixes req w/ both Content-Length & Connection: close headers.
Also closes the socket when connection is closed to ensure
that a new connection is made on any further requests.
2017-10-13 21:14:06 +01:00
Dominik Picheta
b47e448e06 Fixes #6284. 2017-08-28 23:12:36 +01:00
daneb
0a022664d5 Minor formatting 2017-06-13 21:45:18 +02:00
daneb
64cbcec54d Working example to resolve #5863 2017-06-13 21:08:04 +02:00
Ruslan Mustakov
e0059287bb Add 'hostname' param to wrapConnectedSocket 2017-05-04 16:27:08 +07:00
Ruslan Mustakov
ecf278c467 Implement dial, support IPv6 in httpclient (#5763)
* Implement dial, support IPv6 in httpclient

Added ``dial`` procedure to networking modules: ``net``, ``asyncdispatch``,
``asyncnet``. It merges socket creation, address resolution, and connection
into single step. When using ``dial``, you don't have to worry about
IPv4 vs IPv6 problem.

Fixed addrInfo loop in connect to behave properly.
Previously it would stop on first non-immediate failure, instead of
continuing and trying the remaining addresses.

Fixed newAsyncNativeSocket to raise proper error if socket creation
fails.

Fixes: #3811

* Check domain during connect() only on non-Windows

This is how it was in the previous implementation of connect().

* Call 'osLastError' before 'close' in net.dial

* Record osLastError before freeAddrInfo in net.dial

* Add missing docs for 'dial' proc

* Optimize dial to create one FD per domain, add tests

And make async IPv6 servers work on Windows.

* Add IPv6 test to uri module

* Fix getAddrString error handling
2017-05-02 09:25:50 +02:00
Dominik Picheta
5cf31417a6 Fixes #5710. Closes #5711. 2017-04-15 09:03:12 +02:00
Daniil Yarancev
009277856e Fix #5611 2017-04-02 18:52:14 +03:00
Rayner De Los Santos F
d5d975ceef Only remove scheme when there's a TLS request ("https")
If condition, for not removing the scheme when proxied connection isn't a TLS request ("http://...").
2017-03-03 08:47:13 -04:00
Ruslan Mustakov
ef508047bf Ensure default SSL context is always initialized 2017-02-27 16:42:51 +07:00
Araq
b724f46f6f make tests green again 2017-02-26 23:25:50 +01:00
Dominik Picheta
b5de988eda Fix the other withNewLine template. 2017-02-26 12:54:03 +01:00
Dominik Picheta
f9cce32097 Various fixes to FutureStreams based on PR feedback. 2017-02-26 12:52:19 +01:00
Dominik Picheta
912d95a6ea Add small warning in httpclient's onProgressChanged docs. 2017-02-26 11:36:16 +01:00
Araq
45765601e0 fixed premature finishing of httpclient.downloadFile 2017-02-25 17:26:03 +01:00
Dominik Picheta
f9f86899b5 Implement streamed async/sync downloadFile and deprecate old one. 2017-02-11 14:00:53 +01:00
Dominik Picheta
1b4067a81b Implement streamed body reading in httpclient. 2017-02-11 12:43:16 +01:00
Ruslan Mustakov
35d48765fb Use onThreadCreation to set default SSL context for each thread (#5265)
Fixes: #4998
2017-01-23 21:04:14 +01:00
Yuriy Glukhov
2f320fb286 Fixed query and anchor during relative redirection 2017-01-20 12:59:13 +02:00
Yuriy Glukhov
b2237678fb Redirects support in request proc 2017-01-19 17:44:53 +02:00
Dmitry Polienko
4753149227 Implement suggestions from @dom96 2016-11-02 09:19:20 +07:00
Dmitry Polienko
52f4590e98 Don't persist generated headers between requests 2016-10-31 09:46:50 +07:00
Dmitry Polienko
8fb7858291 Reset HttpClient if new URL has different port 2016-10-24 09:42:18 +07:00
Dennis Felsing
f0ed986e0e Update httpclient documentation 2016-10-21 10:53:28 +02:00
Federico Ceratto
7d24656b0a Fix few typos 2016-10-17 13:12:15 +01:00
Alpha Shuro
72b15678a1 Add example for posting json content
i struggled to figure out how to post json content with nim's http client. this is a fundamental capability in many web apps, we don't always need to send data as multipart form data (e.g. when communicating via json apis) so frankly i'm surprised it isn't part of the "post" and "postContent" procs
2016-10-12 13:58:34 +02:00
Dominik Picheta
26c7a76c8a asynchttpserver's Response object's req method uses HttpMethod now.
Fixes #4423.
2016-09-25 00:39:57 +02:00
Dominik Picheta
6a83bc1ff5 HTTP client's request proc no longer slices http method string param. 2016-09-25 00:10:07 +02:00
Dominik Picheta
545e24b8ff Improves httpclient documentation. 2016-09-24 23:02:56 +02:00
Dominik Picheta
cff6ec2155 Implements onProgressChanged callback for httpclient. 2016-09-24 22:58:10 +02:00
Dominik Picheta
ff821eed6a Deprecates old httpclient procedures. 2016-09-24 20:48:28 +02:00
Dominik Picheta
0baef8e6ea Implements getContent and postContent for (Async)HttpClient. 2016-09-24 20:33:00 +02:00
Dominik Picheta
fa9ec7a6b5 Handle redirects in HttpClient's post procs & post test. 2016-09-24 17:50:58 +02:00
Dominik Picheta
cfd187d16e Use distinct range for HttpCode as suggested by @nigredo-tori. 2016-09-19 20:58:27 +02:00
Dominik Picheta
8386476592 Implements proxy support for (Async)HttpClient. Ref #4423.
Fixes #2160.
2016-09-18 22:59:12 +02:00
Dominik Picheta
0c99523ad3 Implements timeouts for synchronous HttpClient. 2016-09-18 19:08:12 +02:00
Dominik Picheta
c4ee18015e Use HttpHeaders in httpclient module. 2016-09-18 18:56:04 +02:00
Dominik Picheta
3ad368f8ca Improvements to httpclient. Refs #4423.
* Adds ability to query HttpCode and compare it with strings.
* Moves HttpMethod to HttpCore module.
* Implements synchronous HttpClient using {.multisync.}.
2016-09-18 18:16:51 +02:00
Dominik Picheta
8e853368c3 Merge branch 'devel' of https://github.com/RyanMarcus/Nim into RyanMarcus-devel 2016-07-30 21:29:00 +02:00
Andreas Rumpf
d7a1abd5f7 Merge pull request #4527 from hendi/httpclient-close-sockets
make httpclient close opened Socket on error
2016-07-28 20:54:58 +02:00
Hendrik Richter
4bef9d020d use defer instead of try ... finally 2016-07-28 15:50:34 +02:00
Hendrik Richter
6a2ad716a4 remove superfluous except: raise 2016-07-28 15:37:34 +02:00
Hendrik Richter
b0f1d9f467 make httpclient close opened Socket on error 2016-07-28 11:30:05 +02:00
Ryan Marcus
0ada2aedfa added when() block so that the compiler doesn't try to link SSL methods when SSL isn't available 2016-07-27 17:26:11 -04:00
Ryan Marcus
0a03b18ae9 removed whitespace diffs 2016-07-27 17:08:28 -04:00
Ryan Marcus
56387c61dd added code to send CONNECT request for https requests through proxies, fixes #4520 2016-07-27 17:02:53 -04:00
Hendrik Richter
5c465e260a Fix empty body on HTTP/1.0 connections
HTTP/1.0 does not send `Connection: close`. Thus we read till the end
of the response in order to catch the whole body.
2016-06-16 15:35:57 +02:00
Euan T
06d4716579 Use passed user agent in newAsyncHttpClient
Fixes #4273.
2016-06-05 09:56:16 +01:00
Dominik Picheta
ca7dd345da Fixes #3847. 2016-06-02 19:51:16 +01:00
Dominik Picheta
b33fbedec0 httpclient now uses httpcore.HttpHeaders 2016-06-02 18:40:13 +01:00