Commit Graph

89 Commits

Author SHA1 Message Date
Vincent Sanders
7b2d15a036 Add tests for all asserts in nsurl API and for access and access_leaf 2015-07-09 23:29:44 +01:00
Vincent Sanders
5b09363597 Add asserts to ensure operations not passed bad pointers 2015-07-09 17:44:51 +01:00
Michael Drake
cd1949bc96 Improve component documentation. 2015-07-09 17:24:03 +01:00
Vincent Sanders
ccac301176 Fix a signed comparison error in nsurl parsing.
In utils/nsurl.c the function nsurl__create_from_section() has a
section dealing with non-redundant ports (starting line 973).

lwc_intern_string() was being called with negative lengths and as it
takes a size_t (unsigned) so is getting passed a very large length
which causes a segfault.

this is supposed to be protected by the flag setting on line 969
however the arithmetic is all *unsigned* so the condition never
matches

(gdb) p length - (colon - pegs->at + skip)
$9 = 18446744073709551608

changing the check arithmetic to be a simple comparison against length
prevents this issue and reduces the amount of computation required.
2015-07-04 09:36:46 +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
78663e9111 Remove fragment from nsurl hash. 2015-03-27 11:58:52 +00:00
Vincent Sanders
8e60d32831 remove some warnings from freebsd build 2014-12-21 02:01:45 +00:00
Vincent Sanders
3fc1fe0493 fix dumb mistake in missing a close bracket. 2014-11-04 20:53:19 +00:00
Vincent Sanders
d85b74fd72 change logic to check for false instead of not true to fix coverity 1250328 2014-11-04 20:41:31 +00:00
Michael Drake
07376fc96b Remove unused variable. 2014-10-30 22:47:25 +00:00
Michael Drake
13832a453a Add a nsurl_nice, which can replace url_nice. 2014-10-30 22:34:09 +00:00
Vincent Sanders
c646d05ae5 update nsurl file header to contain references to the specifications it implements 2014-10-29 23:41:13 +00:00
Michael Drake
a807d762f9 mailto urls don't have passwords or ports, so we don't need to look for ':'. 2014-08-04 14:49:35 +01:00
Michael Drake
04ea4b52a0 Add debug. 2014-08-04 14:48:32 +01:00
Michael Drake
f6fec1a8d7 Put ultra-verbose logging inside NSURL_DEBUG #ifdef. 2014-06-09 21:22:25 +01:00
Vincent Sanders
4488c8a2e4 fallback to old url creation behaviour if the IDNA host parse fails 2014-06-09 18:05:36 +01:00
Chris Young
db0856606a IDNA2008 support. 2014-06-04 13:24:24 +01:00
Vincent Sanders
39b0393d31 cleanup utils header, remove cruft and add documentation 2014-05-11 21:31:14 +01:00
Vincent Sanders
20b3c40816 make nsurl_defragment() API more obvious and remove duplicated parameter checking 2014-03-09 16:20:53 +00:00
Michael Drake
1228cd7576 Save a call to lwc_string_length. 2014-02-15 12:39:09 +00:00
Michael Drake
4a59399cd7 Ensure allocation includes space for fragment. 2014-02-15 12:32:59 +00:00
Michael Drake
42be1ffa7b Reject creation of http(s) urls without hosts. 2014-02-11 11:34:10 +00:00
Michael Drake
ae6874d308 Just ref a corestring. 2014-01-24 23:19:46 +00:00
Michael Drake
39cc1a6d4a Add function to get a nsurl's hash value. 2013-05-17 12:25:04 +01:00
John-Mark Bell
a6b08c674f Fix handling of junk input 2013-01-12 20:57:01 +00:00
Michael Drake
8bccf16158 Check if box with imagemap at point has area at point. 2012-11-22 17:40:20 +00:00
Vincent Sanders
7d83151d1a make nsurl_access() not assert with being passed a NULL url as it is assumed elsewhere this will never fail. 2012-11-22 17:04:26 +00:00
Michael Drake
9ab851a5a9 Fix join with rel part of " ". Add a few tests. 2012-11-02 10:54:34 +00:00
Michael Drake
a526209e74 More useful title info for images. 2012-10-24 18:22:45 +01:00
Michael Drake
d84e3fd773 Add nsurl_replace_query. Add tests. Make tester itterate remaining lwc_strings. 2012-10-11 19:23:22 +01:00
Michael Drake
93ee8f48c1 Fix dead store. 2012-10-11 14:11:49 +01:00
Michael Drake
20425b6914 Ensure non-void functions have a return at the end, even though it shouldn't get there, to squash warning. 2012-10-11 11:58:27 +01:00
Michael Drake
40343b740d Add nusrl_parent function, to get parent path URL. 2012-10-06 14:06:38 +01:00
Michael Drake
3d337642bd Don't let it read off the front of empty relative URLs. 2012-10-02 20:20:38 +01:00
Michael Drake
b0ca8175bb Dodge a clang warning. 2012-08-09 17:44:59 +01:00
Daniel Silverstone
9dc9e36bc3 Fix FTP detection. Thanks to Etienne Cochard <etienne.cochard@gmail.com> for spotting the bug.
svn path=/trunk/netsurf/; revision=13930
2012-05-23 10:34:30 +00:00
François Revel
57676ad1c0 Reworked r13532 in a cleaner way. The FLEX_ARRAY_LEN_DECL macro from utils.h should be used when declaring an empty array at end of struct.
svn path=/trunk/netsurf/; revision=13535
2012-03-19 18:24:43 +00:00
François Revel
3d3bb0c5cf Workaround use of C99 flex array. gcc2 did not support it, only 0-len arrays. Possibly a FLEX_ARRAY_LEN macro could be defined in utils.h instead.
svn path=/trunk/netsurf/; revision=13532
2012-03-19 02:45:53 +00:00
John Mark Bell
6ef2df13f7 Fix const correctness
svn path=/trunk/netsurf/; revision=13228
2011-12-04 11:12:17 +00:00
Michael Drake
714f07c48b Rename nsurl_enquire to nsurl_has_component.
svn path=/trunk/netsurf/; revision=13183
2011-11-27 18:32:06 +00:00
Michael Drake
de10eff59c Don't escape '|'.
svn path=/trunk/netsurf/; revision=13162
2011-11-23 16:27:20 +00:00
Michael Drake
04f6957141 Fix handling of bad mailto: urls.
svn path=/trunk/netsurf/; revision=13113
2011-11-03 12:15:32 +00:00
Michael Drake
3ecf3c1eaf Fix empty port separator and redundant port removal when credentials are present.
svn path=/trunk/netsurf/; revision=13108
2011-10-31 22:23:02 +00:00
Michael Drake
a4dc04e44a Test numbers before calling strncmp.
svn path=/trunk/netsurf/; revision=13107
2011-10-31 22:17:05 +00:00
Michael Drake
d64e09aef7 Make sure port's just 80, before removing in http case.
svn path=/trunk/netsurf/; revision=13106
2011-10-31 22:13:38 +00:00
Michael Drake
ea761e16e6 nsurl optimisation: Remove a load of branches into fewer.
svn path=/trunk/netsurf/; revision=13105
2011-10-31 22:02:40 +00:00
Michael Drake
3936e6df15 Remove some code that's not needed. Fix redundant port handling.
svn path=/trunk/netsurf/; revision=13104
2011-10-31 21:47:10 +00:00
Michael Drake
c6f13db858 Don't need to generate string from scratch in nsurl_defragment, just copy.
svn path=/trunk/netsurf/; revision=13103
2011-10-31 21:27:11 +00:00
Michael Drake
f980e6015f nsurl optimisation: Don't use separate allocations for nsurl strings.
svn path=/trunk/netsurf/; revision=13102
2011-10-31 21:13:29 +00:00
Michael Drake
a112bfb676 Function for adding fragment onto nsurl.
svn path=/trunk/netsurf/; revision=13087
2011-10-28 19:18:14 +00:00