GNOME Bugzilla – Bug 406997
soup_headers_parse_status_line not working as per specification
Last modified: 2007-02-12 20:58:47 UTC
Please describe the problem: This commit: http://svn.gnome.org/viewcvs/libsoup/trunk/libsoup/soup-headers.c?rev=905&r1=893&r2=905 states that "@status_line must be terminated by either '\0' or '\r\n'.", but in the actual implementation, in the same commit, it appears that the function will return FALSE unless the last character in the string is '\n': Since strchr() will return NULL if the character is not found, this code will necessarily return FALSE for \0 terminated strings, such as those parsed from <multistatus> XML responses by Evolution's CalDAV plugin... :-) Since Evolution actually checks the return code, this causes Evolution's CalDAV plugin not to work any longer :-( Steps to reproduce: Actual results: Expected results: Does this happen every time? Other information: I have a patch for this, which fixes the problem (Evolution CalDAV now works for me)
Created attachment 82373 [details] [review] Fix to allow null-terminated status response to be parsed as documented I am not entirely sure whether the strlen() is sufficient, or should have a "+1" on it... or indeed if there is a better, multibyte aware strlen that should be used here...
Fixed (slightly differently) in svn. Sorry about that. This will go out today in libsoup 2.2.100 which should be released as part of GNOME 2.18 beta2 on Wednesday.
Thanks for that. I realised afterwards that my patch was somewhat broken, and worked out (in several places) what I had done wrong. Your patch, however, is much cleaner and shows up exactly how much C I have forgotten in the last 20 years :-)