public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Matthias Heiserer <m.heiserer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH http-server 2/2] fix multipart upload: header order
Date: Tue,  6 Dec 2022 16:16:29 +0100	[thread overview]
Message-ID: <20221206151629.86019-2-m.heiserer@proxmox.com> (raw)
In-Reply-To: <20221206151629.86019-1-m.heiserer@proxmox.com>

When the Content-Disposition header wasn't the first, i.e. upload of
```
--XVH95dt1-A3J8mWiLCmHCW4roSC7-gBntjATBy--
Content-Type: text/plain; charset=ISO-8859-1
Content-Disposition: form-data; name="content"
```
would fail. These headers now also get ignored, as we don't use them.

Fixed upload was tested using                                                                                                                                                              │
* Curl                                                                                                                                                                                     │
* GUI                                                                                                                                                                                      │
* Apache HttpClient 5

Signed-off-by: Matthias Heiserer <m.heiserer@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 db89ff2..c26a439 100644
--- a/src/PVE/APIServer/AnyEvent.pm
+++ b/src/PVE/APIServer/AnyEvent.pm
@@ -1209,7 +1209,7 @@ sub file_upload_multipart {
 
 	my $extract_form_disposition = sub {
 	    my ($name) = @_;
-	    if ($hdl->{rbuf} =~ s/^${delim_re}Content-Disposition: (.*?); name="$name"(.*)$/$2/s) {
+	    if ($hdl->{rbuf} =~ s/^${delim_re}.*?Content-Disposition: (.*?); name="$name"(.*)$/$2/s) {
 		assert_form_disposition($1);
 		$remove_until_data->($hdl);
 		$hdl->{rbuf} =~ s/^(.*?)(${delim_re})/$2/s;
-- 
2.30.2





  reply	other threads:[~2022-12-06 15:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-06 15:16 [pve-devel] [PATCH http-server 1/2] fix multipart upload: ignore additional headers Matthias Heiserer
2022-12-06 15:16 ` Matthias Heiserer [this message]
2022-12-07 10:52 ` Matthias Heiserer

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=20221206151629.86019-2-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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal