Bug 462279 - Konqueror does not handle content type octet stream
Summary: Konqueror does not handle content type octet stream
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: general (show other bugs)
Version: 22.08.3
Platform: openSUSE Linux
: NOR major
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-26 16:23 UTC by Christopher Yeleighton
Modified: 2023-02-05 16:08 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Yeleighton 2022-11-26 16:23:36 UTC
SUMMARY
Konqueror does not know what to do with the following resource:

CONTENT-DISPOSITION: ATTACHMENT; FILENAME="48F68961-4F7A-4703-9395-39950A51E4FB.MOV"
CONTENT-LENGTH: 42454468
CONTENT-TRANSFER-ENCODING: 8BIT
Content-Type: application/octet-stream

STEPS TO REPRODUCE
1. Navigate to <URL: http://localhost/cgi-bin/download.cgi >!
2. Select file name 48F68961-4F7A-4703-9395-39950A51E4FB.MOV!
3. Submit!

OBSERVED RESULT
Konqueror does not download the file.

EXPECTED RESULT
Download the file!

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: openSUSE Tumbleweed 20221124
(available in About System)
KDE Plasma Version: 5.26.3
KDE Frameworks Version: 5.100.0
Qt Version: 5.15.7

ADDITIONAL INFORMATION
Konqueror displays the download page with a different style and using a wrong encoding (ISO–8859–1).  The location is empty.
Comment 1 Christopher Yeleighton 2022-11-26 16:26:23 UTC
Console: Resource interpreted as Document but transferred with MIME type application/octet-stream: "http://localhost/cgi-bin/download.cgi".
If KGet integration is enabled, KGet handles the response and fails, probably because it cannot reproduce POST requests.
Google Chrome has no problem with this set-up.
Comment 2 Stefano Crocco 2022-11-27 14:32:58 UTC
> STEPS TO REPRODUCE
> 1. Navigate to <URL: http://localhost/cgi-bin/download.cgi >!
> 2. Select file name 48F68961-4F7A-4703-9395-39950A51E4FB.MOV!
> 3. Submit!

Unfortunately, the URL you provided can only be accessed on your system (note the `localhost` part), so I can't test it. Could you please provide a publicly accessible URL which causes the same problem?
Comment 3 Bug Janitor Service 2022-12-12 05:07:21 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 4 Christopher Yeleighton 2022-12-12 21:02:49 UTC
> Unfortunately, the URL you provided can only be accessed on your system
> (note the `localhost` part), so I can't test it. Could you please provide a
> publicly accessible URL which causes the same problem?

Could you please provide a publicly accessible host capable of executing CGI scripts?
Comment 5 Bug Janitor Service 2022-12-26 20:36:33 UTC
A possibly relevant merge request was started @ https://invent.kde.org/network/konqueror/-/merge_requests/157
Comment 6 Stefano Crocco 2023-02-05 16:08:17 UTC
Git commit 8631b1b7d68f1541ba61b6574327a334bf0b2411 by Stefano Crocco.
Committed on 05/02/2023 at 16:07.
Pushed by stefanocrocco into branch 'master'.

Download URLs requested with the POST method directly from WebEnginePart

WebEnginePart can't pass the POST data to KIO, as QtWebEngine doesn't
provide it, so using KIO would lead to unexpected results. The
workaround is to treat URLs downloaded with POST in the same way
WebEnginePart already does with blob URLs.

An additional problem is that `QtWebEngine` doesn't provide an easy way
to find out, ad download time, if the file is the response to a POST
request or not: that information is only available to `QWebEngineUrlRequestInterceptor`,
so I had to store that information and try to match it with the page which
made the request (`QWebEngineUrlRequestInterceptor` only knows about the
request but not about who made it). The algorithm is not always correct,
but it should only fail in some specific circumstances

M  +1    -0    webenginepart/src/CMakeLists.txt
A  +72   -0    webenginepart/src/navigationrecorder.cpp     [License: GPL(3+eV) GPL(v3.0) GPL(v2.0)]
A  +129  -0    webenginepart/src/navigationrecorder.h     [License: GPL(3+eV) GPL(v3.0) GPL(v2.0)]
M  +7    -1    webenginepart/src/webenginepage.cpp
M  +2    -2    webenginepart/src/webenginepage.h
M  +10   -2    webenginepart/src/webenginepartcontrols.cpp
M  +5    -1    webenginepart/src/webenginepartcontrols.h
M  +36   -30   webenginepart/src/webenginepartdownloadmanager.cpp
M  +26   -9    webenginepart/src/webenginepartdownloadmanager.h
M  +1    -1    webenginepart/src/webengineparterrorschemehandler.cpp
M  +5    -0    webenginepart/src/webengineurlrequestinterceptor.cpp

https://invent.kde.org/network/konqueror/commit/8631b1b7d68f1541ba61b6574327a334bf0b2411