Commit Graph

1013 Commits

Author SHA1 Message Date
Michael Drake
8e0e72368e Fix crazy indentation. 2016-01-08 17:17:11 +00:00
Vincent Sanders
b1e0a711c7 Stop reporting error from mime sniffing when a fetcher completes with no data
If a fetcher returns with no data (no content or http error code 204)
the hlcache state machine was trying to mimesniff using non existent
header data and reporting the resulting NSERROR_NOT_FOUND as a
"BadType" message.

This changes the behaviour to be similar to that in the headers
received case where NSERROR_NOT_FOUND from the mimesniffing is not an
error.
2016-01-06 23:53:02 +00:00
Michael Drake
e5ddbd3934 Remove unused variable. 2015-12-20 12:12:36 +00:00
Michael Drake
401cc36924 Add extra logging to curl poll fn when not suppressing curl debug. 2015-11-11 10:39:12 +00:00
Daniel Silverstone
4d1ef3bac4 Add support for retrying timed-out cURL fetches.
This is an attempt to amelioriate the situation found in #2384 where
we see the cURL connect() failing to complete.  Based on the pcap
from the bug log, we believe that RISC OS is likely failing to signal
the completion of the connection to cURL.  As such, cURL times out.

This change permits retries of timed out connections in the hope that
a fresh socket FD might subsequently function correctly.  The defaults
chosen mean that the previous behaviour of 30 seconds before timeout
is reported will remain the same, but in that time we will make 3 separate
attempts to connect the socket.
2015-11-10 21:51:54 +00:00
Vincent Sanders
73e45ff024 Fix error reporting from fetch_start
Any fetch start error was being reported as "out of memory" which was
clearly insufficient. Foe example bad urls (reported was file:// with
a missing /) were causing a warn_user with out of memory. This change
now at least causes a "bad url" message.
2015-06-24 10:31:13 +01:00
Vincent Sanders
e9b89f776d Allow the resource scheme to provide data directly.
This allows front ends to provide resources from compiled in data
instead of requiring the resources to be available on disc and forcing
a redirect.
2015-06-17 21:35:40 +01:00
Vincent Sanders
0d811963c1 fixup all the remaining logging macro callsites
The semantic patch tool appears to have missed some difficult to
reason about callsites which have now been manually cleaned up
2015-05-28 17:06:18 +01:00
Vincent Sanders
c105738fa3 Change LOG() macro to be varadic
This changes the LOG macro to be varadic removing the need for all
callsites to have double bracketing and allows for future improvement
on how we use the logging macros.

The callsites were changed with coccinelle and the changes checked by
hand. Compile tested for several frontends but not all.

A formatting annotation has also been added which allows the compiler
to check the parameters and types passed to the logging.
2015-05-28 16:08:46 +01:00
Michael Drake
8f1c9673d7 Fix format string type missmatches on 32-bit systems.
Use C99 inttypes header for format string macros.
2015-05-12 10:19:38 +01:00
Michael Drake
82237d7070 Avoid generating confusing warning.
Now the disc cache will be disabled silently if its too slow.
2015-05-12 10:01:06 +01:00
Vincent Sanders
37aad9c749 Improve the logge dinformation about written cache data 2015-05-08 15:42:49 +01:00
Vincent Sanders
35751f3faa Move the setting of block file extents to background maintinance.
On some OS the ftruncate operation can take some time so move it to
occour in the background maintinance operations instead of when data
blocks are initialy opened. This should improve browsing responsiveness.
2015-05-04 09:54:03 +01:00
Vincent Sanders
2aef095f27 Ensure bandwidth minimum check is only performed when enough data has
been written.
2015-04-30 14:28:18 +01:00
Vincent Sanders
05538c0264 Ensure small block cache files allocate their entire extent at open.
It seems many filesystems are greatly more efficient if the block file
is allocated its entire extent once rather than trying to
continuously grown the file later.

The size of the block files is known at their creation time so this
change ensures they are grown to the full possible extent hence removing
future inefficient writes.
2015-04-30 13:49:25 +01:00
Vincent Sanders
ea2e1c4d98 Add scaled content redraw interface.
Add a new interface to the content to allow automaticaly scaled
content redraws. This is intended to replace the thumbnail_redraw
interface with something more generic.
2015-04-23 15:47:28 +01:00
Vincent Sanders
f37e52c394 Move bitmap operations into an operation table.
The generic bitmap handlers provided by each frontend are called back
from the core and therefore should be in an operation table. This was
one of the very few remaining interfaces stopping the core code from
being split into a library.
2015-04-13 23:19:04 +01:00
Vincent Sanders
ea9a2ff01d Fix up some doxygen errors 2015-04-03 00:28:22 +01:00
Vincent Sanders
77ffda1e46 Use nsutils unistd operations for pread and pwrite to get consistant interface 2015-04-02 17:28:55 +01:00
Vincent Sanders
47d08b6506 Revert "Fix RISC OS not having a pread/pwrite implementation."
This reverts commit 82c7a7a4ba.

Conflicts:
	content/fs_backing_store.c
2015-04-02 16:37:04 +01:00
Vincent Sanders
576b1c55bf extend backing store logging to show errno values ofter operations 2015-04-01 09:26:39 +01:00
Vincent Sanders
82c7a7a4ba Fix RISC OS not having a pread/pwrite implementation. 2015-03-31 22:41:37 +01:00
Vincent Sanders
87a38ca5c1 ensure entry invalidation copes with entries in blocks 2015-03-31 22:02:07 +01:00
Vincent Sanders
9511e9c4e9 Improve file naming inside cache 2015-03-31 20:57:00 +01:00
Vincent Sanders
f1d4094566 allocate small block using block use bitmaps to find free entries. 2015-03-31 20:56:55 +01:00
Vincent Sanders
706a77170d implement block read and write operations. 2015-03-31 20:56:55 +01:00
Vincent Sanders
c965fa8739 Block file usage bitmaps (de)serialising 2015-03-31 20:56:55 +01:00
Vincent Sanders
a8e501a663 define block store parameters 2015-03-31 20:56:55 +01:00
Vincent Sanders
980e28d916 Change backing store fetch operation to always perform the allocations
The fetch API previously allowed for the caller to supply the storage,
this was never used and was preventing the refactoring necessary for
small black storage to be available.
2015-03-31 20:56:55 +01:00
Vincent Sanders
1d03f34d62 Compute the element index once and use that as a parameter.
Change to computing the element index from the flags passed to store
and fetch methods instead of passing the flags around and calculating
everywhere.

Additionally split out writing element of entry to file into distinct
function to make code clearer.
2015-03-31 20:56:55 +01:00
Vincent Sanders
c2eda75710 Change element layout and cope with index collisions. 2015-03-31 20:56:55 +01:00
Vincent Sanders
8a99b045bc Remove url from content thumbnailers API
The content thumbnailers for each frontend were being provided the
contents url. This was only ever used to call the urldb thumbnail
setting API.

This changes it so the single callsite that passed a valid url adds
the bitmap to that url itself in desktop_history.c instead of forcing
every frontend to require the urldb API.

Additionally the old API could pass the url as NULL which was causing
asserts where this was not an expected parameter value. Because of
this this fixes bug #2286 which was also present in the monkey
frontend as both called nsurl_access() on the url without the NULL
check and caused an assertion.
2015-03-15 00:00:45 +00:00
Vincent Sanders
a487f7e611 Move win32 window operations into their own module
This splits up a great deal of the win32 window code out from other
gui code. It also remove large quantities of unused and junk
variables and functions.
2015-03-12 23:48:53 +00:00
Michael Drake
ac636100e8 Remove include of nsurl from corestrings.h 2015-02-26 16:58:41 +00:00
Michael Drake
cbd9d710a3 Use forward declaration instead of #include for nsurl. 2015-02-26 16:14:23 +00:00
Michael Drake
ee75f5b3ad Fix to support non-POSIX behaviour when renaming cache entries on disc. 2015-02-03 10:22:28 +00:00
Vincent Sanders
9927232a2d Improve metadata deserialisation to only update object on success
The low level cache deserialisation was leaving bad data in an low
level cache object in the error case. This fixes it so the object
state only gets modified on successful deserialisation of all the
metadata.
2015-01-28 22:39:39 +00:00
Vincent Sanders
5464dc7778 Ensure no division by zero occours if no time has ever been spent writing llcache 2015-01-03 15:13:40 +00:00
Vincent Sanders
6b645664fe add missing includes 2014-12-27 22:48:37 +00:00
Vincent Sanders
45f98ffd6e improve comments in low level cache and remove completed todo 2014-12-04 21:09:42 +00:00
Vincent Sanders
5bf4b3ff2b move the low bandwidth check to allow for an average over a much longer time 2014-12-03 20:13:10 +00:00
Vincent Sanders
57cd5c77b2 Use translated messgae for low bandwidth error 2014-12-02 10:03:27 +00:00
Vincent Sanders
c9ee49baa8 cope with backing store writeout making no progress 2014-12-01 11:32:33 +00:00
Vincent Sanders
ba5ade87b2 ensure the backing store write reports at least a minimal amount of time 2014-12-01 09:18:31 +00:00
Vincent Sanders
1c735140b6 fix resource leak on error (Coverity 1256245) 2014-11-30 11:21:34 +00:00
Vincent Sanders
61ab2777da Improve writeout rescheduling if list of objects is completed quickly 2014-11-30 00:27:05 +00:00
Vincent Sanders
d08acbc5ae correctly calculate writeout bandwidth and properly impose limits 2014-11-29 23:57:15 +00:00
Vincent Sanders
6b2676d33f Improve llcache writeout stratagy 2014-11-28 19:17:42 +00:00
Vincent Sanders
8d51dd4879 update the backing store to allow for invalidating entries which have an allocation 2014-11-27 13:31:43 +00:00
Vincent Sanders
79d5b1bf3b stop using gettimeofday and use the monotonic time interface fron nsutils 2014-11-26 21:29:13 +00:00
Vincent Sanders
81417ae4a5 caclulate the total amount of time spent writing an object out
In order to calculate the writeout bandwidth we need to know how long
it took to write the data to peristant storage in addition to how much
was written.
2014-11-25 23:11:41 +00:00
Vincent Sanders
5a78cd810f correctly release source data from llcache 2014-11-23 18:21:56 +00:00
Vincent Sanders
01b2bc5a57 Improve doxygen comments and add todo for cache and backing store 2014-11-23 15:43:03 +00:00
Vincent Sanders
246a1fec05 remove constness from backing stores store method 2014-11-23 01:37:24 +00:00
Vincent Sanders
63c35da66e annotate element struct with packing attributes to reduce entry size 2014-11-23 01:25:14 +00:00
Vincent Sanders
08c7ef6bed Do not use anonymous union as it is not portable
unnamed unions are not portable to old compilers. When reloading data
ensure the heap allocation status is discarded.
2014-11-23 00:35:11 +00:00
Vincent Sanders
8b810ee4a1 change the persistant data store to owning the allocations 2014-11-22 23:56:43 +00:00
Vincent Sanders
eb87406758 update entry points to backing store ready for allowing differing object lifetimes 2014-11-20 22:28:19 +00:00
Vincent Sanders
69f4397fe4 Limit creation of store path directories.
Only create all elements of a path in the store when it is being
opened for creation instead of causing reads to create directories.
2014-11-19 16:26:29 +00:00
Vincent Sanders
92a1ac4fbb Improve backing store control data serialisation
By scheduling the control data to be maintained (entries index written
and headers updated) once activity occurs to update these control
structures rather than a single serialisation at browser exit the data
is more likely to be up to date and not lost on a crash.
2014-11-19 16:22:06 +00:00
Vincent Sanders
a79b30bd6f make backing store use rename to atomicly replace entries file 2014-11-19 11:26:27 +00:00
Vincent Sanders
669df172ec Fix my spelling of teh everywhere 2014-11-18 17:16:26 +00:00
Vincent Sanders
d4c7a0ff77 Improve data scheme fetcher allocation
The data scheme fetcher was over allocating the space for decoded
base64 encoded urls and not using the base64 API that allocated the
correct size storage.
2014-11-17 16:05:17 +00:00
Vincent Sanders
71d016aba5 Remove unecessary form debug
Additionaly we make the curl fetcher report errors instead of
uninitialised buffer.
2014-11-15 18:23:44 +00:00
Vincent Sanders
d1f2d29e10 Doxygen cleanups and documentation additions 2014-11-10 17:00:15 +00:00
Vincent Sanders
e32a2ad46e Doxygen fixes 2014-11-09 15:28:03 +00:00
Vincent Sanders
56bb1b03c5 Doxygen cleanups 2014-11-09 12:50:30 +00:00
Vincent Sanders
5562c9a553 Continue doxygen error cleanup. 2014-11-08 22:08:29 +00:00
Vincent Sanders
05a64bfde9 fix up more doxygen errors 2014-11-08 16:49:32 +00:00
Vincent Sanders
8f64d5d223 Improve Doxygen documentation 2014-11-08 12:35:11 +00:00
Vincent Sanders
3405803280 Improve content encoding information API
Extend the content_get_encoding() API to retrieve the source of
the encoding as well as the actual encoding.
2014-11-07 12:33:34 +00:00
Vincent Sanders
8c2cfecfb5 Allow content handlers to have debug values set through API
Previously content handler debugging features were accessed by global
variables. This allows the setting of debugging parameters via a
content API giving per content control over debugging features.
Currently only used by the html content handler to toggle global
redraw debugging.
2014-11-06 22:51:46 +00:00
Vincent Sanders
8ec7ad053a Make the fetching of a contents encoding generic.
The frontends previously had to use an html renderer API to get the
encoding of a content. This also required the explicit checking of the
contents type rather than using the existing content API to abstract
this knowledge.
2014-11-05 23:44:31 +00:00
Vincent Sanders
bdfedb686b replace save_link operation table entry usage of textural url with nsurl 2014-11-03 23:05:59 +00:00
Vincent Sanders
c31c4babe1 Change contextual content retrieval to browser features.
Update the API which allows frontends to acquire the page features
(images, link urls or form elements) present at the given coordinates
within a browser window.

By making this an explicit browser_window API and using the browser.h
header for the associated data structure with a more appropriate API
naming the usage is much more obvious and contained.

Additionally the link url is now passed around as a nsurl stopping it
being converted from nsurl to text and back again several times.
2014-11-02 15:46:42 +00:00
Vincent Sanders
cf7abb4a0a restructure urldb source
remove forward declarations and restructure. exported functions are
also now documented in the urldb.h header.
2014-11-01 23:27:29 +00:00
Michael Drake
98b6d02df6 Move host_is_ip_address into urldb, as that's the only thing that cares. 2014-10-31 14:31:06 +00:00
Vincent Sanders
14e2829489 remove the die API from the core.
The die() API for abnormal termination does not belong within the core
of netsurf and instead errors are propogated back to the callers.

This is the final part of this change and the API is now only used within
some parts of the frontends
2014-10-26 12:42:53 +00:00
Vincent Sanders
53f0f432dd update fetcher registration API to return an error code.
By using an error code return we can gracefully handle fetcher
registration faliures instead of just immediately aborting.

The curl handler was also cleaned up and documentation improved
as a side effect.
2014-10-25 17:15:23 +01:00
Michael Drake
b27f3e5ac4 Open select menu via content msg, instead of breaking encapsulation.
Fixes bw deref and browser_private.h #include in render/
2014-10-24 17:57:15 +01:00
Michael Drake
6b846c363d Add trivial maps facilitator at about:maps
This is a simple HTML front end for the Google Static Maps API, since
we don't yet have enough JS support for the full Google Maps.

See:
  https://developers.google.com/maps/documentation/staticmaps/
2014-10-22 20:42:21 +01:00
Vincent Sanders
d06df231bc Update the core to use the split operations table headers
Second in the series to decouple the core API usage from the frontends.
2014-10-16 22:33:43 +01:00
John-Mark Bell
b2242c57e1 HTTPS: disable all SSL versions; emit fallback SCSV on downgrade.
This removes all support for SSL and (with help from servers that
support the fallback SCSV) protects against inappropriate protocol
downgrade.
2014-10-15 12:02:25 +01:00
Vincent Sanders
02bbaa3e88 split version info into its own header and remove unnecessary nesurf.h includes
The netsurf.h header should *only* contain the registration, core
initialisation and finalisation methods. Version information is best
placed in its own header.

Also remove any unneeded inclusion of this header limiting it to
solely the places the relevant API is required.
2014-10-13 15:08:16 +01:00
Vincent Sanders
1a2040bc72 Trivial sepelling, documentation and whitespace cleanups 2014-10-10 13:01:20 +01:00
Vincent Sanders
b99ba0998b fixup haiku rsrc fetcher initialisation 2014-09-05 00:40:52 +01:00
Vincent Sanders
c695d3d007 memcpy and terminate from openssl buffers
The memcpy is used instead of snprintf as the source data may not be null terminated and was
 causing OpenBSD to segfault.
2014-09-03 14:27:25 +01:00
Vincent Sanders
5492e96793 terminate buffers from X509_NAME_print_ex() 2014-09-02 23:30:37 +01:00
Vincent Sanders
37755fb135 add incomplete scheme fetcher for javascript urls 2014-08-25 15:59:52 -07:00
Vincent Sanders
af16c38d2d fix DOM tree dump debug 2014-08-04 00:37:21 +01:00
Vincent Sanders
db01637343 remove content include from urldb header 2014-07-17 00:18:44 +01:00
Vincent Sanders
0694f345da fix leak on error path (coverity 1224429) 2014-07-08 15:57:48 +01:00
Vincent Sanders
219f505a65 version 1.1 of the backing store disc layout using base32 encoded
filenames to allow for case insensitive filenames.
2014-07-04 17:09:28 +01:00
Vincent Sanders
a71865b328 turn off verbose fetch debugging 2014-07-02 17:07:29 +01:00
Vincent Sanders
29e29cccd7 fix dumb error in previous commit and get scheme name element correct 2014-07-02 15:01:24 +01:00
Vincent Sanders
516dcb96e1 fix unhelpful assert at quit 2014-07-02 14:51:11 +01:00
Vincent Sanders
06eb81235d fix fetchers include on windows 2014-07-01 09:17:22 +01:00
Vincent Sanders
8944edd649 convert all frontends to scheduled fetch operation 2014-06-26 19:05:59 +01:00
Vincent Sanders
1b7aa7ffe5 make fetchers scheduled 2014-06-26 19:05:59 +01:00
Vincent Sanders
4b2101ba6a clean up the fetcher factory and improve its API 2014-06-19 18:27:24 +01:00