avoid chunked here

This commit is contained in:
Ciro Spaciari
2025-09-04 16:36:54 -07:00
parent 3a10be5191
commit 4f0d126d75
2 changed files with 3 additions and 3 deletions

View File

@@ -663,7 +663,7 @@ pub fn buildRequest(this: *HTTPClient, body_len: usize) picohttp.Request {
if (body_len > 0 or this.method.hasRequestBody()) {
if (this.flags.is_streaming_request_body) {
if (add_transfer_encoding) {
if (add_transfer_encoding and this.flags.upgrade_state == .none) {
request_headers_buf[header_count] = chunked_encoded_header;
header_count += 1;
}

View File

@@ -323,8 +323,8 @@ fn drainEvents(this: *@This()) void {
if (client.state.original_request_body == .stream) {
var stream = &client.state.original_request_body.stream;
stream.ended = ended;
if (messageType == .endChunked) {
// only send the 0-length chunk if the request body is chunked
if (messageType == .endChunked and client.flags.upgrade_state != .upgraded) {
// only send the 0-length chunk if the request body is chunked and not upgraded
client.writeToStream(is_tls, socket, bun.http.end_of_chunked_http1_1_encoding_response_body);
} else {
client.flushStream(is_tls, socket);