* libwget/cookie.c: Use atoll() instead of atol()
* libwget/hsts.c: Likewise
* libwget/http.c: Likewise
* libwget/ocsp.c: Likewise
* libwget/tls_session.c: Likewise
* libwget/hpkp.c: Change type of maxage from long to time_t
* libwget/cookie.c: Write time_t as long long int
* libwget/hsts.c: Likewise
* libwget/ocsp.c: Likewise
* libwget/tls_session.c: Likewise
* libwget/hpkp.c: Read and write time_t as long long int
Reported-By: Tim Rühsen
* examples/http_get2.c: Use wget_cookie_db_free() to free cookie db
* libwget/cookie.c (wget_cookie_db_init): Fix #ifdef around PSL code
* libwget/init.c (wget_global_deinit): Use wget_cookie_db_free()
* libwget/cookie.c (_compare_cookie{,2}): Mark as pure
* libwget/encoding.c (_utf8_is_valid): Same
* libwget/hsts.c (_compare_hsts): Same
* libwget/ocsp.c (_compare_ocsp): Same
* libwget/netrc.c (_compare_netrc): Same
* libwget/tls_session.c (_compare_tls_session): Same
* libwget/cookie.c (_wget_cookie_normalize_cookie): Add checks
for __Secure- and __Host- prefixes.
* tests/test.c (test_cookies): Add test cases for the prefixes.
This change implements proposals from draft-ietf-httpbis-cookie-prefixes-00
as modern browsers do.
* include/libwget.h.in: Add sort_age to struct wget_cookie_st
* libwget/cookie.c: Many code enhancements
* libwget/http.c (wget_http_parse_setcookie): Relax parsing,
(wget_http_parse_setcookie): Allow \n and \r\n as EOL
* libwget/private.h: Add missing #includes
* tests/Makefile.am: Add disabled test-cookies-http_state
* tests/test-cookies-http_state.c: New cookie test
There still 30 out of 220 tests failing, before this commit we had
135 failing. The left over tests are mainly corner cases, but feel free
to work on it. When all tests pass, we enable test-cookies-http_state
in Makefile.am.
Removed wget_buffer_vprintf_append, wget_buffer_printf_append,
wget_buffer_vprintf2 and wget_buffer_printf2.
Renamed their *2 counterpart to their old names.
Cookies: Add new function wget_cookie_set_keep_session_cookies()
and adjust wget_cookie_db_load() and wget_cookie_db_save().
Use wget_update_file() for loading and saving.
* examples/getstream.c, examples/print_css_urls2.c, libwget/cookie.c,
libwget/css_url.c, libwget/encoding.c, libwget/hsts.c,
libwget/html_url.c, libwget/http.c, libwget/metalink.c,
libwget/ocsp.c, libwget/robots.c, libwget/ssl_gnutls.c,
src/options.c, src/wget.c, tests/stringmap_perf.c,
tests/test-wget-1.c
Strndup() calls an additional strlen() on the input string.
This is normally not needed, and thus just consumes CPU cycles.
All calls to strndup() could be replaced by wget_strmemdup, which
basically allocates len+1 memory, calls memcpy and terminates with
a 0 byte.