Bug 413818 - Error is 0 for KIO:: Get while
Summary: Error is 0 for KIO:: Get while
Status: RESOLVED NOT A BUG
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: HTTP (show other bugs)
Version: 5.62.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-11-04 20:04 UTC by Alexander Trufanov
Modified: 2019-12-02 16:26 UTC (History)
0 users

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 Alexander Trufanov 2019-11-04 20:04:40 UTC
SUMMARY

I'm trying to use KIO::get(url,KIO::NoReload,KIO::HideProgressInfo)
for url that returns 403 Forbidden error from server.
My expectation was that I'll catch some errors, but in slot connected to KIO::TransferJob::result  I'm getting job->error() == 0 and data with something like:

<html>
<head><title>403 Forbidden</title></head>
<body bgcolor="white">
<center><h1>403 Forbidden</h1></center>
</body>
</html>

Also job->isErrorPage() returns true.
I want to get 403 error code without parsing server response. My expectation is that slave has it, but not forward to the job.

I've tried 
KIO::Scheduler::connect(SIGNAL(slaveError(KIO::Slave*,int,QString)), this, SLOT(slotSlaveError(KIO::Slave*,int,QString)));

but slotSlaveError() is never called.

The example looks outdated bcs of this commented line: https://github.com/KDE/kio/blob/master/tests/kioslavetest.cpp#L175. Is that all stuff with getConnectedSlave deprecated?

Is anything broken in KIO? Are there a way to get HTTP error code from slave via TransferJob and KIO::get()?

STEPS TO REPRODUCE
1. One may use https://httpstat.us/403 to test

ADDITIONAL INFORMATION
Operating System: Kubuntu 19.10
KDE Plasma Version: 5.17.2
KDE Frameworks Version: 5.62.0
Qt Version: 5.12.4
Kernel Version: 5.3.0-19-generic
OS Type: 64-bit
Processors: 4 × Intel® Core™ i7-3520M CPU @ 2.90GHz
Memory: 7,6 GiB of RAM