1085 Commits

Author SHA1 Message Date
HoneyryderChuck
c7f177adbb added regexp extensions where using match? 2021-08-10 11:25:36 +01:00
HoneyryderChuck
e19041aaad no ned to call Kernel directly (at least, not anymore) 2021-08-10 11:10:45 +01:00
HoneyryderChuck
c4f5362156 making responses coercable to string 2021-08-10 11:10:45 +01:00
HoneyryderChuck
20db082db2 changing proc to lambda (just because of rbs) 2021-08-10 11:10:45 +01:00
HoneyryderChuck
802c47a037 multipart decoding: fail if no boundary found in header 2021-08-10 11:10:45 +01:00
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
c9de63d4cd bumped version to 0.16.1 2021-08-09 15:54:16 +01: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
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
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
d23be82b7e bumping versio to 0.16.0 2021-08-04 00:16:28 +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
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
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
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 2021-07-14 09:52:39 +01:00
HoneyryderChuck
514e6cafb3 do not call .marshal directly 2021-07-13 21:12:53 +01:00
HoneyryderChuck
e9e3063dcc fixing options class hierarchy, which caused truffleruby to fail 2021-07-13 19:56:59 +01:00
HoneyryderChuck
cab5a94d31 removing setters from Options, which weren't public API anyway 2021-07-13 19:56:59 +01:00
HoneyryderChuck
9d910df01b fixing order of sub-plugins load in nnthe aws sigv4 plugin 2021-07-13 19:56:59 +01:00
HoneyryderChuck
5604501d01 using the new OptionsMethods way for defining internal plugin options 2021-07-13 19:56:59 +01:00
HoneyryderChuck
5c2ad6b588 allow definition of options via OptionsMethods module; using .extra_options for setting defaults 2021-07-13 19:56:59 +01:00
HoneyryderChuck
ec0f3cd163 defining options via normal method definition, def option_optname 2021-07-13 19:56:59 +01:00
HoneyryderChuck
340fb6c7c6 Merge branch 'ojab-master-patch-08963' into 'master'
Don't count `nil` as an retryable error class

See merge request honeyryderchuck/httpx!147
2021-07-11 15:18:53 +00:00
ojab
246094d8fc
Remove uneeded if defined?(TLSError) check
It's always defined
2021-07-11 15:05:21 +00:00
ojab
b5fe5bec11
Remove unused method definition, it's defined in the code below 2021-07-08 20:51:41 +00:00