Skip to content

Commit

Permalink
Merge pull request #87 from cspray/fix-op-default-ua
Browse files Browse the repository at this point in the history
Fix client setOption, update README for default UA
  • Loading branch information
kelunik committed Sep 11, 2015
2 parents 559df2d + 452a326 commit f8da609
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ A brief summary of the available options follows.
| OP_VERBOSITY | A bitmask of client constants controlling raw message output to the console. |
| OP_COMBINE_COOKIES | A boolean (default: `true`) controlling whether or not cookie headers are combined into a single header when sending requests. |
| OP_CRYPTO | An array controlling TLS encryption options. |
| OP_DEFAULT_USER_AGENT | A string set for each request's User-Agent if a UA has not already been provided. |


### Miscellaneous
Expand Down
5 changes: 4 additions & 1 deletion lib/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ private function parseSocketData(RequestCycle $cycle) {
} else {
$this->assignParsedResponse($cycle, $parsedResponseArr);
}

if ($cycle->parser->getBuffer()) {
$this->reactor->immediately(function() use ($cycle) {
$this->parseSocketData($cycle);
Expand Down Expand Up @@ -992,6 +992,9 @@ public function setOption($option, $value) {
case self::OP_CRYPTO:
$this->options[self::OP_CRYPTO] = (array) $value;
break;
case self::OP_DEFAULT_USER_AGENT:
$this->options[self::OP_DEFAULT_USER_AGENT] = (string) $value;
break;
default:
throw new \DomainException(
sprintf("Unknown option: %s", $option)
Expand Down

0 comments on commit f8da609

Please sign in to comment.