Author: jmb
Date: Sun Oct 11 18:37:27 2009
New Revision: 9622
URL:
http://source.netsurf-browser.org?rev=9622&view=rev
Log:
Don't cache GET with query segment, as before.
Move FETCH_TYPE case between FETCH_HEADER and FETCH_DATA to better reflect when it will be
issued. I suspect, however, that FETCH_TYPE is entirely redundant and it would be better
to perform the type detection stuff in llcache when the first chunk of data arrives off
the wire instead of within each and every fetch protocol handler.
Modified:
branches/jmb/new-cache/content/llcache.c
Modified: branches/jmb/new-cache/content/llcache.c
URL:
http://source.netsurf-browser.org/branches/jmb/new-cache/content/llcache....
==============================================================================
--- branches/jmb/new-cache/content/llcache.c (original)
+++ branches/jmb/new-cache/content/llcache.c Sun Oct 11 18:37:27 2009
@@ -390,6 +390,9 @@
{
nserror error;
llcache_object *obj;
+ bool has_query;
+ url_func_result res;
+ struct url_components components;
/**
* Caching Rules:
@@ -399,9 +402,18 @@
* 3) POST requests are never cached
*
* \todo Find out if restriction (2) can be removed
- * \todo Actually check for GET with a query part
*/
- if (flags & LLCACHE_RETRIEVE_FORCE_FETCH || post != NULL) {
+
+ /* Look for a query segment */
+ res = url_get_components(url, &components);
+ if (res == URL_FUNC_NOMEM)
+ return NSERROR_NOMEM;
+
+ has_query = (components.query != NULL);
+
+ url_destroy_components(&components);
+
+ if (flags & LLCACHE_RETRIEVE_FORCE_FETCH || has_query || post != NULL) {
/* Create new object */
error = llcache_object_new(url, &obj);
if (error != NSERROR_OK)
@@ -986,14 +998,18 @@
/* Normal 2xx state machine */
/** \todo Merge FETCH_TYPE and FETCH_HEADER? */
- case FETCH_TYPE:
- /* Received MIME type for object */
- break;
case FETCH_HEADER:
/* Received a fetch header */
object->fetch.state = LLCACHE_FETCH_HEADERS;
error = llcache_fetch_process_header(object, data, size);
+ break;
+ case FETCH_TYPE:
+ /* Determined MIME type for object */
+ /* This is always emitted after all headers have been received
+ * and immediately before the first FETCH_DATA event. ::data
+ * specifies the detected type (defaulted, if no Content-Type
+ * header) and ::size contains the Content-Length or 0. */
break;
case FETCH_DATA:
/* Received some data */