After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 760832 - Cannot access Yahoo! calendar
Cannot access Yahoo! calendar
Status: RESOLVED FIXED
Product: libsoup
Classification: Core
Component: HTTP Transport
2.52.x
Other Linux
: Normal normal
: ---
Assigned To: libsoup-maint@gnome.bugs
libsoup-maint@gnome.bugs
Depends on:
Blocks:
 
 
Reported: 2016-01-19 13:39 UTC by Milan Crha
Modified: 2016-01-25 12:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test-soup.c (3.27 KB, text/plain)
2016-01-19 13:39 UTC, Milan Crha
  Details
proposed patch (1.37 KB, patch)
2016-01-19 14:11 UTC, Milan Crha
none Details | Review
soup_headers_parse: deal with NUL bytes in headers (4.38 KB, patch)
2016-01-23 22:26 UTC, Dan Winship
committed Details | Review

Description Milan Crha 2016-01-19 13:39:31 UTC
Created attachment 319342 [details]
test-soup.c

Trying to access Yahoo! calendar using libsoup results in Message Corrupt response and nothing is working. This is not a case with curl, where the below command succeeds:
   curl --verbose -X OPTIONS https://user%40ymail.com@caldav.calendar.yahoo.com/dav/user%40ymail.com/Calendar/User/

Even this command copy&pasted into the terminal works correctly, the result is a response with headers:
< DAV: 1, 3, calendar-access
< MS-Author-Via: DAV
< Allow: MKCOL, REPORT, MOVE, COPY, HEAD, POST, GET, DELETE, MKCALENDAR, ACL, PROPFIND, OPTIONS, PROPPATCH, PUT

The attached test-soup.c contains a command line to build and run it as its first line comment. Just do that and you'll see a response:

   < HTTP/1.1 8 Message Corrupt
   < Soup-Debug-Timestamp: 1453210571
   < Soup-Debug: SoupMessage 1 (0x62100000a8a0)

   test_thread: Failed, certflags:0 code:8 reason:Message Corrupt
Comment 1 Milan Crha 2016-01-19 14:11:40 UTC
Created attachment 319352 [details] [review]
proposed patch

for libsoup;

This patch makes libsoup forgiving for the Yahoo! server. It's Yahoo!'s fault, providing headers in this way:

   HTTP/1.1 401 Unauthorized
   Date: Tue, 19 Jan 2016 13:02:57 GMT
   Connection: close
   Via: http/1.1 calgate123.cal.bf2.yahoo.com (ApacheTrafficServer)
   Server: ATS
   Www-Authenticate: Basic realm="YahooCalendar"\0
   Www-Authenticate: OAuth realm="YahooCalendar"\0
   Content-Length: 0


Notice the \0 after the first Www-Authenticate header, it's in bytes:
   ...\0\r\nWww-...
similarly with the second \0, which is in bytes:
   ..."\0\r\nCont...

I know it's a fault on the Yahoo! server, but libsoup could be forgiving for such errors in the headers, similar as curl is. The attached is a patch which makes libsoup work with the Yahoo! server.

I do not know how to properly report this issue to Yahoo! people, but I will try at least somehow to do it and report back here in case I'd have anything from them.
Comment 2 Dan Winship 2016-01-23 22:26:30 UTC
Created attachment 319595 [details] [review]
soup_headers_parse: deal with NUL bytes in headers

--------

The proposed patch seems to truncate the headers at the '\0', which
seems wrong. This patch just strips out any '\0's. Does it work for
you?
Comment 3 Milan Crha 2016-01-25 11:29:11 UTC
Thanks, it works just fine. Even better than that mine initial (mine hid OAuth authentication type, while yours keep it there).

I wasn't sure whether it's possible to simply "skip" those \0 in the headers, thus I decided to stop on the first one instead. It's a server fault, after all.
Comment 4 Dan Winship 2016-01-25 12:31:34 UTC
> I wasn't sure whether it's possible to simply "skip" those \0 in the headers,
> thus I decided to stop on the first one instead. It's a server fault, after
> all.

I figure, the server sent the other headers, so clearly it wants us to
look at them...

Attachment 319595 [details] pushed as dcf45cb - soup_headers_parse: deal with NUL bytes in headers