1
0
mirror of https://github.com/guzzle/guzzle.git synced 2025-02-25 02:22:57 +01:00

278 Commits

Author SHA1 Message Date
Paul Annesley
798bfb0393 UriTemplate suppresses key name for empty arrays.
e.g:

params:            array()
template:          /path{?params*}
previous result:   /path?params=
correct result:    /path

Unfortunately PHP is unable to distinguish between an empty list array
and an empty associative array. However this doesn't matter, because the
empty case of either of these is considered "undefined" by the spec.

http://tools.ietf.org/html/draft-gregorio-uritemplate-08#section-2.3

  A variable defined as a list value is considered undefined if the
  list contains zero members.  A variable defined as an associative
  array of (name, value) pairs is considered undefined if the array
  contains zero members or if all member names in the array are
  associated with undefined values.

http://tools.ietf.org/html/draft-gregorio-uritemplate-08#section-3.2.1

  A variable that is undefined (Section 2.3) has no value and is
  ignored by the expansion process.  If all of the variables in an
  expression are undefined, then the expression's expansion is the
  empty string.
2012-08-17 15:22:25 +10:00
Michael Dowling
5b0277b0b3 [Http] Allowing request entity bodies to be transferred using a string rather than streamed by setting "body_as_string" as a curl option on a request. This gets around the issue where curl cannot rewind the stream on a redirect or challenge due to the inability of PHP to specify a seek or IO callback. Closes #120. 2012-08-14 18:16:47 -07:00
Michael Dowling
0aceeef7b0 [Http] Adding an EventDispatcher to the ExponentialBackoffPlugin and adding an ExponentialBackoffLogger 2012-08-14 14:53:09 -07:00
Michael Dowling
8f0674dcb3 Fixing broken DELETE test 2012-08-12 19:38:53 -07:00
Michael Dowling
538de90a86 [Http] DELETE requests can now send along an entity body.
Retrieving a DELETE request from a client or request factory will now
return an EntityEnclosingRequestInterface object.
Cleaned up the CurlHandle::factory method.
Closes #118 (thanks to @zachbadgett for inspiration)
2012-08-12 18:55:12 -07:00
Michael Dowling
6ee1c502b5 [Http] Removing openssl version information from the default User-Agent header 2012-08-12 15:20:54 -07:00
Michael Dowling
ce8cdd8f67 [Http] Attempting to seek to the beginning of a stream when sending EntityEnclosingRequest objects so that they can be reused without having to seek manually 2012-08-08 17:16:55 -07:00
Michael Dowling
153ade4125 [Common] [Http] Stream and EntityBody objects will now return the stream
position to it's previous position any time a seek is made for a
temporary operation (e.g. __toString(), getContentLength(),
getContentMd()).
Cleaning up how compression offsets are handled
[Http] Adding the ability to consume request entity bodies when mocked
by the
MockPlugin
[Http] Fixing an offset error in the ReadLimitEntityBody
Only returning a subset of the body when calling __toString() on a
ReadLimitEntityBody
2012-08-07 17:20:09 -07:00
Michael Dowling
eebf25be22 [Http] Returning a modified result for getContentType and getContentMd5 when using a ReadLimitEntityBody 2012-08-05 15:53:19 -07:00
Michael Dowling
0ea1d86f36 [Http] Allowing for a bounded seek on ReadLimitEntityBodies 2012-08-05 12:33:01 -07:00
Michael Dowling
1c4a509ecc [Http] [Common] Adding ftell to streams. Adding ReadLimitEntityBody decorator to read only a subset of data from a stream. 2012-08-04 22:30:23 -07:00
Michael Dowling
ba0bd7fab0 Adding tests for AbstractEntityBodyDecorator 2012-08-04 14:04:37 -07:00
Michael Dowling
522fbe0f36 [Http] Adding test to ensure that POST requests with empty POST field arrays are always sent as POST. Closes #110. 2012-07-30 12:22:42 -07:00
Michael Dowling
58d6432726 [Http] Fixing a bug in ExponentialBackoffPlugin that caused fatal errors when retrying an EntityEnclosingRequest that does not have a body. Closes #112. 2012-07-30 12:15:11 -07:00
Michael Dowling
8c6bc88bc8 [Service] Adding multiple inheritance to service description commands. Guzzle\Service\Description\ApiCommand now returns an array of arrays for params rather than an array of ApiParam objects. 2012-07-26 11:03:25 -07:00
Michael Dowling
9899cf40cd [Http] Setting the responseBody of a request to null when a request completes (not when a request is set to new). Md5ValidatorPlugin no longer defaults to only validating responses under 2mb. Adding more test coverage around custom response bodies for requests. 2012-07-25 00:15:00 -07:00
Michael Dowling
cce95c2324 [Service] Adding an ApiCommandInterface. Adding getParamName() and hasParam() to ApiCommand. 2012-07-24 21:44:07 -07:00
Michael Dowling
dffa97fcb9 [Http] Fixing a case where empty POST requests were sent as GET requests. Closes #107 2012-07-24 13:57:08 -07:00
Dave Marshall
f0ecc3ab65 Fixes #108 - Check array key exists rather than for empty 2012-07-24 16:35:12 +01:00
Michael Dowling
bc6cbc8cd3 [Http] Fixing bug where query string values of 0 were not being set. Closes #108. 2012-07-23 22:50:38 -07:00
Michael Dowling
c76e287134 [Service] Allowing dot notation for class paths in filters attribute of service descriptions 2012-07-23 16:18:01 -07:00
Michael Dowling
9e0b2113e9 Another content-type fix 2012-07-21 22:43:59 -07:00
Michael Dowling
8aad81db63 One more broken content-type fix 2012-07-21 22:28:46 -07:00
Michael Dowling
7665ac74b2 Updating tests so that they work with the broken behavior of returning text/x-c++ for the content-type of .php scripts 2012-07-21 22:26:00 -07:00
Michael Dowling
51884a9402 [Common] Cleaning up Collection 2012-07-21 20:36:52 -07:00
Matt Button
aeeb31a4ed Treat '+' as encoded space when parsing query string
According to RFC1738 (implemented by urlencode) spaces are encoded as
plus symbols. However, RFC3986 (imeplemented by rawurlencode) states
that spaces should be encoded as '%20'.

When parsing a query string that was encoded with urlencode we should
treat plus symbols as spaces.

fixes #105
2012-07-19 13:50:55 +01:00
Michael Dowling
c669aa0c7a [Http] Fixing POST redirects so that they are followed with a GET (use the undocumented CURLOPT_POSTREDIR option to change this behavior). Closes #23 2012-07-15 23:36:46 -07:00
Ben Selby
f1b55b27dc Allow configuration to be specified on a service descriptor
An example of this would be:
<param name="curl.CURLOPT_CONNECTTIMEOUT" default="100" />

This would override the configuration set by the instantiation:

new Client(
    'http://www.example.com',
    array('curl.CURLOPT_CONNECTTIMEOUT' => 100)
);
2012-07-13 22:48:09 +01:00
Michael Dowling
db66916895 [Parser] Values set to null are treated as undefined. Minor short circuit if improvement to Guzzle\Http\Url 2012-07-12 11:11:39 -07:00
Michael Dowling
56c7fa0aeb [Parser] Not urldecoding cookie values by default. Addresses #99. 2012-07-11 00:10:16 -07:00
Michael Dowling
6716de4edb [Service] Adding the ability to specify curl options in commands using an array called curl.options. Closes #100 2012-07-10 23:00:07 -07:00
Michael Dowling
c8b3c4c3d0 [Http] Cleaning up CurlHandle, EntityEnclosingRequestInterface, and AbstractMessage
The responsibility of setting a Content-Length of 0 for an empty EntityEnclosingRequest is now handled in the setState method of an EntityEnclosingRequest
Removing the action argument from Guzzle\Http\Message\AbstractMessage::changedHeader()
Passing an array of Cache-Control data in the Cache-Control header instead of the unnecessary implode
Removing process as an argument for Guzzle\Http\Message\EntityEnclosingRequest::addPostField
Enforcing the decision of whether or not to URL encode POST data in the CurlHandle class
Closes #95
2012-07-08 22:39:08 -07:00
Michael Dowling
7048755299 [Http] Refactoring QueryString
- Adds a trailing equal sign for empty values by default (e.g. ?acl=)
- Set blank values (e.g. ?acl) by setting the value to QueryString::BLANK
- Combined URL encoding into a single option rather than separate
  settings for fields and values
- Changed isEncodingValues() and isEncodingFields() to isUrlEncoding()
- Changed setEncodeValues(bool) and setEncodeFields(bool) to useUrlEncoding(bool)
- Changed the aggregation functions of QueryString to be static methods
- Can now use fromString() with querystrings that have a leading ?
2012-07-08 17:17:07 -07:00
Ryan Weaver
3201541783 Fix for a situation where a "blank" (e.g. null, false) value for a query string parameter resulted in a missing "=":
Suppose that we set the following data on a QueryString object:

array(
    'foo' => null,
    'bar' => 'test',
)

The query string before and after this change would be:

BEFORE: ?foo&bar=test
AFTER:  ?foo=&bar=test

The importance is that before the lack of "=" resulted made it look like there was only a single parameter called "foo&bar" with a value of "test" (i.e. the bar parameter is joined with foo).
2012-07-08 13:32:45 -05:00
Michael Dowling
feb5ac5a0c [Common] Improving the batch interfaces to better separate divisors from
transfers.
BC: Removing count from batch and replacing it with isEmpty()
Batch divisors can now return iterators or arrays
2012-07-02 13:40:17 -07:00
Michael Dowling
142e2460f2 [BC] Moving things around for subtree splits.
Moving Inflection into Common. Moving Guzzle\Http\Parser to Guzzle\Parser.
Adding composer.json files for each subtree split
Fixing failing curl test
2012-06-29 16:13:43 -07:00
Michael Dowling
569cdb1c37 [Http] Cleaning up the CachePlugin
Not caching requests other than GET and HEAD by default. Adding the ability to
use a custom filter strategy to determine if a request can be cached. Closes #91
2012-06-29 12:54:24 -07:00
Dave Marshall
bad3b1a525 Overwrite cookies that have changed 2012-06-29 12:11:47 +01:00
Michael Dowling
ce60434f54 Allowing for deeply nested URI template composite expansion. Closes #90. 2012-06-28 18:32:25 -07:00
Michael Dowling
7911c8521a [Http] Using header glue when sending requests. Allowing the retrieval of header objects. Adding a method for the retrieval of header lines. 2012-06-28 10:16:40 -07:00
Michael Dowling
95bd5309ad Updating version for UA string. Fixing test that was not mocked correctly. Updating build process. 2012-06-26 18:58:44 -07:00
Michael Dowling
d7501355eb [Http] Tolerating colons in response start-lines. Cleaning up parsing. 2012-06-25 12:55:03 -07:00
Michael Dowling
883309d8e8 [Http] Throwing an exception if a message-header is received before a start-line. Using static array for normalizing received response headers. 2012-06-25 11:45:36 -07:00
Michael Dowling
c824bf7b83 [Common] Cleaning up BatchClosureTransfer 2012-06-25 10:12:53 -07:00
Michael Dowling
3c4543868a [Service] Adding the ability to set POST fields and files in service
descriptions.

Closes #76
2012-06-24 12:15:26 -07:00
Michael Dowling
e914e7a4e7 [Http] Debug curl options are no longer enabled by default
Set 'debug' to true on a request's curl options to enable debug verbose
output.
Closes #83
2012-06-24 11:55:44 -07:00
Michael Dowling
a17aff3abc Renaming ServiceBuilderPlugin to PluginCollectionPlugin. Cleaning up. 2012-06-24 11:07:31 -07:00
Michael Dowling
d9654d8c7c Merge remote-tracking branch 'gimler/service_plugin' 2012-06-24 10:55:05 -07:00
Michael Dowling
7127568338 [Service] Not inflecting magic method command names in the magic method, but rather passing that responsibility on to command factories. The service description command factory will now first check for an exact match of a command name followed by an inflected snake_case match if an inflector was passed into the constructor of the factory. 2012-06-22 10:32:48 -07:00
Michael Dowling
653db131c4 [Service] Adding a more helpful error message when attempting to use an abstract factory with an unsupported file extension. 2012-06-20 18:42:45 -07:00