- Removing some duplication
- Nested futures are now resolved in the client.
- Simplified injecting in futures in request events and removing now
extraneous conditional.
- This commit updates the request FSM to use goto statements to reduce
function call overhead and removes 5 stack frames from each request.
- Removed `$finalState` from RequestFSM::__invoke
- Finishing FSM transitions is not handled in the FSM rather than the
RingBridge.
- Slightly related to #964
This commit updates the request FSM to resolve deep futures to
ensure that retried synchronous requests are waited on correctly
and produce side-effects when expected. Previously the results of a
retried request were not being properly brought up to the outermost
layer when a client was attempting to dereference a future because the
request was not a future request.
Adding a way to get the number of retries to events
Allows the number of requests allowed in a pool to vary over time by
retrieving the current pool size from a callback instead of a single
constant number.
This allows us to amend the number of requests ongoing according to our
needs, e.g. by responding to rate limiting information provided by an
upstream API.
Changes are
* Allow a callback to be passed in to specify the pool size instead of a
constant pool size.
* As each request returns, add enough new requests to the queue to fill
up to the current pool size limit.
This commit makes it so that setting a request option to null will
ensure that the option is not set by the single request or as a result
of merging in default client settings (like being able to override proxy
on a one-off basis).
When requests are intercepted in a Pool, it can result in infinite
recursion. This commit modifies the Pool to inspect the promise type of
a request to see if it was completed or not. If the request is completed
after sending, then we wait on the request to emit any pending events
and use `goto` to send the next request and prevent the stack from
growing.
Closes#905.
This change updates query strings so that they are treated as un-encoded
values by default where the value represents an un-encoded value to send
over the wire. A Query object then encodes the value before sending over
the wire. This means that even value query string values (e.g., ":") are
url encoded. This makes the Query class match PHP's http_build_query
function. However, if you want to send requests over the wire using
valid query string characters that do not need to be encoded, then you
can provide a string to Url::setQuery() and pass true as the second
argument to specify that the query string is a raw string that should
not be parsed or encoded (unless a call to getQuery() is subsequently
made, forcing the query-string to be converted into a Query object).
This commit updates path and query string encoding to better handle
strings that are already percent encoded, and now allows for all of the
characters valid for paths and queries specified in RFC 3986 to be
present in a URL without being encoded.
Existing 'application/x-www-form-urlencoded' content-type headers are no
longer overwritten when applying POST headers to a request before
sending. This allows developers to set custom attributes on each request
(e.g., charset).
Closes#877Closes#879
When a networking error occurs, the future response that is created
for the transaction does not receive an exception until after the
future is waited on. When calling getResponse() in an event that
is emitted after a networking error, the response returned will
be a future with no actual data to use and throws when accessed.
This commit updated these events to return null if the response
of the transaction is a future. In these cases, it means that the
response did not complete successfully. I've also added a new method
to make this more explicit: hasResponse().
Closes#867.
FSM is now passed to a client as a callable.
FSM now requires an adapter and message factory rather than a function.
FSM now is merged with RequestFsm to simplify the API (at least for now)
Removed unnecessary circular reference from client/FSM.