nategood/httpful — pull request #34 by nickl- (2012-06-17 08:38:54+00:00)
Title: Hard to find emprovements

Wow you've been busy! =)

I took this down a few weeks ago but only got around to checking it out now. Read through Response class and saw body, raw_body, headers and alarms went off NOOOO where's raw_header??? ...and then I saw $this->raw_headers were being populated in the constructor and it was only the property reference that was missing.

I quickly scanned my source and saw ahhh I can help with composer package etc, sure there are things I can do but when I came back to fork I realized that I was going to have to look deeper if I wanted to help. It was not easy but I think I found a few items that will be useful.

The commit messages will have additional comments but these should be among them.
* Added the raw_headers property reference to response
* Compose request header and added raw_header to Request object.
* Fixed response has errors and added more comments for clarity.
* Fixed header parsing to allow the minimum (status line only) and also cater for the actual CRLF ended headers as per RFC2616.
* Added the perfect test Accept: header for all Acceptable scenarios see @b78e9e82cd9614fbe137c01bde9439c4e16ca323 for details.
* Added default User-Agent header.
* `User-Agent: HttpFul/1.0` you might want to tweak the name and version number.
* `(cURL/?.?.? (host) if all else fails but it should be able to find the curl version from uhm curl_version() I guess.
* Then we get PHP/5.3.8 for example which should get populated from the core provided PHP_VERSION constant.
* Then we check if we have `$_SERVER['SERVER_SOFTWARE']` and remove PHP from there should it exist.
* If SERVER_SOFTWARE is unavailable we are more than likely using CLI so check for `TERM_PROGRAM` and `TERM_PROGRAM_VERSION` from $_SERVER.
* Finally add the HTTP_USER_AGENT string if it exists and close the support software section with ')' to wrap this up as the perfect User-Agent string to verify any issues we might have.
* To bypass this "default" operation simply add a User-Agent to the request headers even a blank User-Agent is sufficient and more than simple enough to produce me thinks.
* Completed test units for all the additions and a few extra ones see @a23e8c301dbe501ccb934c0ff7e690a334bd81b4 and @1741fd8427f8015c391023fcca844fa0641cc6b7 for details.
* Added phpunit coverage reporting and helped phpunit auto locate the tests a bit easier.

I like what you've done to this implementation but maybe a tad too user friendly for my liking, is there such a thing as too user friendly?.. not that this should demotivate you there definitely is a place for this. I might steel a few concepts if you don't mind =)

The huge focus on the request headers was different and it works quite intuitively but I don't see how this is an improvement on say:
```php
header['X-My-Awesome-Header'] = 'this works fine';
```

Maybe this is where my gripe with the user friendliness comes in, I want to know that's my header and I want to set it as I expect it without the camelCasing and "with" parsing and all the other bells getting in the way. Maybe if I sleep over it I will see things differently... we'll see.

Keep up the good work!