GNOME Bugzilla – Bug 745067
Requests are reloaded when a conditional request doesn't return NOT_MODIFIED
Last modified: 2018-09-21 16:21:49 UTC
When the result of a conditional request is that the resources has been modified, the conditional request itself returns 200 and the body has already been read, but we discard that and reload the resource again. I think we shouldn't complete the body io for conditional requests, so that in case of modified resource, we can create an input stream for the body and let the client read from it normally. The tricky part is that we need to move the conditional request response and io state to the original message.
Created attachment 297735 [details] [review] Do not reload modified resources after a conditional request
(In reply to Carlos Garcia Campos from comment #0) > The tricky part is that we need to > move the conditional request response and io state to the original message. Yeah... I don't really like how this turned out. All the moving stuff between SoupMessages looks really tricky and fragile. I think it would be better to just send the original SoupMessage, and if you get back 304 Not Modified, treat it similarly to how we treat redirect responses, with the original response being discarded and then the "redirected" response (ie, the cached response) being what gets returned to the caller. It seems like that would require a lot fewer changes. (It would change the semantics of validation requests in a way that would be observable to the caller, but WebKit is really the only user of SoupCache, so if it doesn't break WebKit, I think that's fine.)
This bug can cause problems to websites that send a xmlHttpRequest and expect that only one request be sent. A server could avoid sending the last-modified date and close the connection to work around this issue.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/libsoup/issues/80.