Ensuring that all curl errors are not retried, just the ones where the
connection could not be rewound.
Ensuring that curl handles are always closed, even if they fail to be
removed from the multi for some reason.
Always calling select in the transfer loop.
This commit updates the MultiAdapter to account for connecitons
being closed unexpectedly and then retried. When this occurs, curl
attempts to rewind the stream before sending. Because we use a
callback function to stream large payloads, curl fails to rewind
the stream and fails the transaction without associating the correct
error code. This commit checks if a transaction has a response
before processing. If a transaction doesn't have a response, then
we attempt to retry the request transparently (without emitting
another set of before events, essentially doing exactly what
curl would have done if it was possible to rewind the stream). If
the request did not have a body, then an error event is emitted as
it is a very weird error. If the request had a body but wasn't
rewindable, then an error event is emitted. If the request had a
body and a rewindable stream, then it is rewound and retried.
This change also updates the MultiAdapter and BatchContext to
transfer until the number of open handles in the BatchContext
reaches 0. This removes some complexity from the main transfer loop
that had to account for pending transactions.
Closes#710
The arguments to the SimpleXMLElement is documented in this way over at PHP.net:
```
data – A well-formed XML string or the path or URL to an XML document if data_is_url is TRUE.
options – Optionally used to specify additional Libxml parameters.
data_is_url – By default, data_is_url is FALSE. Use TRUE to specify that data is a path or URL to an XML document instead of string data.
ns – Namespace prefix or URI.
is_prefix – TRUE if ns is a prefix, FALSE if it's a URI; defaults to FALSE.
```
Even though we never will load XML in directly from a URL in this use case, the thrid argument data_is_url has to explicit be set to false. Otherwise the construct of SimpleXMLElement wont work as expected when the ns and is_prefix is beeing used.
Using the AppendStream to vastly clean up how a multipart POST is created.
This changes also cleans up how the body is sent over the wire, eliminating
some bugs I discovered when fields are sent before files.
This change wraps the functions defined in functions.php in an if
statement that checks to see if GUZZLE_FUNCTION_VERSION is defined. If
it is not defined, it is defined and set to the Guzzle version number.
This allows you to use a "global" version of Guzzle alongside a local version,
and still know which functions.php was autoloaded.
Closes#676