252 Commits

Author SHA1 Message Date
HoneyryderChuck
621e1e3688 request: is now a state machine; can store response; added #drain_body, which gets the enumerator of #each, and yields the next chunk (and nil when it ends) 2017-12-12 02:23:07 +00:00
HoneyryderChuck
e779eaa8ba request: do not buffer requests if buffer is full 2017-12-12 02:21:35 +00:00
HoneyryderChuck
fd25548ffd allow channels to be hard closed, that is, if connection has been explicitly closed, ignore pending requests and just hard-close 2017-12-12 02:20:58 +00:00
HoneyryderChuck
6acffbc297 added limited buffer type; it's a weak buffer, in that it doesn't break if buffer limit it is exceeded, it just doesn't let append more data after limit is reached 2017-12-12 02:19:23 +00:00
HoneyryderChuck
e6a5fbdf45 passing fallback protocol as option; this will allow to override, specially in the case when user knows that server can do unencrypted http/2 2017-12-11 22:28:12 +00:00
HoneyryderChuck
4e094f79d0 ssl options: passing alpn fixtures as ssl default options; this will allow disabling, and will centralize defaults 2017-12-11 16:02:51 +00:00
HoneyryderChuck
6220ecec15 ssl connect: if ssl io is passed (keep_open), assume it is negotiated and carry on 2017-12-11 16:01:17 +00:00
HoneyryderChuck
1da2d0829a do not sending pending if io hasn't been opened yet (as protocol might have to be negotiated first 2017-12-11 16:00:45 +00:00
HoneyryderChuck
5218f5a87b fixed io tests for passed ssl io type 2017-12-11 16:00:07 +00:00
HoneyryderChuck
67ca959535 added test for http2 (for now, testing the ssl layer as well); created intermediate base class for http helpers 2017-12-11 15:59:43 +00:00
HoneyryderChuck
daa2860b60 mobed all http request tests to request helpers 2017-12-11 14:59:40 +00:00
HoneyryderChuck
15a5ffffdd allow to pass a custom body class, which only needs to implement the constructor signature and #<< 2017-12-11 13:10:58 +00:00
HoneyryderChuck
40a73f5a7b made body threshold size (the max buffered size after which the response body is buffered to disk) a top-level option 2017-12-11 12:43:05 +00:00
HoneyryderChuck
adf3949c07 registering chunker properly 2017-12-10 20:38:21 +00:00
HoneyryderChuck
4a9714df3c using requires of core modules everywhere it is used 2017-12-10 20:38:03 +00:00
HoneyryderChuck
94cb9b63d9 moved window size to options, changed it to 16K 2017-12-10 20:37:27 +00:00
HoneyryderChuck
feac489f33 renaming processor to parser 2017-12-10 20:36:45 +00:00
HoneyryderChuck
520d00c715 testing stream-copying the response; added a convenience method, Response#copy_to, to ensure that buffer is properly rewinded, and that the file is simply moved, when its stored in a file and the destination is a file 2017-12-10 18:36:20 +00:00
HoneyryderChuck
824efb83fd allow IOs to be passed as argument; they are expected to be connected already, and won't be closed after use; if passed only one, assume that all requests are going through it, otherwise, pass them as an hash indexed by IP or IP:PORT 2017-12-10 00:29:06 +00:00
HoneyryderChuck
e00f81d7b2 connection: #build_channel as helper 2017-12-10 00:25:43 +00:00
HoneyryderChuck
26bee8ee54 channel: simplified inner structure, added #connect, which does the heavy-lifting of buffering requests 2017-12-10 00:25:12 +00:00
HoneyryderChuck
dbee480c7f Merge branch 'dsl' into 'master'
Dsl

See merge request honeyryderchuck/httpx!2
2017-12-09 01:12:54 +00:00
HoneyryderChuck
92ef05104d frozen string 2017-12-09 01:12:15 +00:00
HoneyryderChuck
3b46ae11fb inspect the chunk 2017-12-09 01:11:56 +00:00
HoneyryderChuck
4d1205f774 added test for HTTP chunked encoding GET request 2017-12-09 01:11:44 +00:00
HoneyryderChuck
c9b632fb55 added support for chunking requests (sadly, not being able to test it well...) 2017-12-09 01:11:24 +00:00
HoneyryderChuck
e4fee5cf6f client: keep #send clean, so tests don't break 2017-12-09 01:09:13 +00:00
HoneyryderChuck
71fe46e7ac renamed test file 2017-12-08 22:25:17 +00:00
HoneyryderChuck
34646fd6d1 processor might not exist 2017-12-08 21:22:44 +00:00
HoneyryderChuck
4cb7219096 query params: using URI.encode_ww_form for the encoding instead 2017-12-08 21:22:30 +00:00
HoneyryderChuck
8f6bd3b40a added #params test and support (for flat hashes it works, still to be seen about deep hashes...) 2017-12-08 21:12:32 +00:00
HoneyryderChuck
0dc7dac986 fixed headers test 2017-12-08 21:11:32 +00:00
HoneyryderChuck
cef2d04a70 client tests: #request is not a constructor anymore, adapt accordingly 2017-12-08 20:25:21 +00:00
HoneyryderChuck
24eea892bd added way more httpbin tests, all possible verbs, all possible types of bodies (file,form,json,etc...) 2017-12-08 20:24:51 +00:00
HoneyryderChuck
fcd97c1351 form data: can't #to_str, must do it myself 2017-12-08 20:23:59 +00:00
HoneyryderChuck
34d6f3b8c0 copying plugins to inherited classes; set a default options also for the main module 2017-12-08 20:23:38 +00:00
HoneyryderChuck
e09c1cbb2f the first specs using httpbin (get and head requests) 2017-12-08 19:04:46 +00:00
HoneyryderChuck
4e68e5549d testing the chain API first hand in the scripts 2017-12-08 19:04:25 +00:00
HoneyryderChuck
072c1c55a0 change var names, refactorings 2017-12-08 19:03:23 +00:00
HoneyryderChuck
d8eb3bbe5f went back from returning partial responses, and only expose fully buffered responses to the user; the main issue being, the main API favours closing the connection after requests, and this makes the whole handling of partial responses confusing and error prone; this way, one can buffer the body, even to the filesystem, and maybe make this tunable in the future 2017-12-08 19:01:44 +00:00
HoneyryderChuck
7b8858ec56 response: added #bodyless? and content type 2017-12-08 18:58:14 +00:00
HoneyryderChuck
d5ef498d3e response: fixed the headers class used, not passing the selector to the body, instead pass self 2017-12-08 18:57:07 +00:00
HoneyryderChuck
690fcaf3d2 default timeout is now the per operation one 2017-12-08 18:45:29 +00:00
HoneyryderChuck
b9bdd7bd0b rewrote the example scripts 2017-12-07 21:15:53 +00:00
HoneyryderChuck
2742f4f9af added chainable module, a la http gem 2017-12-07 21:15:39 +00:00
HoneyryderChuck
a74f225a3b client: allow to pass requests in many forms; pass an array of many-formed requests; allow to pass an array of uris; allow to pass one uri 2017-12-07 21:15:14 +00:00
HoneyryderChuck
38d0f98564 plugins: do not allow to pass the same plugin more than once 2017-12-07 21:13:54 +00:00
HoneyryderChuck
2bf6b21cad client: allow to pass block to constructor; it keeps using the same connection 2017-12-07 21:13:27 +00:00
HoneyryderChuck
2b266d305d selector: don't forget to deregister the writer monitor 2017-12-07 21:11:50 +00:00
HoneyryderChuck
2dede153c2 timeout: allow to pass timeout as class, allow to pass options and set per-operation timeout as the default 2017-12-07 21:11:18 +00:00