Commit graph

24 commits

Author SHA1 Message Date
Christian Dywan 40dc38fd21 Implement and use KATZE_ARRAY_FOREACH_ITEM
Iterating an array by a GList is considerably faster than
continuously retrieving items, however it is also a lot
more complicated. So the new macro takes care of that and
uses a new semi-private function to avoid copying the list.

Note that the macro can't be nested, which basically isn't
useful in practise anyway.
2010-09-12 00:59:24 +02:00
Christian Dywan c21807bc4a Use g_unlink for G_FILE_CREATE_REPLACE_DESTINATION with Glib < 2.20 2010-02-12 02:19:54 +01:00
Alexander Butenko 97a5eb0df2 Read cache asynchronously, use GOutputStream, plug a leak
1. We are now reading from the cache asyncronously. Fixing UI freezes.

2. Cache writing switched to GOutputStream. One open/ close per file

3. Plugged a leak of cache headers in web_cache_message_rewrite ()

4. We don't need the URI in web_cache_mesage_got_headers_cb ()
2010-01-17 22:56:41 +01:00
Alexander Butenko 9b01e48975 Tell the soup message it was finished to allow it to release memory 2010-01-14 02:23:00 +01:00
Alexander Butenko 33565cc2f3 Check whether the header file was created and mkdir the parent folder
When the web cache folder is deleted, the filenames passed to callbacks
may not be updated, so trying to write headers results in a crash.
We need to make sure we only write after opening the file properly.
2009-12-27 22:04:27 +01:00
Alexander Butenko 138e837457 Free the URI when the file was already cached 2009-12-26 15:20:57 +01:00
Alexander Butenko 06f5306d56 Fix a typo when using g_access in Web Cache 2009-12-23 23:39:54 +01:00
Alexander Butenko 61266c26ec No need to g_access when checking cached file, fopen is enough 2009-12-21 23:48:51 +01:00
Alexander Butenko 8c724eccd9 Use g_access in web cache, only SoupSession, pass filenames
Using g_access instead of g_file_test is a lot faster and avoids
big delays when accessing the disk.

Using only the SoupSession without resource-request-starting simplifies
the code. So offline mode is not an option for the moment.

Pass filenames directly to speed up lookups.
2009-12-18 21:21:56 +01:00
Alexander Butenko b8e0143bdc Take soup status message into account in finish callback of web cache 2009-11-23 20:42:22 +01:00
Christian Dywan d41525b7fe Adjust an #ifdef in web cache possibly leading to compile warnings 2009-11-08 14:39:46 +01:00
Alexander Butenko b53bd5c2f4 Bail out of storing when processing multiple files to cache 2009-10-27 23:41:22 +01:00
Alexander Butenko 8ef3eeaa89 Set proper content types and work with temporary cache file fragments
With WebKit 1.1.11 and newer, we can sniff the content type which
is needed in some cases to load for instance Flash videos.

We are writing chunks into temporary files and commit completed
files to the cache, so that we don't end up serving partial files.

Old cache entries are removed before updating.

Length detection is improved.

File creation moved from got-chunk to got-headers.
2009-10-27 20:03:22 +01:00
Christian Dywan f0e7b93964 Do not try to cache downloaded files 2009-10-27 02:04:38 +01:00
Christian Dywan 0eec63762f Plug two filename leaks in the web cache 2009-10-26 23:46:21 +01:00
Alexander Butenko 9c2c62d37c Implement Pragma, Cache-Control, ETag and Last-Modified in web cache
Offline mode is going to be handled separately and is not supported
right now.
2009-10-26 18:39:32 +01:00
Alexander Butenko 9deda8296b Disconnect signal handlers when disabling web cache 2009-10-23 18:15:28 +02:00
Christian Dywan 86685cc0c9 Check method before caching and limit extension length 2009-10-23 00:58:25 +02:00
Christian Dywan 6ff3e3a17d Make sure the cache folder is there initially 2009-10-22 02:52:40 +02:00
Christian Dywan 9040d43632 Refactor web cache to circumvent libsoup when needed
At this point libsoup is dependent on a functional network adapter,
which may not be available if no network connection is there or
the connection is faulty. So *if* we have a requested page in the
cache, we load it before libsoup comes into play.

Depending on the WebKitGTK+ version, loading from cache uses an
"alternate" URI so that we don't end up having cache filenames
in the location entry.

Generation of cache filenames is fixed to never include special
characters such as slashes or question marks.

Only non-empty files are actually stored to the cache folder.
2009-10-22 02:20:27 +02:00
Christian Dywan 3dfaac3458 Revise loading data from the cache instead of the network 2009-10-20 21:39:05 +02:00
Christian Dywan 10b6cbb50a Don't check the status code when storing in the cache 2009-10-20 17:30:07 +02:00
Christian Dywan ea6ae9b9e6 Store cached files in subfolders 2009-10-20 17:28:42 +02:00
Christian Dywan da65b5d0c1 Implement a primitive web cache extension (unstable)
Incoming files are cached and saved to disk, as well as looked up
when files are requested. Only images are considered at the moment
and there is no epxiration handling or updating at all. Plus
it crashes in certain cases.
2009-10-20 16:04:58 +02:00