Skip to content

Commit

Permalink
Merge remote-tracking branch 'source/master'
Browse files Browse the repository at this point in the history
* source/master:
  Removed a blank as pointed out in this comment: 10af1f5#commitcomment-11894795
  Added 0.4.1
  Use new Guzzle PSR7 parser
  Test against PHP7
  Adding Code Climate badge to readme

# Conflicts:
#	src/RequestHeaderParser.php
  • Loading branch information
onigoetz committed Jul 28, 2015
2 parents f696c9c + 8602944 commit 8213ff5
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 16 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ php:
- 5.4
- 5.5
- 5.6
- 7
- hhvm
- hhvm-nightly

matrix:
allow_failures:
- php: 7
- php: hhvm
- php: hhvm-nightly

before_script:
- composer install --dev --prefer-source
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 0.4.1 (2014-05-21)
* Replaced guzzle/parser with guzzlehttp/psr7 by @cboden
* FIX Continue Header by @iannsp
* Missing type hint by @marenzo

## 0.4.0 (2014-02-02)

* BC break: Bump minimum PHP version to PHP 5.4, remove 5.3 specific hacks
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Http Component

[![Build Status](https://secure.travis-ci.org/reactphp/http.png?branch=master)](http://travis-ci.org/reactphp/http)
[![Build Status](https://secure.travis-ci.org/reactphp/http.png?branch=master)](http://travis-ci.org/reactphp/http) [![Code Climate](https://codeclimate.com/github/reactphp/http/badges/gpa.svg)](https://codeclimate.com/github/reactphp/http)

Library for building an evented http server.

Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"license": "MIT",
"require": {
"php": ">=5.4.0",
"guzzle/parser": "~3.0",
"react/socket": "0.4.*",
"react/stream": "0.4.*",
"evenement/evenement": "~2.0"
"guzzlehttp/psr7": "^1.0",
"react/socket": "^0.4",
"react/stream": "^0.4",
"evenement/evenement": "^2.0"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function getMethod()

public function getPath()
{
return $this->url['path'];
return $this->url->getPath();
}

public function getUrl()
Expand Down
27 changes: 17 additions & 10 deletions src/RequestParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace React\Http;

use Evenement\EventEmitter;
use Guzzle\Parser\Message\MessageParser;
use GuzzleHttp\Psr7 as g7;

/**
* @event headers
Expand Down Expand Up @@ -91,20 +91,27 @@ protected function headerSizeExceeded()

public function parseHeaders($data)
{
$parser = new MessageParser();
$parsed = $parser->parseRequest($data);
$psrRequest = g7\parse_request($data);

$parsedQuery = array();
if ($parsed['request_url']['query']) {
parse_str($parsed['request_url']['query'], $parsedQuery);
$parsedQuery = [];
$queryString = $psrRequest->getUri()->getQuery();
if ($queryString) {
parse_str($queryString, $parsedQuery);
}

$headers = $psrRequest->getHeaders();
array_walk($headers, function(&$val) {
if (1 === count($val)) {
$val = $val[0];
}
});

return new Request(
$parsed['method'],
$parsed['request_url'],
$psrRequest->getMethod(),
$psrRequest->getUri(),
$parsedQuery,
$parsed['version'],
$parsed['headers']
$psrRequest->getProtocolVersion(),
$headers
);
}

Expand Down

0 comments on commit 8213ff5

Please sign in to comment.