Bug 480770 - Regression: EWS Server might require HTTP 1.1
Summary: Regression: EWS Server might require HTTP 1.1
Status: RESOLVED FIXED
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: EWS Resource (show other bugs)
Version: 5.240.95
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords: qt6
Depends on:
Blocks:
 
Reported: 2024-02-03 10:40 UTC by Igor Poboiko
Modified: 2024-02-20 16:03 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Igor Poboiko 2024-02-03 10:40:36 UTC
SUMMARY
When testing 6th MegaRelease, and trying to configure Akonadi Microsoft Exchange Server (EWS) resource for my workplace, server autodiscovery fails with message "Failed to read POX response XML". Logs reveal suspicious message:

> org.kde.pim.ews.client.proto: "<?xml version=\"1.0\"?><Autodiscover xmlns=\"http://schemas.microsoft.com/exchange/autodiscover/outlook/requestschema/2006\"><Request><EMailAddress>[MAIL]</EMailAddress><AcceptableResponseSchema>http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a</AcceptableResponseSchema></Request></Autodiscover>\n"
> org.kde.pim.ews.client.request: Starting POX Autodiscovery request (url:  QUrl(https://[SERVER]/autodiscover/autodiscover.xml) , email:  [MAIL]
> qt.network.http2: stream 3 finished with error: "Server requires that HTTP/1.1 be used instead of HTTP/2."
> org.kde.pim.ews.client.proto: data KIO::TransferJob(0x564a2890da90) ""
> org.kde.pim.ews.client.proto: response dumped to "/tmp/akonadi-ews-XIiXnid/ews_xmldump_kVvvsjS.xml"
> org.kde.pim.ews.client: Failed to read POX response XML

Corresponding XML file it refers to it empty. According to https://doc.qt.io/qt-6/network-changes-qt6.html, it seems like Qt 6 enabled HTTP/2 by default, which might be the cause of this regression.

Older KMail 23.08 at the same time with the same server works. Moreover, it provides with the URL via autodiscovery, which can then be entered manually in the newer 24.02 version. Nevertheless the newer version cannot connect with the message "Failed to read EWS request XML" and same "Server requires that HTTP/1.1 be used instead of HTTP/2." in logs.

Operating System: Gentoo Linux 2.14
KDE Plasma Version: 5.93.0
KDE Frameworks Version: 5.249.0
KDE PIM Version: 5.240.95 rc2 (24.01.95)
Qt Version: 6.6.1
Graphics Platform: Wayland
Comment 1 Bug Janitor Service 2024-02-07 16:38:46 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/1546
Comment 2 Bug Janitor Service 2024-02-07 16:43:25 UTC
A possibly relevant merge request was started @ https://invent.kde.org/pim/kdepim-runtime/-/merge_requests/146
Comment 3 Igor Poboiko 2024-02-07 21:14:12 UTC
Thanks for the quick response! I've applied both patches and tested it.

Autodiscovery still doesn't work -- but now it fails with error "org.kde.pim.ews.client: Failed to process EWS request: Access denied to [URL]".
(line 120 of ewspoxautodiscoverrequest.cpp: https://invent.kde.org/pim/kdepim-runtime/-/blob/master/resources/ews/ewsclient/ewspoxautodiscoverrequest.cpp?ref_type=heads#L120)
However, the job error code is 115 (which is  KIO::ERR_ACCESS_DENIED), instead of 401 Unauthorized, so it doesn't try authenticating with password
(line 90 of ewsautodiscoveryjob.cpp:  https://invent.kde.org/pim/kdepim-runtime/-/blob/master/resources/ews/ewsautodiscoveryjob.cpp?ref_type=heads#L90). Adding manual check for ERR_ACCESS_DENIED there solved this for me, and autodiscovery works. 

However, the resource still doesn't work because all other requests also fail with the same "HTTP/1.1 should be used" meassage. 
Adding the same line (set "HttpVersion" to "http1") to ewsrequest.cpp solved this for me as well, and resource now also works.
Comment 4 Carl Schwan 2024-02-07 21:34:39 UTC
(In reply to Igor Poboiko from comment #3)
> Thanks for the quick response! I've applied both patches and tested it.
> 
> Autodiscovery still doesn't work -- but now it fails with error
> "org.kde.pim.ews.client: Failed to process EWS request: Access denied to
> [URL]".
> (line 120 of ewspoxautodiscoverrequest.cpp:
> https://invent.kde.org/pim/kdepim-runtime/-/blob/master/resources/ews/
> ewsclient/ewspoxautodiscoverrequest.cpp?ref_type=heads#L120)
> However, the job error code is 115 (which is  KIO::ERR_ACCESS_DENIED),
> instead of 401 Unauthorized, so it doesn't try authenticating with password
> (line 90 of ewsautodiscoveryjob.cpp: 
> https://invent.kde.org/pim/kdepim-runtime/-/blob/master/resources/ews/
> ewsautodiscoveryjob.cpp?ref_type=heads#L90). Adding manual check for
> ERR_ACCESS_DENIED there solved this for me, and autodiscovery works. 
> 
> However, the resource still doesn't work because all other requests also
> fail with the same "HTTP/1.1 should be used" meassage. 
> Adding the same line (set "HttpVersion" to "http1") to ewsrequest.cpp solved
> this for me as well, and resource now also works.

Thanks for the helpful input. I adopted my kdepim-runtime patch.
Comment 5 Igor Poboiko 2024-02-07 22:18:53 UTC
Happy to help! Proposed patches now fix both issues for me.
Comment 6 Antonio Rojas 2024-02-08 21:43:41 UTC
Thanks, this fixes the resource not working at all for me since beta2. I still get disconnected after a couple of hours and need to relogin constantly, any ideas? https://bugs.kde.org/show_bug.cgi?id=478033
Comment 7 Carl Schwan 2024-02-16 10:40:05 UTC
Git commit c7b139dd8d337407e64b8a20aa1574b2402e83d6 by Carl Schwan.
Committed on 16/02/2024 at 10:30.
Pushed by carlschwan into branch 'master'.

ews: Use http1 for ews requests

M  +1    -0    resources/ews/ewsclient/ewspoxautodiscoverrequest.cpp
M  +1    -0    resources/ews/ewsclient/ewsrequest.cpp

https://invent.kde.org/pim/kdepim-runtime/-/commit/c7b139dd8d337407e64b8a20aa1574b2402e83d6
Comment 8 Carl Schwan 2024-02-16 10:45:53 UTC
Git commit cca3d3b1cb5672f7a528c23a46b1ce559d0257ad by Carl Schwan.
Committed on 16/02/2024 at 10:45.
Pushed by carlschwan into branch 'release/24.02'.

ews: Use http1 for ews requests


(cherry picked from commit c7b139dd8d337407e64b8a20aa1574b2402e83d6)

M  +1    -0    resources/ews/ewsclient/ewspoxautodiscoverrequest.cpp
M  +1    -0    resources/ews/ewsclient/ewsrequest.cpp

https://invent.kde.org/pim/kdepim-runtime/-/commit/cca3d3b1cb5672f7a528c23a46b1ce559d0257ad
Comment 9 Carl Schwan 2024-02-16 10:47:08 UTC
Git commit 6ffee26847277d6077596a3b7c547a8d06fa98a7 by Carl Schwan.
Committed on 16/02/2024 at 10:29.
Pushed by carlschwan into branch 'master'.

Allow to specify http1 only

M  +4    -0    src/kioworkers/http/http.cpp

https://invent.kde.org/frameworks/kio/-/commit/6ffee26847277d6077596a3b7c547a8d06fa98a7