[pve-devel] [PATCH v2 http-server 2/2] multipart upload: don't require trailing newline

Matthias Heiserer m.heiserer at proxmox.com
Mon Dec 12 14:14:45 CET 2022


RFC 152 mandates that data after the final boundary
must be ignored. Some software (e.g. postman) sends
their request without a trailing newline, which resulted
in failed uploads.

Signed-off-by: Matthias Heiserer <m.heiserer at proxmox.com>
---
 src/PVE/APIServer/AnyEvent.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/APIServer/AnyEvent.pm b/src/PVE/APIServer/AnyEvent.pm
index 63b61a9..5d210d0 100644
--- a/src/PVE/APIServer/AnyEvent.pm
+++ b/src/PVE/APIServer/AnyEvent.pm
@@ -1193,7 +1193,7 @@ sub file_upload_multipart {
 
 	my $newline_re = qr/\015?\012/;
 	my $delim_re = qr/--\Q$boundary\E${newline_re}/;
-	my $close_delim_re = qr/--\Q$boundary\E--${newline_re}/;
+	my $close_delim_re = qr/--\Q$boundary\E--/;
 
 	# Phase 0 - preserve boundary, but remove everything before
 	if ($rstate->{phase} == 0 && $hdl->{rbuf} =~ s/^.*?($delim_re)/$1/s) {
-- 
2.30.2






More information about the pve-devel mailing list