Commit Graph

65 Commits

Author SHA1 Message Date
188989e067 Update copyright year 2024-01-07 12:41:02 +01:00
ec77b3ebf0 * libwget/http_parse.c: Make http_isseparator an inline function 2023-11-17 20:00:00 +01:00
7014ef7a51 * unit-tests/test.c: Add tests for wget_http_parse_full_date() 2023-11-17 19:40:51 +01:00
7bf93ff6c6 Add support for another non-standard cookie timstamp format
- example: Sun Nov 26 2023 21:24:47

* libwget/http_parse.c (wget_http_parse_full_date): Parse additional format.
2023-11-17 19:39:25 +01:00
15ba1db248 Update copyrights 2023-08-31 12:57:30 +02:00
5e08ab0729 * libwget/http_parse.c: Fix sscanf return value check 2022-06-25 19:26:38 +02:00
3dc7f71098 Update copyright year 2022-02-25 17:46:43 +01:00
992cd5fbfd * libwget/http_parse.c (wget_http_parse_response_header): Use keep-alive for HTTP/1.1 and higher as default 2021-12-29 12:54:22 +01:00
4674f314de * libwget/http_parse.c: Remove old comment from RFC 2183. 2021-03-27 20:02:01 +01:00
ccc0092a88 Add test case for Content-Disposition
* libwget/http_parse.c: Update comment with BNF of RFC 6266.
* unit-tests/test.c: Add test for a filename containing space.
2021-03-27 19:59:03 +01:00
22162f82b2 Update copyright year 2021-01-22 21:58:38 +01:00
4c81952449 * libwget/http_parse.c (wget_http_parse_response_header): Fix (harmless !?) UB 2020-12-13 19:42:28 +01:00
ddab633a5d Add new function wget_strmemcpy_a
* include/wget/wget.h: Add prototype of wget_strmemcpy_a.
* src/mem.c: Implement wget_strmemcpy_a.
* libwget/http_parse.c (wget_http_parse_header_line): Use wget_strmemcpy_a.
* src/utils.c (mkdir_path): Likewise.
2020-02-24 16:31:01 +01:00
59d9ecd9c0 * Update copyright year to 2020 2020-01-10 00:33:02 +01:00
bfc4f8a91e * libwget/http_parse.c (wget_http_parse_connection): Allow list of tokens
This change detects the keep-alive flag in headers like
  Connection: Upgrade, Keep-Alive
2019-10-07 15:19:25 +02:00
77c3c33ec8 Use int64_t for time_t to fix 32bit time_t limitations
* include/wget/wget.h: Use int64_t instead of time_t
* libwget/hpkp.c: Likewise
* libwget/hsts.c: Likewise
* libwget/http_parse.c: Likewise
* libwget/ocsp.c: Likewise
* libwget/ssl_gnutls.c: Likewise
* libwget/tls_session.c: Likewise
* src/options.c: Likewise
* src/stats_site.c: Likewise
* src/wget.c: Likewise
* tests/libtest.c: Likewise
* tests/libtest.h: Likewise
* tests/test-plugin-dummy.c: Likewise
* unit-tests/test.c: Likewise
2019-09-23 21:17:38 +02:00
803589baff Fix http date functions to use int64_t instead of time_t
* include/wget/wget.h: Change time_t -> int64_t for wget_http_print_date()
  and for wget_http_parse_full_date()
* libwget/http_parse.c: Likewise
2019-09-23 15:34:03 +02:00
3bd8e6aa97 Implement Accept-Encoding: lzip including decompressor
* README.md: Mention lzip
* configure.ac: Detect lzip
* docs/wget2.md: Document 'lzip'
* include/wget/wget.h: Add wget_content_encoding_lzip
* libwget/decompressor.c: Implement lzip decompression
* libwget/http_parse.c (wget_http_parse_content_encoding): Add "lzip"
* src/options.c: Add code to support lzip
* src/wget.c (http_create_request): Add lzip to Accept-Encoding: if available
* tests/test-compression.c: Add test vector for lzip decompression
2019-09-19 12:58:09 +02:00
08d445e3f6 Use bool instead of char in HSTS code
* include/wget/wget.h: Change param to bool in wget_hsts_db_add_fn(),
  (struct wget_http_response_st): Use bool for hsts_include_subdomains and keep_alive,
  change param to bool in wget_http_parse_strict_transport_security(),
  change param to bool in wget_http_parse_connection()
* libwget/hsts.c: change param to bool in new_hsts(),
  change param to bool in wget_hsts_db_add()
* libwget/http_parse.c: change param to bool in wget_http_parse_strict_transport_security(),
  change param to bool in wget_http_parse_connection()
* tests/test-plugin-dummy.c: change param to bool in test_hsts_db_add()
* unit-tests/test.c (test_hsts): Change type of include_subdomains to bool
2019-09-18 12:44:26 +02:00
4b9edbad2d Update Copyright statements to be compatible with update-copyright module 2019-09-10 23:41:56 +02:00
6047e6a4ca * libwget/http_parse.c (wget_http_parse_response_header): Check memory allocation 2019-08-17 17:42:40 +02:00
c06c90d023 * libwget/http_parse.c (wget_http_parse_header_line): Check memory allocation 2019-08-16 17:42:19 +02:00
b1ef144862 * libwget/http_parse.c: Check memory allocations 2019-08-16 15:24:19 +02:00
65ec4901b4 Remove global wget_iri_schemes[], add wget_iri_scheme enum
* include/wget/wget.h: Remove global wget_iri_schemes[],
  add wget_iri_scheme enum
* libwget/iri.c: Add struct iri_scheme,
  remove wget_iri_schemes and iri_ports,
  new function wget_iri_scheme_get_name(),
  fix code
* examples/check_url_types.c: Use comparison instead of wget_strcasecmp
* fuzz/libwget_iri_fuzzer.c: Use WGET_IRI_SCHEME_HTTPS instead of string
* libwget/http.c: Use wget_iri_scheme_get_name()
* libwget/http.h: Change scheme from string to wget_iri_scheme
* libwget/http_parse.c: Fix wget_http_get_scheme()
* src/blacklist.c: Fix hash_iri()
* src/host.c: Fix _host_hash()
* src/options.c: Use WGET_IRI_SCHEME_* instead of string
* src/stats_server.c: Use wget_iri_scheme for scheme member
* src/wget.c: Fix code
* src/wget_host.h: Use wget_iri_scheme fro scheme member
* unit-tests/test.c: Fix tests
2019-08-13 16:55:53 +02:00
ed9950e95c Use more bool in HPKP code
* include/wget/wget.h: Use bool for HPKP functions where possible
* libwget/hpkp.c: Use bool where possible
* libwget/http_parse.c: Use bool for HPKP functions
2019-08-13 11:20:22 +02:00
efc3e954e3 Add typedef 'wget_transfer_encoding'
* include/wget/wget.h: Add typedef 'wget_transfer_encoding'
* libwget/http_parse.c: Make use of wget_transfer_encoding
2019-08-12 11:44:10 +02:00
ee7fcdc444 Rename wget_vector_destructor_t -> wget_vector_destructor
* include/wget/wget.h: Rename wget_vector_destructor_t -> wget_vector_destructor
* libwget/http.c: Likewise
* libwget/http_parse.c: Likewise
* libwget/vector.c: Likewise
* src/options.c: Likewise
* src/plugin.c: Likewise
* unit-tests/test.c: Likewise
2019-08-12 11:10:10 +02:00
daeb6e1560 Rename wget_vector_compare_t -> wget_vector_compare_fn
* include/wget/wget.h: Rename wget_vector_compare_t -> wget_vector_compare_fn
* libwget/cookie.c: Likewise
* libwget/hpkp.c: Likewise
* libwget/http_parse.c: Likewise
* libwget/metalink.c: Likewise
* libwget/vector.c: Likewise
* src/options.c: Likewise
* tests/test-plugin-dummy.c: Likewise
* unit-tests/test-dl.c: Likewise
* unit-tests/test.c: Likewise
2019-08-12 11:05:56 +02:00
12f1a03693 Changed G_GNUC_WGET prefix to WGET_GCC
* include/wget/wget.h: Changed G_GNUC_WGET prefix to WGET_GCC
* */*.[ch]: Likewise
2019-08-08 17:13:24 +02:00
ab98597170 Rename wget_hpkp_db_t -> wget_hpkp_db and wget_hpkp_t -> wget_hpkp
* include/wget/wget.h: Rename wget_hpkp_db_t -> wget_hpkp_db,
  rename wget_hpkp_t -> wget_hpkp
* fuzz/libwget_hpkp_fuzzer.c: Likewise
* libwget/hpkp.c: Likewise
* libwget/http_parse.c: Likewise
* libwget/ssl_gnutls.c: Likewise
* libwget/ssl_wolfssl.c: Likewise
* src/wget_options.h: Likewise
* tests/test-plugin-dummy.c: Likewise
* unit-tests/test.c: Likewise
2019-08-07 15:33:27 +02:00
74c5f3fa03 Fix parsing Location header with trailign digits
* libwget/http_parse.c (wget_http_parse_location): Replace
  c_isdigits() by c_isblank()
2019-07-25 11:54:13 +02:00
e6aba6bb09 Rename wget_http_connection_t -> wget_http_connection
* include/wget/wget.h: Rename wget_http_connection_t -> wget_http_connection
* examples/check_url_types.c: Likewise
* examples/http_get.c: Likewise
* examples/http_get2.c: Likewise
* examples/http_multi_get.c: Likewise
* examples/websequencediagram.c: Likewise
* examples/websequencediagram_high.c: Likewise
* fuzz/libwget_http_client_fuzzer.c: Likewise
* libwget/http.c: Likewise
* libwget/http_highlevel.c: Likewise
* libwget/http_parse.c: Likewise
* libwget/ssl_gnutls.c: Likewise
* src/wget.c: Likewise
* src/wget_job.h: Likewise
2019-07-19 16:47:01 +02:00
35c18afa13 Rename wget_http_request_t -> wget_http_request
* include/wget/wget.h: Rename wget_http_request_t -> wget_http_request
* examples/http_get2.c: Likewise
* examples/http_multi_get.c: Likewise
* examples/websequencediagram.c: Likewise
* fuzz/libwget_http_client_fuzzer.c: Likewise
* libwget/http.c: Likewise
* libwget/http_highlevel.c: Likewise
* libwget/http_parse.c: Likewise
* libwget/ssl_gnutls.c: Likewise
* src/wget.c: Likewise
* unit-tests/test.c: Likewise
2019-07-19 16:44:21 +02:00
da75b622d6 Rename wget_http_response_t -> wget_http_response
* include/wget/wget.h: Rename wget_http_response_t -> wget_http_response
* examples/batch_loader.c: Likewise
* examples/check_url_types.c: Likewise
* examples/getstream.c: Likewise
* examples/http_get.c: Likewise
* examples/http_get2.c: Likewise
* examples/http_multi_get.c: Likewise
* examples/websequencediagram.c: Likewise
* examples/websequencediagram_high.c: Likewise
* fuzz/libwget_http_client_fuzzer.c: Likewise
* fuzz/libwget_http_parse_fuzzer.c: Likewise
* libwget/http.c: Likewise
* libwget/http_highlevel.c: Likewise
* libwget/http_parse.c: Likewise
* libwget/ssl_gnutls.c: Likewise
* src/gpgme.c: Likewise
* src/stats_site.c: Likewise
* src/wget.c: Likewise
* src/wget_gpgme.h: Likewise
* src/wget_stats.h: Likewise
* tests/test-cookies-http_state.c: Likewise
* unit-tests/test-cookies-http_state.c: Likewise
* unit-tests/test.c: Likewise
2019-07-19 16:41:21 +02:00
5d388d0bbd Rename transfer_encoding_* -> wget_transfer_encoding_*
* include/wget/wget.h: Rename transfer_encoding_* -> wget_transfer_encoding_*
* libwget/http.c: Likewise
* libwget/http_parse.c: Likewise
2019-07-19 16:36:19 +02:00
34182b7706 Rename wget_http_challenge_t -> wget_http_challenge
* include/wget/wget.h: Rename wget_http_challenge_t -> wget_http_challenge
* libwget/http.c: Likewise
* libwget/http_parse.c: Likewise
* src/options.c: Likewise
* src/wget.c: Likewise
* unit-tests/test.c: Likewise
2019-07-19 16:32:07 +02:00
bab564ec1f Rename wget_http_digest_t -> wget_http_digest
* include/wget/wget.h: Rename wget_http_digest_t -> wget_http_digest
* libwget/http_parse.c: Likewise
2019-07-19 16:31:13 +02:00
f119b6c734 Rename wget_http_link_t -> wget_http_link
* include/wget/wget.h: Rename wget_http_link_t -> wget_http_link
* libwget/http_parse.c: Likewise
* src/wget.c: Likewise
2019-07-19 16:29:58 +02:00
42947cfe1a Rename wget_http_header_param_t -> wget_http_header_param
* include/wget/wget.h: Rename wget_http_header_param_t -> wget_http_header_param
* libwget/http.c: Likewise
* libwget/http_highlevel.c: Likewise
* libwget/http_parse.c: Likewise
* src/options.c: Likewise
* src/wget.c: Likewise
2019-07-19 16:28:53 +02:00
7151a01a98 Rename wget_cookie_t -> wget_cookie
* include/wget/wget.h: Rename wget_cookie_t -> wget_cookie
* fuzz/libwget_cookie_fuzzer.c: Likewise
* libwget/cookie.c: Likewise
* libwget/http_parse.c: Likewise
* unit-tests/test.c: Likewise
2019-07-18 13:14:26 +02:00
bdbcbb7992 Rename wget_vector_t -> wget_vector
* include/wget/wget.h: Rename wget_vector_t -> wget_vector
* examples/print_css_urls3.c: Likewise
* fuzz/*.c: Likewise
* libwget/*.c: Likewise
* src/*.c: Likewise
* tests/*.c: Likewise
* unit-tests/*.c: Likewise
2019-07-18 12:35:37 +02:00
517624f22f Typedef vector functions not as pointer
* include/wget/wget.h: Remove '*' signature from function typedefs
* libwget/*.c: Amend casts
* src/*.c: Likewise
* tests/*.c: Likewise
* unit-tests/*.c: Likewise
2019-07-17 12:39:38 +02:00
f8f2f69a9f Simplify vector API
* libwget/vector.c: Use wget_free as default destructor,
  renamed _vec_insert_private() -> insert_element,
  (insert_element): removed args 'size' and 'alloc',
  removed the _noalloc() API,
  removed the 'size' argument from functions,
  added wget_vector_add_memdup() as convenience function,
  renamed _compare() -> compare_element
* include/wget/wget.h: Removed _noalloc() functions
* fuzz/libwget_cookie_fuzzer.c: Amended to new API
* libwget/*.c: Likewise
* src/*.c: Likewise
* tests/*.c: Likewise
* unit-tests/*.c: Likewise
2019-06-26 16:43:20 +02:00
d55c540b1b Simplify hashmap and stringmap API
* include/wget/wget.h: Replace _put() by _put_noalloc() functions to
  keep memory allocations outside the library functions.
* libwget/stringmap.c: Likewise
* libwget/hashmap.c: Likewise
* libwget/*.c: Likewise
* src/*.c: Likewise
* unit-tests/*.c: Likewise
2019-06-21 16:04:29 +02:00
802f2a65a5 Remove xcalloc define for wget_calloc
* libwget/private.h: Remove #define
* libwget/*.c: Replace xcalloc by wget_calloc
2019-06-20 16:50:58 +02:00
cdb3600791 Update copyrigght to 2019 2019-01-02 12:42:53 +01:00
b01d0ce3d0 * libwget/http_parse.c (wget_http_parse_location): Being more lenient
Some servers don't percent encode the URI in a Location: header.
Having spaces in the URI leads to magled file names and likely 404.

Fixes #420
2018-12-20 10:57:31 +01:00
c9796a174d Add zstd decompression (RFC8478)
* README.md: Mention zstandard
* configure.ac: Check for libzstd
* docs/wget2.md: Document new --compression type
* include/wget/wget.h: Add wget_content_encoding_zstd
* libwget/decompressor.c: Implement the zstd decompressor
* libwget/http_parse.c (wget_http_parse_content_encoding): Add zstd
* src/options.c (print_version): Add +/-zstd for --version,
  (parse_compression): Check for wget_content_encoding_zstd,
  (options): Add zstd to help text
* src/wget.c (http_create_request): Add zstd to Accept-Encoding:
* tests/test-compression.c: Add test for zstd
2018-10-12 12:30:44 +02:00
3688ffb941 Update copyright to 2018 2018-04-30 20:52:11 +02:00
62ea505f64 Use libwget's print-like functions instead the stdio ones
* include/wget/wget.h: Amend return type of wget_bar_print(), wget_bar_vprintf()
* libwget/Makefile.am: Replace fprintf in generated css_tokenizer.c
* libwget/bar.c: Replace *printf by wget_*printf,
  (_bar_set_progress): Generate progress bar with memcpy/memset
* libwget/hpkp.c: Replace *printf by wget_*printf
* libwget/cookie.c: Likewise
* libwget/hpkp.c: Likewise
* libwget/hsts.c: Likewise
* libwget/http.c: Likewise
* libwget/http_parse.c: Likewise
* libwget/io.c: Likewise
* libwget/net.c: Likewise
* libwget/ocsp.c: Likewise
* libwget/pipe.c: Likewise
* libwget/ssl_gnutls.c: Likewise
* libwget/utils.c: Likewise
* libwget/xml.c: Likewise

The intention is to not pull in (large) code parts from libc when
linking statically, the performance is better and we have no
portability issues on non-POSIX platforms (e.g. Windows).
2018-03-28 19:24:28 +02:00