Commit Graph

191 Commits

Author SHA1 Message Date
Michael Drake
c987b043b1 Clean up print format specifier usage 2023-06-17 11:20:09 +01:00
DeltaVonNeumann
a16d5ff10b Avoid integer types with platform dependent size 2023-06-17 10:29:39 +01:00
John-Mark Bell
85da9873f7 fetchers/curl: disable TLS1.0 and TLS1.1 support 2022-11-05 12:42:15 +00:00
John-Mark Bell
69adc31d07 inttypes: custom format for UnixLib ssize_t
UnixLib defines ssize_t to be a long int, which forces the
corresponding format string to need to be %ld to avoid compiler
warnings. Making this change uncovered a number of places where
we were using the wrong format specifier entirely (namely
PRIssizet where we meant PRIsizet). Fix these, too.
2022-06-03 02:34:22 +01:00
Vincent Sanders
5a2f69388c hoist the Referer header generation logic up to the low level cache
This removes the need for the fetchers to have any interaction with
 the Referer header. It has not been completely removed from the
 fetch interface as fetch.c:fetch_set_cookie() still uses it for
 unverifiable cookie decision logic. (There is an anchient todo here)
2021-03-25 23:36:41 +00:00
Daniel Silverstone
b4c99f9e57
llcache: Free existing chain if we get a new one
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2020-05-24 17:01:05 +01:00
Daniel Silverstone
bb5d5562bc
llcache: Actually pass on certificate chain properly
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2020-05-04 18:29:33 +01:00
Michael Drake
f840833723 Low level cache: Squash use of uninitialised value.
Coverity issue:

CID 1419828:  Memory - corruptions  (UNINIT)
>>>     Using uninitialized value "output_length".
2020-02-24 15:37:20 +00:00
Daniel Silverstone
ac75a9161e
llcache: Persist anything available during llcache_finalise
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2020-02-23 20:59:40 +00:00
Vincent Sanders
0c34d06494 Keep the complete certificate chain from a fetch
Instead of extracting information from the X509 certificate chain in
the fetcher the entire chain is propagated in Distinguished Encoding
Rules (DER) format.

This allows all the information contained in a certificate chain to be
retained which can subsequently be presented to the user
2020-02-23 16:23:50 +00:00
Daniel Silverstone
ea142abdd0 llcache: Reload SSL certificate data from serialised store
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2019-11-30 14:21:41 +00:00
Daniel Silverstone
0c0b9faddd llcache: Persist SSL certificate data
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2019-11-30 14:21:41 +00:00
Daniel Silverstone
f49654cfc5 llcache: Support storing SSL certificate data
In order to support persisting SSL data we first have to store it
and support catching up new users.

Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2019-11-30 14:21:41 +00:00
Michael Drake
ad27ed6926 llcache: Avoid putting local content in the disc cache. 2019-11-10 16:49:05 +00:00
Michael Drake
26d7a167ae llcache: Split out scheme is cachable check. 2019-11-10 16:49:05 +00:00
Michael Drake
301b0bae00 llcache: URLs with data scheme are cachable. 2019-11-10 14:36:40 +00:00
Michael Drake
885897f610 llcache: Uncachable scheme checks don't need to be caseless. 2019-11-09 17:14:37 +00:00
Michael Drake
52805a7860 llcache: Allow file and resource schemes to be cached.
This means things like the default css file and adblock css file
are only loaded and parsed once.
2019-11-09 17:08:43 +00:00
Vincent Sanders
1176ce4271 Improve timeout error messaging 2019-10-28 23:50:01 +00:00
Daniel Silverstone
8469f4cc8e Reimplement handling of BAD_AUTH inside browser_window
We now handle authentication requests via an `about:` page
which presents a nice form built into the browser window.
In order to do this, we add internal navigation as a concept
to the browser window and we strip the 401login support from all
frontends except monkey.

The 401login callback is now intended for password safe type support
rather than an immediately interactive prompt.

Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2019-08-06 11:26:47 +01:00
Daniel Silverstone
170dc5d524 Excise the llcache query pathway.
In further preparation for the auth and cert queries being handled
as special contents from `about:` this excises the query pathway
from the llcache pretty much entirely.

Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2019-08-05 20:56:07 +01:00
Daniel Silverstone
bfb1bb1192 Migrate SSL certificate storage to the browser window
* Fetchers now provide the certificates before headers
* This is propagated all the way to the browser window
* When a query occurs, we retrieve it from there and fire
  the query with those stored certificates.
* The serial number is a bignum, store it as hex.

Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2019-08-05 18:12:47 +01:00
Daniel Silverstone
6b4610edc9 llcache: Do not delete objects if they were iterator targets
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2019-08-04 11:22:40 +01:00
Daniel Silverstone
386d803371 llcache: pass the cb_pw in query_finished
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2019-08-04 11:22:40 +01:00
Daniel Silverstone
09eb89e3c3 Migrate query dispatch up from llcache to hlcache
As a first step in refactoring query handling to be managed
by `browser_window`, this migrates the calling of the query
handler from the llcache object code up to the hlcache.

In theory this may result in multiple queries happening for one
object, but we mitigate multiple-responses in the llcache so
all should be well.

Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2019-08-03 21:13:19 +01:00
Daniel Silverstone
4421d1bab6 llcache: Ensure we preserve iteratorness when sending messages
In order to prevent a problem where iterating causes an abort
which causes an iteration which clears the iteratorness of a
user allowing it to delete itself causing a segfault, preserve
the iteratorness when iterating in send_message

Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2019-08-02 16:57:55 +01:00
Daniel Silverstone
d196dee05b llcache: Use last_modified instead of date
When sending an If-Modified-Since header we should use the
`last_modified` rather than the `date` property of the cached
object in order to not incorrectly assume things have a modification
date when they do not.

Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2019-08-02 12:22:30 +01:00
Daniel Silverstone
659c9161ee llcache: Abort cleanly if called back during shutdown
In order to help us debug shutting down with active fetches, this
will abort the process cleanly if we get a callback to an "active"
llcache handle after the abort process has actually killed them
all.  This can happen with deferred fetcher aborts in the cURL
fetcher.

Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2019-06-15 21:13:09 +01:00
John-Mark Bell
c1dc4e61bd LLCache: validate max-age before use 2019-06-10 21:36:52 +00:00
John-Mark Bell
047c82cfce LLCache: use Cache-Control parser 2019-06-10 21:02:26 +00:00
Vincent Sanders
9893b05b08 use jmb suggested fix to cache-control header parse error 2019-06-10 21:58:46 +01:00
Vincent Sanders
e598dcd139 fix parsing of invalid syntax max-age value Cache-control header 2019-06-10 20:53:12 +01:00
Vincent Sanders
5f1defd4a7 fix size_t format specifiers 2018-08-18 23:44:15 +01:00
Vincent Sanders
92424b6946 refactor llcache header processing
refactor the header processing in the low level object cache to make
 cache control header processing more explicit.
2018-08-12 12:50:57 +01:00
John-Mark Bell
103c015784 HSTS: make llcache update policy on 3xx responses 2018-04-22 11:39:12 +00:00
John-Mark Bell
ec1936cc93 HSTS: prevent llcache being nice
If the server has defined a HSTS policy, then the user no longer
gets to click-through a garbage certificate. Additionally, if
the server has provided a HSTS policy, it should do TLS properly,
so don't permit client-driven TLS version downgrades in that case,
either.
2018-04-22 11:39:12 +00:00
John-Mark Bell
83f5332708 HSTS: teach llcache to update and enforce policy. 2018-04-22 11:39:12 +00:00
John-Mark Bell
badc0d437a LLCache: correct typos/grammar/etc. 2018-04-22 11:16:26 +00:00
Michael Drake
e418416c77 Squash remaining GCC7 -Wimplicit-fallthrough warnings. 2017-10-23 09:46:02 +01:00
Vincent Sanders
8b88e44090 fix time_t logging 2017-09-08 20:47:22 +01:00
Daniel Silverstone
50cbb98941 Hopefully quash warning about time_t formatting on openbsd 2017-09-08 19:38:11 +01:00
Vincent Sanders
72e6050eb3 add low level cache category and use it 2017-09-06 18:45:35 +01:00
Vincent Sanders
75018632a9 Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done

@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 18:45:27 +01:00
Vincent Sanders
6075feb487 create netsurf inttypes header to have portable integer formatting macros 2017-01-21 14:20:55 +00:00
Vincent Sanders
b3042f6c1f fix spelling in low level cache code 2016-11-20 15:38:14 +00:00
Vincent Sanders
b939afe3fc Allow certificate verification user prompt creation to return errors 2016-07-31 13:25:20 +01:00
Vincent Sanders
fe7eb85614 move misc header into public API 2016-05-30 11:23:32 +01:00
Vincent Sanders
0bc5d2ca4c create date and time to seconds since epoch processing utility function
currently NetSurf uses curl_getdate to convert textural date and time
strings into seconds since epoch. It is betetr to move this
functionality to a utility function so curl_getdate can easily be
replaced if required.
2016-04-16 23:50:22 +01:00
Vincent Sanders
33c7df0c40 complete the rename of the gui browser table
When the operations tables were created the browser table was renamed
to miscellaneous except the actual rename patch was never applied,
this fixes that situation.
2016-04-16 23:50:21 +01:00
Vincent Sanders
d15ab96a51 Fix size_t printf formatting
The printf formatting for size_t is set in c99 as %zu but in windows
it is %Iu this is solved by adding and inttypes style PRI macro for size_t

This also uses this macro everywhere size_t is formatted.
2016-03-17 22:00:54 +00:00