Skip to content

Commit

Permalink
Rename to ProtocolException
Browse files Browse the repository at this point in the history
Prevent from misunderstanding.
  • Loading branch information
twose committed Oct 28, 2022
1 parent 8de7e8c commit 6f38420
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions http_server/mixed.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Swow\Coroutine;
use Swow\CoroutineException;
use Swow\Errno;
use Swow\Http\Message\HttpException;
use Swow\Http\Protocol\ProtocolException as HttpProtocolException;
use Swow\Http\Status as HttpStatus;
use Swow\Psr7\Client\Client;
use Swow\Psr7\Message\UpgradeType;
Expand Down Expand Up @@ -78,7 +78,7 @@
break;
}
if (($upgradeType & UpgradeType::UPGRADE_TYPE_WEBSOCKET) === 0) {
throw new HttpException(HttpStatus::BAD_REQUEST, 'Unsupported Upgrade Type');
throw new HttpProtocolException(HttpStatus::BAD_REQUEST, 'Unsupported Upgrade Type');
}
$connection->upgradeToWebSocket($request);
$request = null;
Expand All @@ -105,8 +105,9 @@
default:
$connection->error(HttpStatus::NOT_FOUND);
}
} catch (HttpException $exception) {
} catch (HttpProtocolException $exception) {
$connection->error($exception->getCode(), $exception->getMessage());
break;
}
if (!$request || !Psr7::detectShouldKeepAlive($request)) {
break;
Expand Down

0 comments on commit 6f38420

Please sign in to comment.