Skip to content

Commit

Permalink
core: Ignore Tus-Resumable header in OPTIONS request (#295)
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitpokhrel committed Oct 31, 2020
1 parent 1244385 commit 85775de
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 68 deletions.
3 changes: 2 additions & 1 deletion src/Tus/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use TusPhp\Exception\ConnectionException;
use TusPhp\Exception\OutOfRangeException;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\Request as HttpRequest;
use Symfony\Component\HttpFoundation\Response as HttpResponse;

class Server extends AbstractTus
Expand Down Expand Up @@ -264,7 +265,7 @@ public function serve()

$clientVersion = $this->getRequest()->header('Tus-Resumable');

if ($clientVersion && $clientVersion !== self::TUS_PROTOCOL_VERSION) {
if (HttpRequest::METHOD_OPTIONS !== $requestMethod && $clientVersion && self::TUS_PROTOCOL_VERSION !== $clientVersion) {
return $this->response->send(null, HttpResponse::HTTP_PRECONDITION_FAILED, [
'Tus-Version' => self::TUS_PROTOCOL_VERSION,
]);
Expand Down
Loading

0 comments on commit 85775de

Please sign in to comment.