Skip to content

Commit

Permalink
Merge branch '1.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul M. Jones committed Sep 10, 2013
2 parents 90146c0 + b5f6bbb commit 6d21934
Show file tree
Hide file tree
Showing 22 changed files with 64 additions and 55 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
@@ -1,6 +1,10 @@
language: php
php:
- 5.4
- 5.5
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq apache2
before_script:
- cd tests
script: phpunit
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,4 +1,4 @@
Copyright (c) 2012, The Aura Project for PHP
Copyright (c) 2011-2013, Aura for PHP
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 2 additions & 0 deletions README.md
@@ -1,6 +1,8 @@
Aura HTTP
=========

[![Build Status](https://travis-ci.org/auraphp/Aura.Http.png)](https://travis-ci.org/auraphp/Aura.Http)

The Aura HTTP package provides objects to build and send HTTP requests and
responses, including `multipart/form-data` requests, with streaming of file
resources when using the `curl` adapter.
Expand Down
3 changes: 2 additions & 1 deletion meta/authors.csv
@@ -1,4 +1,5 @@
lead,pmjones,Paul M. Jones,pmjones88@gmail.com,http://paul-m-jones.com
developer,galactic-void,Galactic Void,galacticvoid+git@gmail.com,https://github.com/galactic-void
developer,harikt,Hari KT,kthari85@gmail.com,http://harikt.com,
developer,harikt,Hari KT,kthari85@gmail.com,http://harikt.com
contributor,pborrelli,Pascal Borrelli,pascal@borreli.com,
developer,brandonsavage,Brandon Savage,brandon@brandonsavage.net,http://brandonsavage.net
6 changes: 4 additions & 2 deletions meta/changes.txt
@@ -1,3 +1,5 @@
- [CHG] Varios typo fixes by HariKT and Pascal Borrelli.
- [FIX] Transport now adds a 'Close' header; this resolves an Apache Bench
benchmarking issue and brings the library up to HTTP spec.

- [FIX] In Adapter\Stream, send properly-formed Cookie header.
- [DOC] Added PHP 5.5 to Travis build, Travis now installs Apache for
localhost testing, updated docblocks.
2 changes: 1 addition & 1 deletion src/Aura/Http/Adapter/AdapterInterface.php
Expand Up @@ -30,7 +30,7 @@ interface AdapterInterface
*
* @param Options $options The transport options.
*
* @return Aura\Http\Response\Stack A stack of responses.
* @return Response\Stack A stack of responses.
*
*/
public function exec(Request $request, Options $options);
Expand Down
2 changes: 1 addition & 1 deletion src/Aura/Http/Adapter/Curl.php
Expand Up @@ -107,7 +107,7 @@ public function __construct(StackBuilder $stack_builder)
*
* @param Options $options The transport options.
*
* @return Aura\Http\Response\Message\Stack
* @return Response\Message\Stack
*
* @todo Implement an exception for timeouts.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Aura/Http/Cookie.php
Expand Up @@ -99,7 +99,7 @@ class Cookie
*
* @param bool $secure Use SSL only?
*
* @param type $httponly Use HTTP only?
* @param bool $httponly Use HTTP only?
*
*/
public function __construct(
Expand Down
2 changes: 1 addition & 1 deletion src/Aura/Http/Cookie/Factory.php
Expand Up @@ -46,7 +46,7 @@ class Factory
* @param array $params An array of key-value pairs corresponding to
* the remaining Cookies constructor params.
*
* @return Aura\Http\Cookie
* @return Cookie
*
*/
public function newInstance($name = null, array $params = array())
Expand Down
2 changes: 1 addition & 1 deletion src/Aura/Http/Header/Factory.php
Expand Up @@ -30,7 +30,7 @@ class Factory
*
* @param string $value Header value.
*
* @return Aura\Http\Header
* @return Header
*
*/
public function newInstance($label, $value)
Expand Down
8 changes: 4 additions & 4 deletions src/Aura/Http/Manager.php
Expand Up @@ -75,7 +75,7 @@ public function __get($key)
*
* Return object of type Aura\Http\Message\Request
*
* @return Aura\Http\Message\Request
* @return Message\Request
*
*/
public function newRequest()
Expand All @@ -85,9 +85,9 @@ public function newRequest()

/**
*
* Return Aura\Http\Message\Response object
* Returns a new Message\Response object
*
* @return Aura\Http\Message\Response
* @return Message\Response
*
*/
public function newResponse()
Expand All @@ -101,7 +101,7 @@ public function newResponse()
*
* @param Message $message
*
* @return type
* @return Message\Stack
*
*/
public function send(Message $message)
Expand Down
2 changes: 1 addition & 1 deletion src/Aura/Http/Message.php
Expand Up @@ -118,7 +118,7 @@ public function getCookies()
*
* Sets the content for the message.
*
* @param mixed The content for the message.
* @param mixed $content The content for the message.
*
* @return void
*
Expand Down
12 changes: 6 additions & 6 deletions src/Aura/Http/Message/Request.php
Expand Up @@ -112,7 +112,7 @@ class Request extends Message
*
* @param string $url The URL for the request.
*
* @return Aura\Http\Request This object.
* @return self
*
*/
public function setUrl($url)
Expand All @@ -131,7 +131,7 @@ public function setUrl($url)
*
* @param string $method The method to use for the request.
*
* @return Aura\Http\Request This object.
* @return self
*
* @throws Aura\Http\Exception\UnknownMethod
*
Expand All @@ -154,7 +154,7 @@ public function setMethod($method)
*
* @param string $auth A `Request::AUTH_*` constant.
*
* @return Aura\Http\Request This object.
* @return self
*
*/
public function setAuth($auth)
Expand Down Expand Up @@ -184,7 +184,7 @@ public function setAuth($auth)
*
* @param string $username The username.
*
* @return Aura\Http\Request This object.
* @return self
*
*/
public function setUsername($username)
Expand All @@ -205,7 +205,7 @@ public function setUsername($username)
*
* @param string $password The password.
*
* @return Aura\Http\Request This object.
* @return self
*
*/
public function setPassword($password)
Expand Down Expand Up @@ -233,7 +233,7 @@ public function getCredentials()
*
* @param resource $stream The stream resource to save to.
*
* @return Aura\Http\Request This object.
* @return self
*
*/
public function setSaveToStream($stream)
Expand Down
4 changes: 3 additions & 1 deletion src/Aura/Http/Multipart/Part.php
Expand Up @@ -55,7 +55,9 @@ public function __construct(Headers $headers)
*
* Sets the content for this part.
*
* @param string
* @param string $content
*
* @return void
*
*/
public function setContent($content)
Expand Down
4 changes: 2 additions & 2 deletions src/Aura/Http/PhpFunc.php
Expand Up @@ -56,9 +56,9 @@ public function output($text)
*
* Override for `headers_sent()` since it needs parameter references.
*
* @param string &$file The file where headers were sent.
* @param string $file The file where headers were sent.
*
* @param int &$line The line in that file where headers were sent.
* @param int $line The line in that file where headers were sent.
*
* @return bool
*
Expand Down
5 changes: 5 additions & 0 deletions src/Aura/Http/Transport.php
Expand Up @@ -191,6 +191,11 @@ public function sendResponse(Response $response)
$cookie->getHttpOnly()
);
}

// Include a "close" header. Required per rfc2616 14.10
// To-Do: make this configurable for apps that support persistent
// connections.
$this->phpfunc->header('Connection: close');

// send the content
$content = $response->getContent();
Expand Down
26 changes: 13 additions & 13 deletions src/Aura/Http/Transport/Options.php
Expand Up @@ -145,9 +145,9 @@ public function __get($key)
*
* Sets the cookie jar property.
*
* @param string
* @param string $cookie_jar The file where cookie jar storage is located.
*
* @return Options This object.
* @return self
*
*/
public function setCookieJar($cookie_jar)
Expand All @@ -162,7 +162,7 @@ public function setCookieJar($cookie_jar)
*
* @param int $max_redirects The max number of redirects to allow.
*
* @return Options This object.
* @return self
*
*/
public function setMaxRedirects($max_redirects)
Expand All @@ -177,7 +177,7 @@ public function setMaxRedirects($max_redirects)
*
* @param float $timeout The timeout in seconds.
*
* @return Options This object.
* @return self
*
*/
public function setTimeout($timeout)
Expand All @@ -192,7 +192,7 @@ public function setTimeout($timeout)
*
* @param string $proxy The hostname for the proxy server.
*
* @return Options This object.
* @return self
*
*/
public function setProxy($proxy)
Expand All @@ -207,7 +207,7 @@ public function setProxy($proxy)
*
* @param int $proxy_port The proxy port number.
*
* @return Options This object.
* @return self
*
*/
public function setProxyPort($proxy_port)
Expand Down Expand Up @@ -238,7 +238,7 @@ public function getProxyHostAndPort()
*
* @param string $proxy_username The proxy username.
*
* @return Options This object.
* @return self
*
*/
public function setProxyUsername($proxy_username)
Expand All @@ -253,7 +253,7 @@ public function setProxyUsername($proxy_username)
*
* @param string $proxy_password The proxy password.
*
* @return Options This object.
* @return self
*
*/
public function setProxyPassword($proxy_password)
Expand Down Expand Up @@ -282,7 +282,7 @@ public function getProxyCredentials()
*
* @param bool $flag True or false.
*
* @return Options This object.
* @return self
*
*/
public function setSslVerifyPeer($flag)
Expand All @@ -299,7 +299,7 @@ public function setSslVerifyPeer($flag)
*
* @param string $val The CA file.
*
* @return Options This object.
* @return self
*
*/
public function setSslCafile($val)
Expand All @@ -317,7 +317,7 @@ public function setSslCafile($val)
*
* @param string $val The CA path.
*
* @return Options This object.
* @return self
*
*/
public function setSslCapath($val)
Expand All @@ -334,7 +334,7 @@ public function setSslCapath($val)
*
* @param string $val The local certificate file path.
*
* @return Options This object.
* @return self
*
*/
public function setSslLocalCert($val)
Expand All @@ -349,7 +349,7 @@ public function setSslLocalCert($val)
*
* @param string $val The passphrase.
*
* @return Options This object.
* @return self
*
*/
public function setSslPassphrase($val)
Expand Down
13 changes: 9 additions & 4 deletions src/Aura/Http/Transport/TransportInterface.php
Expand Up @@ -15,6 +15,7 @@

/**
*
* Transports HTTP requests and responses.
*
* @package Aura.Http
*
Expand All @@ -23,18 +24,22 @@ interface TransportInterface
{
/**
*
* Aura\Http\Message\Request object
* Sends an HTTP request and gets back a response stack.
*
* @param Request $request Aura\Http\Message\Response
* @param Request $request An HTTP request message.
*
* @return Response An HTTP response message stack.
*
*/
public function sendRequest(Request $request);

/**
*
* Aura\Http\Message\Response object
* Sends an HTTP response.
*
* @param Response $response Response
*
* @param Response $response Aura\Http\Message\Response
* @return void
*
*/
public function sendResponse(Response $response);
Expand Down
2 changes: 1 addition & 1 deletion tests/Aura/Http/Integration/AbstractTest.php
Expand Up @@ -12,7 +12,7 @@ abstract class AbstractTest extends \PHPUnit_Framework_TestCase

protected function setUp()
{
$this->url = $GLOBALS[__CLASS__]['url'];
$this->url = 'http://localhost';
}

// yes, i know it should not touch the network. let me know if you
Expand Down
2 changes: 2 additions & 0 deletions tests/Aura/Http/TransportTest.php
Expand Up @@ -87,6 +87,7 @@ public function testSendResponse()
0 => 'HTTP/1.1 200 OK',
1 => 'Foo: hello world',
2 => 'Bar: hello world 2',
3 => 'Connection: close',
];
$this->assertSame($expect, $actual);

Expand Down Expand Up @@ -121,6 +122,7 @@ public function testSendResponse_cgi()
0 => 'Status: 200 OK',
1 => 'Foo: hello world',
2 => 'Bar: hello world 2',
3 => 'Connection: close',
];
$this->assertSame($expect, $actual);

Expand Down

0 comments on commit 6d21934

Please sign in to comment.