Welcome! Log In Create A New Profile

Advanced

[njs] HTTP: fixed handling of 0 length request body.

Dmitry Volyntsev
May 20, 2024 07:48PM
details: https://hg.nginx.org/njs/rev/286dbef3c0b2
branches:
changeset: 2331:286dbef3c0b2
user: Dmitry Volyntsev <xeioex@nginx.com>
date: Mon May 20 16:44:10 2024 -0700
description:
HTTP: fixed handling of 0 length request body.

Previously, when r.requestBuffer was passed as a body argument to
ngx.fetch() or r.subrequest() then exception was thrown "Error: invalid
Request body" when the request body had 0 length.

diffstat:

src/njs_vm.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)

diffs (16 lines):

diff -r 8851a78723dc -r 286dbef3c0b2 src/njs_vm.c
--- a/src/njs_vm.c Fri May 17 21:54:50 2024 -0700
+++ b/src/njs_vm.c Mon May 20 16:44:10 2024 -0700
@@ -1602,6 +1602,12 @@ njs_vm_value_to_bytes(njs_vm_t *vm, njs_
}

if (njs_slow_path(njs_is_detached_buffer(buffer))) {
+ if (length == 0) {
+ dst->length = 0;
+ dst->start = NULL;
+ return NJS_OK;
+ }
+
njs_type_error(vm, "detached buffer");
return NJS_ERROR;
}
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[njs] HTTP: fixed handling of 0 length request body.

Dmitry Volyntsev 176 May 20, 2024 07:48PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 183
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready