1612 Commits

Author SHA1 Message Date
HoneyryderChuck
e1ee8c69dc proxy: fixing proxy resolve error filtering to also work with system resolver 2021-08-10 11:10:45 +01:00
HoneyryderChuck
6b61b8ccdb fixing signatures
also adding some checks on code, in order for steep to stop complaining
about potential nil returns.
2021-08-10 10:28:58 +01:00
HoneyryderChuck
556c94a575 added multipart decooder, which overtakes on Response#form for multipart payloads 2021-08-09 15:54:25 +01:00
HoneyryderChuck
f2d3c1f09b added Response#form (supports only x-www-urlencoded for now) 2021-08-09 15:54:25 +01:00
HoneyryderChuck
a85828d0d5 added Response#json 2021-08-09 15:54:24 +01:00
HoneyryderChuck
e5a120111c added tests for json and form (also multipart) decoders 2021-08-09 15:54:24 +01:00
HoneyryderChuck
c9de63d4cd bumped version to 0.16.1 2021-08-09 15:54:16 +01:00
HoneyryderChuck
eed79d0de3 Merge branch 'issue-145' into 'master'
bugfix: fixed native resolver timeout when dealing with absolute DNS names

Closes #145

See merge request honeyryderchuck/httpx!156
2021-08-09 13:14:05 +00:00
HoneyryderChuck
582447f10e bugfix: fixed native resolver timeout when dealing with absolute DNS
names

DNS answers are decoded using `resolv` internal structures. In this
particular case, we were using `Resolv::DNS::Name#to_s` to infer the
query dns name an answer refers to. This failed, because, as per
documentaation:

```ruby
p Resolv::DNS::Name.create("x.y.z.").to_s #=> "x.y.z"
p Resolv::DNS::Name.create("x.y.z").to_s #=> "x.y.z"
```

this caused issues when marking the DNS resolving as done. As a fix, I
applied the same logic from `Resolv::DNS::Name#inspect`. which correctly
prints absolute names.

Fixes #145
2021-08-09 13:36:49 +01:00
HoneyryderChuck
5eb9afd6e9 Merge branch 'reduce-options-allocations' into 'master'
performance improvements

See merge request honeyryderchuck/httpx!155
2021-08-05 22:41:26 +00:00
HoneyryderChuck
f9c17af6f3 save against file handle from system resolve being closed abruptly 2021-08-05 23:29:49 +01:00
HoneyryderChuck
48a2d82c34 http2 connection: removed interests calculation traversing requests
the traversal seems unnnecessary, given the subsequent cheaper checks. A
request with a stream will always be writable unless it's done, or is
expecting a 1xx response; however, there'll be drains in place, and
that's a cheaper check.
2021-08-05 22:52:58 +01:00
HoneyryderChuck
59755d7d01 connection: avoid calculating interests when there was nothing that could have changed the result 2021-08-05 22:51:16 +01:00
HoneyryderChuck
63c39a4032 fixed respond_to_missing? sig 2021-08-05 15:03:50 +01:00
HoneyryderChuck
65261217b1 optimization for calculation whether parser is empty
This avoids traversing all requests in the parser. this is possible for
HTTP/1.1 because, given that requests are sequentially concluded, one
can get away with checking only first and last request state.
2021-08-05 15:03:49 +01:00
HoneyryderChuck
3d549817cb optimization on build_request to reduce Options object allocations on
multi-request calls

request options already get aggregated in #build_requests. this
optimization removes the Options object rebuild for each request,
thereby sharing the same across concurrent requests.

this is possible because, although #build_request is public, we document
it only with passing hash of options, never an Options object. This
would probably result in errors.
2021-08-05 15:03:49 +01:00
HoneyryderChuck
cc02679b80 Options#to_hash: avoid intermediate array, directly assign to final hash 2021-08-05 15:03:49 +01:00
HoneyryderChuck
9d60b23aad fixed parser tests (those lines never trigger) 2021-08-05 15:03:49 +01:00
HoneyryderChuck
74f355314d removing reliance on regexp ops in http1 parser 2021-08-05 15:03:49 +01:00
HoneyryderChuck
29105854e3 do not pass around options after requests get initialized, instead rely on rquest options 2021-08-05 15:03:49 +01:00
HoneyryderChuck
b126938a65 skip options merge if the options to merge are already included 2021-08-04 16:30:20 +01:00
HoneyryderChuck
c8276f94f4 added tests for options to track allocation optimizations 2021-08-04 13:48:11 +01:00
HoneyryderChuck
d23be82b7e bumping versio to 0.16.0 v0.16.0 2021-08-04 00:16:28 +01:00
HoneyryderChuck
14bdb5327f Merge branch 'issue-143' into 'master'
make Response#to_s non-destructive, and keep the body around

Closes #143

See merge request honeyryderchuck/httpx!153
2021-08-02 18:15:54 +00:00
HoneyryderChuck
c8719435c7 updating jruby image 2021-08-01 14:43:23 +01:00
HoneyryderChuck
953f2d0d13 fixed calculation of connection header when explicit connection header
is passed

also, fixed the test which was relying on the previous one-time-to_s
behaviour of responnse bodies.
2021-08-01 00:38:40 +01:00
HoneyryderChuck
ba742847f7 fixing grpc dependency on body being closed when buffered 2021-07-24 04:00:19 +01:00
HoneyryderChuck
a1be10cbc6 defining finalizer on response body, which keeps the reference to the buffer, which will get closed on GC; this will ensure that file descriptors don't leak 2021-07-24 04:00:19 +01:00
HoneyryderChuck
e43d5eddcd making body comparison less wasteful, while keeping existing poinnters after call to to_s 2021-07-24 04:00:19 +01:00
HoneyryderChuck
0f1d8cb271 make Response#to_s non-destructive, and keep the body around
for most cases, this didn't make sense, i.e. response bodies were so
    small, and the user is fine with keeping it all in mem, whereas
    clearing the string is more confusing. And it breaks pattern
    matching when matching body multiple times.
2021-07-24 04:00:19 +01:00
HoneyryderChuck
74013fc2a7 patch 2.2 as well 2021-07-24 03:59:43 +01:00
HoneyryderChuck
db2c3e58fe Merge branch 'issue-142' into 'master'
grpc plugin: build stub from service definition

Closes #142

See merge request honeyryderchuck/httpx!152
2021-07-24 02:43:31 +00:00
HoneyryderChuck
c4de4dd384 commented out the etimedout test 2021-07-24 03:33:15 +01:00
HoneyryderChuck
5deadec23e fixing iptables deprecation 2021-07-22 14:52:19 +01:00
HoneyryderChuck
7aea7fe471 removing a few method_missing implementations
replacing them with SimpleDelegator where it made sense, and removing
them altogether whenever possible. ErrorResponse doesn't have a special
handling for Response methods anymore, but it's highly debatable if it
should.
2021-07-21 15:31:49 +01:00
HoneyryderChuck
15143f7322 went more meta with grpc and defining rpcs with def, optimal lookup up, removing method_missing logic 2021-07-21 15:31:18 +01:00
HoneyryderChuck
a9270a7616 do not require protobuf, as the user might use a different protobuf lib 2021-07-20 17:29:51 +01:00
HoneyryderChuck
e0a46dc7ec making the grpc plugin build a rpc definitions from ma grpc generic service, thereby diminishing boilerplate 2021-07-20 17:29:03 +01:00
HoneyryderChuck
fa7b61a852 Merge branch 'issue-137' into 'master'
Cookie Jar management

Closes #137

See merge request honeyryderchuck/httpx!151
2021-07-16 09:10:47 +00:00
HoneyryderChuck
37f23ad8c3 cookie: force name to string; as for the value, only late-force it on writing the cookie 2021-07-16 09:52:21 +01:00
HoneyryderChuck
00a6e4672d make sure that cookie jar on request is used, in case request has a distinct set of options 2021-07-16 09:52:21 +01:00
HoneyryderChuck
3ae18120d2 when users pass a Cookie header as option and plugin is enabled, the header will be parsed and managed by the jar 2021-07-16 09:52:21 +01:00
HoneyryderChuck
ac398ae0f0 bug (unexisting var) 2021-07-15 15:53:15 +01:00
HoneyryderChuck
174f5f9647 allow cookie jar to merge 2021-07-15 15:53:15 +01:00
HoneyryderChuck
1a7025941b allow any option which can be merged, to be merged. This is a semi-breaking change, as some hash-like options will expanded instead of replaced, like the resolver options, but that was unspecified before, no guaarantees 2021-07-15 15:53:15 +01:00
HoneyryderChuck
fec85f29cd added test for cookie jar management, exemplifying what the cookie plugin should be doing 2021-07-15 15:00:29 +01:00
HoneyryderChuck
f9f13abb81 removing internal with_cookies usage 2021-07-15 14:59:44 +01:00
HoneyryderChuck
2ea8b2ec2d Merge branch 'issue-135' into 'master'
Options

Closes #135

See merge request honeyryderchuck/httpx!148
2021-07-14 17:31:11 +00:00
HoneyryderChuck
ac39eb8d36 bump version to 0.15.4 v0.15.4 2021-07-14 09:52:39 +01:00
HoneyryderChuck
514e6cafb3 do not call .marshal directly 2021-07-13 21:12:53 +01:00