From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH http-server 1/1] http-server: let the api call decide the content-encoding
Date: Wed, 24 Nov 2021 15:47:47 +0100 [thread overview]
Message-ID: <20211124144748.68687-3-d.csapak@proxmox.com> (raw)
In-Reply-To: <20211124144748.68687-1-d.csapak@proxmox.com>
this is useful if we want to pipe the output of a program e.g. through gzip
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
src/PVE/APIServer/AnyEvent.pm | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/PVE/APIServer/AnyEvent.pm b/src/PVE/APIServer/AnyEvent.pm
index c159b8d..31556ce 100644
--- a/src/PVE/APIServer/AnyEvent.pm
+++ b/src/PVE/APIServer/AnyEvent.pm
@@ -413,6 +413,7 @@ sub send_file_start {
if (ref($download) eq 'HASH') {
$mime = $download->{'content-type'};
+ my $encoding = $download->{'content-encoding'};
if ($download->{path} && $download->{stream} &&
$reqstate->{request}->header('PVEDisableProxy'))
@@ -424,6 +425,7 @@ sub send_file_start {
pvestreamfile => $download->{path},
Content_Type => $mime,
);
+ $header->header('Content-Encoding' => $encoding) if defined($encoding);
# we need some data so Content-Length gets set correctly and
# the proxy doesn't wait for more data - place a canary
my $resp = HTTP::Response->new(200, "OK", $header, "error canary");
@@ -441,6 +443,7 @@ sub send_file_start {
if ($download->{stream}) {
my $header = HTTP::Headers->new(Content_Type => $mime);
+ $header->header('Content-Encoding' => $encoding) if defined($encoding);
my $resp = HTTP::Response->new(200, "OK", $header);
$self->response($reqstate, $resp, undef, 1, 0, $fh);
return;
--
2.30.2
next prev parent reply other threads:[~2021-11-24 14:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-24 14:47 [pve-devel] [PATCH mini-journalreader/http-server/manager] optimize journal api cal Dominik Csapak
2021-11-24 14:47 ` [pve-devel] [PATCH mini-journalreader 1/1] add '-j' flag to output json Dominik Csapak
2021-11-24 17:17 ` [pve-devel] applied: " Thomas Lamprecht
2021-11-24 14:47 ` Dominik Csapak [this message]
2021-11-24 17:18 ` [pve-devel] applied: [PATCH http-server 1/1] http-server: let the api call decide the content-encoding Thomas Lamprecht
2021-11-24 14:47 ` [pve-devel] [PATCH manager 1/1] api: journal: stream the journal data to the client Dominik Csapak
2021-11-24 17:32 ` Stoiko Ivanov
2021-11-24 17:46 ` Thomas Lamprecht
2021-11-24 17:50 ` Stoiko Ivanov
2021-11-24 17:38 ` [pve-devel] applied: " 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=20211124144748.68687-3-d.csapak@proxmox.com \
--to=d.csapak@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal