Score:0

How can I verify if file uploads are compressed?

fk flag

I need to upload big files to a server (Debian 4.19, Apache 2.4, PHP) and want to make sure that compression is applied for the transport. Data is compressed from the server to clients but I cannot figure out how to check if also uploaded files are compressed (or if that is possible at all).

Request headers show that gzip and deflate are accepted (I removed cookie infos):

POST /process HTTP/1.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Accept-Encoding: gzip, deflate, br
Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7
Cache-Control: max-age=0
Connection: keep-alive
Content-Length: 9846360
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary0yZXYBFZfsQELgvR

I cannot get any answer from the response headers:

HTTP/1.1 302 Found
Date: Tue, 04 Apr 2023 08:50:07 GMT
Server: Apache
Cache-Control: no-cache, private
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8

The file is POSTed through a form (<input type="file" ...>). The extension is EDF (electrocardiogramm) and I don't know which content type I should set for the deflate module (/etc/apache2/mods-enabled/deflate.conf), if that is relevant. Currently the configuration is:

<IfModule mod_deflate.c>
        <IfModule mod_filter.c>
                AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/csv
                AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript
                AddOutputFilterByType DEFLATE application/rss+xml
                AddOutputFilterByType DEFLATE application/xml
        </IfModule>
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
pierpy avatar
ru flag
You can write some sort of "middleware". When the upload ends, check the file with the help of the original utilities. For example, `gzip -t` test the integrity of the compressed file... And so on...
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.