NEW 26181
REGRESSION(r40553?): HTTPBody not set on file:// POST/PUT requests
https://bugs.webkit.org/show_bug.cgi?id=26181
Summary REGRESSION(r40553?): HTTPBody not set on file:// POST/PUT requests
Francisco Tolmasky
Reported 2009-06-03 19:24:19 PDT
Currently, WebKit discards the body of any PUT or POST request to a file:/// URL before that request is sent to the ResourceLoadDelegate. Although the HTTP body does not mean anything in requests that are ultimately hitting the file system directly (file://), not including breaks the ResourceLoadDelegate API. Specifically: - (NSURLRequest *)webView:resource:willSendRequest:redirectResponseredirectResponse fromDataSource: As per the docs (linked below), this method gives the developer the chance to modify the request, or replace it entirely. So, for example, the developer may wish to intercept file:// requests and swap them out for HTTP requests to http://example.com, essentially mimicking a file system in their application. In other words, it gives the developer the opportunity to first take a stab at making sense of this situation before WebKit. The current WebKit behavior is strictly lossy as it will not allow you to swap a file:// POST for a corrected http:// POST. Instead, the POST information is discarded internally. Additionally, even though the request body has been modified (discarded), the HTTP method is not altered, so the delegate still receives a POST request, but the request lacks a body. It would be prefferable if WebKit instead kept the body intact, and allowed the delegate to interpret, alter, or discard the request like any other. An alternative fix would be to modify all file:// PUT/POST requests to be GET requests. While this would be consistent, it would not give the developer a first-pass opportunity to fix or replace the request (he or she would not be able to tell the difference between a file:// PUT and a file:// GET). Since this API specifically mentions that it may be sent several times as it is redirected, one good balance would be to send the initial PUT file:// request with HTTP body intact, and if it is not modified, to then change the request to the actual file:// GET request that will take place, and call this method again. Docs: http://devworld.apple.com/documentation/Cocoa/Reference/WebKit/Protocols/WebResourceLoadDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/instm/NSObject/webView:resource:willSendRequest:redirectResponse:fromDataSource:
Attachments
Alexey Proskuryakov
Comment 1 2009-09-21 11:18:49 PDT
I haven't verified that this is indeed new, but <http://trac.webkit.org/changeset/40553> looks like it intentionally changed the behavior.
Alexey Proskuryakov
Comment 2 2009-09-21 11:19:59 PDT
Note You need to log in before you can comment on or make changes to this bug.