more tests

This commit is contained in:
cirospaciari
2023-09-15 22:30:25 -07:00
parent 5544e919fc
commit 22160d8926

View File

@@ -751,10 +751,14 @@ pub const HTTPThread = struct {
if (socket_async_http_abort_tracker.fetchSwapRemove(http.async_http_id)) |socket_ptr| {
if (http.client.isHTTPS()) {
const socket = uws.SocketTLS.from(socket_ptr.value);
socket.shutdown();
if(socket.isEstablished() and !socket.isClosed() and !socket.isShutdown()) {
socket.shutdownRead();
}
} else {
const socket = uws.SocketTCP.from(socket_ptr.value);
socket.shutdown();
if(socket.isEstablished() and !socket.isClosed() and !socket.isShutdown()) {
socket.shutdownRead();
}
}
}
}
@@ -1068,7 +1072,7 @@ pub fn onClose(
socket: NewHTTPContext(is_ssl).HTTPSocket,
) void {
log("Closed {s}\n", .{client.url.href});
const in_progress = client.state.stage != .done and client.state.stage != .fail;
if (in_progress) {
@@ -1099,7 +1103,7 @@ pub fn onClose(
}
if (in_progress) {
client.fail(error.ConnectionClosed);
client.closeAndFail(error.ConnectionClosed, is_ssl, socket);
}
}
pub fn onTimeout(
@@ -1152,7 +1156,7 @@ pub fn onEnd(
return;
}
}
client.fail(error.ConnectionClosed);
client.closeAndFail(error.ConnectionClosed);
}
pub inline fn getAllocator() std.mem.Allocator {
@@ -1558,6 +1562,9 @@ pub fn isKeepAlivePossible(this: *HTTPClient) bool {
if (this.http_proxy != null and this.url.isHTTPS()) {
return false;
}
if (this.signals.get(.aborted)) {
return false;
}
return !this.disable_keepalive;
}
return false;
@@ -1864,6 +1871,9 @@ pub const AsyncHTTP = struct {
if (this.http_proxy != null and this.url.isHTTPS()) {
return false;
}
if (this.signals.get(.aborted)) {
return false;
}
// check state
if (this.state.allow_keepalive and !this.disable_keepalive) return true;
}