Skip to content

Commit

Permalink
Allow amphp/http-server ^2
Browse files Browse the repository at this point in the history
  • Loading branch information
trowski committed Aug 21, 2019
1 parent b99add5 commit c37a000
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -31,7 +31,7 @@
"amphp/amp": "^2.0.3",
"amphp/byte-stream": "^1.2",
"amphp/file": "^0.3",
"amphp/http-server": "^1 || ^0.8",
"amphp/http-server": "^2 || ^1 || ^0.8",
"amphp/http": "^1",
"cash/lrucache": "^1"
},
Expand Down
2 changes: 1 addition & 1 deletion src/DocumentRoot.php
Expand Up @@ -416,7 +416,7 @@ private function makeCommonHeaders($fileInfo): array
$preCheck = $this->expiresPeriod - $postCheck;
$value = ", post-check={$postCheck}, pre-check={$preCheck}, max-age={$this->expiresPeriod}";
$headers["Cache-Control"] .= $value;
} else if ($canCache) {
} elseif ($canCache) {
$expiry = $this->now + $this->expiresPeriod;
$headers["Cache-Control"] .= ", max-age={$this->expiresPeriod}";
$headers["Expires"] = \gmdate('D, d M Y H:i:s', $expiry) . " GMT";
Expand Down
2 changes: 1 addition & 1 deletion test/DocumentRootTest.php
Expand Up @@ -80,7 +80,7 @@ public function setUp()

public function createServer(Options $options = null): Server
{
$socket = $this->createMock(Socket\Server::class);
$socket = Socket\listen('127.0.0.1:0');

$server = new Server(
[$socket],
Expand Down
4 changes: 2 additions & 2 deletions test/FuzzingTest.php
Expand Up @@ -46,8 +46,8 @@ public function testDocumentRootBreakout(string $input)
$server = new Server([self::$socket], new DocumentRoot(self::$documentRoot), new NullLogger);
Promise\wait($server->start());

/** @var Socket\ClientSocket $client */
$client = Promise\wait(Socket\connect(self::$socket->getAddress()));
/** @var Socket\ResourceSocket $client */
$client = Promise\wait(Socket\connect((string) self::$socket->getAddress()));
Promise\wait($client->write("GET {$input} HTTP/1.1\r\nConnection: close\r\nHost: localhost\r\n\r\n"));

$response = Promise\wait((new Payload($client))->buffer());
Expand Down

0 comments on commit c37a000

Please sign in to comment.