catch issue where the connection was closed before reply

This commit is contained in:
HorizonCode 2023-05-12 13:09:09 +02:00
parent 5626782178
commit 1c085b9ec5

4
mod.ts
View File

@ -102,6 +102,7 @@ export class HTTPServer {
} }
private async handleHttp(conn: Deno.Conn) { private async handleHttp(conn: Deno.Conn) {
try {
const httpConn = Deno.serveHttp(conn); const httpConn = Deno.serveHttp(conn);
for await (const requestEvent of httpConn) { for await (const requestEvent of httpConn) {
const filepath = decodeURIComponent( const filepath = decodeURIComponent(
@ -242,6 +243,9 @@ export class HTTPServer {
} }
this.handleNotFound(routeRequest, routeReply, requestEvent); this.handleNotFound(routeRequest, routeReply, requestEvent);
} }
} catch (_err) {
// Ignore http that where closed before reply was sent
}
} }
close() { close() {