Subject: bug#18290: 24.3.93; url-http-parse-headers not handling 301 responses to PROPFIND

From: Lars Ingebrigtsen <[email-masked]>
Date: Fri, 25 Dec 2015 20:41:33 +0100

Alexis <[email-masked]> writes:

> In url-http.el, a comment states:
>
> ;; If the 301|302 status code is received in response to a request other
> ;; than GET or HEAD, the user agent MUST NOT automatically redirect the
> ;; request unless it can be confirmed by the user, since this might
> ;; change the conditions under which the request was issued.
>
> Thus, only responses to the HEAD and GET methods are handled. A 301
> response to a PROPFIND request, such as Google provides as part of its
> CardDAV API, is not handled, with the result that the gzip'd response
> body provided by Google is not decompressed, and cannot be further
> processed by the url-dav library.
>
> It seems to me that RFC2616 has been superseded in this regard by
> RFC4918, which states, in section 9.1.2:
>
> "In PROPFIND responses, information about individual properties is
> returned inside 'propstat' elements (see Section 14.22), each containing
> an individual 'status' element containing information about the
> properties appearing in it.  The list below summarizes the most common
> status codes used inside 'propstat'; however, clients should be prepared
> to handle other 2/3/4/5xx series status codes as well."
>
> Further, RFC4918 section 12 states:
>
> "In general, many HTTP status codes can be used in response to any
> request, not just in cases described in this document.  Note also that
> WebDAV servers are known to use 300-level redirect responses (and early
> interoperability tests found clients unprepared to see those
> responses)."
>
> This suggests that url-http should be modified to handle 301 responses
> to PROPFIND, in addition to HEAD and GET.

I think you're right, and the code should be changed as you describe.
However, I don't have access to anything that requires PROPFIND, so it's
a bit difficult for me to test.  Could you create a patch for this, and
then I'll apply it?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no