From: Matthias Heiserer <m.heiserer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH v3 http-server 3/3] multipart upload: don't require trailing newline
Date: Mon, 12 Dec 2022 16:07:56 +0100 [thread overview]
Message-ID: <20221212150756.221191-3-m.heiserer@proxmox.com> (raw)
In-Reply-To: <20221212150756.221191-1-m.heiserer@proxmox.com>
Allow upload without trailing newline.
This is not compliant with RFC 1521.
RFC 1521 mandates that the close-delimiter ends
in a newline:
'close-delimiter := "--" boundary "--" CRLF'
However, some software (e.g. postman) sends
their request without a trailing newline, which resulted
in failing uploads.
Signed-off-by: Matthias Heiserer <m.heiserer@proxmox.com>
---
Changes from v2:
Reword commit message as I misunderstood the RFC
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 2f8718f..3cd77fa 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
next prev parent reply other threads:[~2022-12-12 15:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-12 15:07 [pve-devel] [PATCH v3 http-server 1/3] multipart upload: fix upload of files starting with newlines Matthias Heiserer
2022-12-12 15:07 ` [pve-devel] [PATCH v3 http-server 2/3] fix multipart upload: ignore additional headers Matthias Heiserer
2022-12-12 15:07 ` Matthias Heiserer [this message]
2022-12-12 16:05 ` [pve-devel] [PATCH v3 http-server 1/3] multipart upload: fix upload of files starting with newlines Daniel Tschlatscher
2022-12-13 12:25 ` [pve-devel] applied-series: " Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221212150756.221191-3-m.heiserer@proxmox.com \
--to=m.heiserer@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox