Commit Graph

569 Commits

Author SHA1 Message Date
46a49efb72 Fix syntax errors 2024-02-15 15:59:07 +01:00
061aba1e1d Fix memory leaks
* libwget/ssl_quic_gnutls.c (wget_ssl_close_quic): new function:
   deinit gnutls_session_t object.
 * libwget/quic.c (quic_stream_mark_acked): free node after dequeue.
   (wget_quic_deinit): deinit gnutls_session_t object.
 * libwget/queue.c (wget_queue_free): remove unused function.
   (wget_queue_free_node): new function: remove a node and its inner
   contents.
   (wget_queue_dequeue_transmitted_node, wget_queue_dequeue_data_node):
   return outer node object, instead of inner data. This makes it easier
   to free the full node & its contents after inspection.
   (wget_queue_enqueue): fix: unnecessary allocation.
 * libwget/http3.c (wget_http3_send_request): fix: free vector after
   use.
   (wget_http3_get_response): free full node after use.
   (wget_http3_get_response_cb): new function.
 * libwget/bytes.c (wget_byte_new): free bytes struct on error.
 * include/wget/wget.h (wget_queue_free): remove unused function.
   (wget_queue_free_node): new function.
   (wget_queue_dequeue_transmitted_node): change return value.
   (wget_queue_dequeue_data_node): change return value.

In addition, create new function wget_queue_free_node.

Introduce a new function that will free the node and its contents all at once.
2024-02-15 15:59:07 +01:00
8d6dffc9fd Parse HTTP3 headers in recv_header_cb using wget_http_parse_header_line() function [skip ci]
* Implemented http3_stream_context and passed it while sending the request.
2024-02-15 15:59:07 +01:00
da79d1debc Set fin flag on a per-stream basis 2024-02-15 15:59:07 +01:00
c08b972015 Coalesce small frames 2024-02-15 15:59:06 +01:00
8d79995fb9 Remove unused wget_ssl_init_quic 2024-02-15 15:59:06 +01:00
08def86d36 Implement connection close 2024-02-15 15:59:06 +01:00
6e3833787a * Added ssl_quic_gnutls.c in the makefile to revert unnecessary changes due to previous rebase [skip ci] 2024-02-15 15:59:06 +01:00
b7ace3ed5e * Documentation for functions added [skip ci] 2024-02-15 15:59:06 +01:00
9626ee4f24 * changes made to discard wget_http3_connection and use wget_http_connection for http3 [skip ci] 2024-02-15 15:59:06 +01:00
2f49af5573 * implemented wget_http3_close [skip ci]
* gaurded http3 functions to check availablility of nghttp3 library
* some functions renamed to keep only specific functions of http3 public
2024-02-15 15:59:06 +01:00
66efdc8994 * changes made as pers suggestions [skip ci]
* restored the original signature of wget_dns_resolve
* added a check in the wget_quic_connect and wget_tcp_connect to check for respective socketypes
2024-02-15 15:59:06 +01:00
750cabc57d * changes made as per suggestions [skip ci]
* wget_http3_get_response returns the data that the http3 client stream has read
* all fprintf converted into debug_printf and error_printf
* fixed issues mentioned in the thread
2024-02-15 15:59:06 +01:00
02a684c5a4 * changes made in the code as per suggestions [skip ci]
* used wget_http_request to create a http3 request
* wget_http3_get_response implemented to read the response
2024-02-15 15:59:06 +01:00
6d22eb5cc0 * read for http3 working
* callback functions for closing the HTTP/3 and QUIC streams to be implemented.
2024-02-15 15:59:06 +01:00
80d394fb5a * ISSUE 1: wget_dns_resolve_quic and wget_dns_resolve issue resolved [skip ci] 2024-02-15 15:59:06 +01:00
d36b687f05 * Changes internal implementation of byte to indicalte type of byte getting stored [skip ci]
* Also changes internal implementation of queue for testing a issue
* ISSUE : Example quic_read_write receives a packet twice
2024-02-15 15:59:06 +01:00
239b236f85 * some callback functions implemented and some improved for nghttp3 as well as ngtcp2 [skip ci]
* implemented a new function wget_quic_stream_set_stream to initialise a new stream with provided
  stream_id and add it to the wget_quic stack
2024-02-15 15:59:06 +01:00
a85f00a8b2 * basic implementation of http3 stack over quic stack completed [skip ci]
* implementated very basic callback functions for http3
* implemented wget_http3_send_request to create a http3 requests
* reimplemented the internal working of wget_queue_peak_untransmitted
* example code for sending http3 request implemented
2024-02-15 15:59:06 +01:00
28b2859c8b * Changes made to fix resending of already sent data in wget_quic_write [skip ci]
* Added a bool in wget_byte struct named transmitted
* Implemented function wget_queue_peak_untransmitted_data
* This function will return first untransmitted byte
* Implemented wget_http3_deinit
2024-02-15 15:59:06 +01:00
214cba0a4d * wget_http3_init implemented [skip ci]
* created http3.c and http3.h and implemented wget_http3_connection_st
* implemented http3 initialisation function to intialise the http3_connection struct
* shifted stream functions to a seperate stream.c file
2024-02-15 15:59:06 +01:00
82a70125c1 * Changes made as per suggestions in wget_quic_rw_once [skip ci]
* wget_quic_rw_once will do read-write cycle once
* changes made for consistency with kernel coding style
2024-02-15 15:59:06 +01:00
e7969a26a8 * wget_quic_once implemented which does a complete write and read cycle [skip ci] 2024-02-15 15:59:06 +01:00
b7631405ac * wget_quic_ack implemented [skip ci]
* The motivation for implementation is multiple number of packets
  sent from server for a single packet sent from client
2024-02-15 15:59:06 +01:00
14e8cb9b4f * Amendments made in the code as per suggestions [skip ci]
* Removed unnecessary getter-setter functions implemented
* implemented getter-setter for config in quic's ssl
2024-02-15 15:59:06 +01:00
5ca1ba884a * wget_quic_read function working [skip ci]
* quic_write_read.c file created to demonstrate the working of wget_quic_read
  and wget_quic_write hand in hand while configuring it to the QUIC ECHO server
2024-02-15 15:59:06 +01:00
d2d785704c * wget_quic_write function working [skip ci]
* quic_write.c file created to make provide a example of write.
* A sample string initially pushed into the stream and then the stream
  structure further utilised for sending the data over socket.
2024-02-15 15:59:06 +01:00
8d1845108b * Changes made in the code as per suggestions
* wget_quic_deinit added
* now the code has only wget_quic struct instead of two structs
* created new file named ssl_quic_gnutls.c
2024-02-15 15:59:06 +01:00
3738a891ba * QUIC Handshake working with QUIC Echo server [skip ci]
* Simplified the implementation of wget_quic_connect() and wget_ssl_quic_connect()
* Segregated the function wget_quic_connect into wget_quic_connect and wget_quic_handshake
2024-02-15 15:59:06 +01:00
11526a7e70 * Added testing code to test wget_quic_connect.
* Test is failing due to retry_aead_ctx issue in handshake_read function
2024-02-15 15:59:06 +01:00
51dcf6c993 * Implemented wget_quic_read. wget2 library integrated with ngtcp2 is ready for building. [skip ci] 2024-02-15 15:59:06 +01:00
b0ba455c47 * Changes made for building the library for testing QUIC. Not Working [skip ci] 2024-02-15 15:59:06 +01:00
db884e88f6 * wget_quic_write implemented [skip ci] 2024-02-15 15:59:06 +01:00
6d64af2982 * Restored signatures of public functions and created seperate file for quic related function. [skip ci]
* Restored signatures of wget_ssl_open and wget_ssl_init and created new functions for quic related SSL set up.
* Moved all the quic related file to a new file named quic.c from net.c
2024-02-15 15:59:06 +01:00
d7a1630726 * Generalised function wget_ssl_init for QUIC as well as TCP. Completed the wget_quic_connect function without handshake. [skip ci] 2024-02-15 15:59:05 +01:00
c5ee1b722f * Altered wget_quic struct to include DNS [skip ci]
* net.c : wget_quic_connect edited to use DNS for resolving
* dns.c : resolve and wget_dns_resolve edited to resolve for SOCK_DGRAM as well as SOCK_STREAM
2024-02-15 15:59:05 +01:00
2bc012b7f6 *Basic implementation of integration with ngtcp2 [skip ci]
*net.c : wget_quic_connet function implemented
*ssl_gnutls.c : wget_ssl_quic_open and wget_ssl_quic_open functions implemented
*queue.c: Implementation of queue using linked list
2024-02-15 15:59:05 +01:00
188989e067 Update copyright year 2024-01-07 12:41:02 +01:00
15ba1db248 Update copyrights 2023-08-31 12:57:30 +02:00
3595963416 Add better default cert/bundle paths for Windows
* include/wget/wget.h: New function wget_ssl_default_cert_dir,
  new function wget_ssl_default_ca_bundle_path.
* libwget/Makefile.am: Add ssl.c.
* libwget/ssl.c: New file for common ssl/tls code.
* libwget/ssl_gnutls.c (tls_init): Initialize cert paths.
* libwget/ssl_openssl.c (tls_init): Likewise.
* libwget/ssl_wolfssl.c (tls_init): Likewise.
* src/options.c (struct config): Init ca_cert,
  (init): Allocate / dup config.ca_cert.

Co-authored-by: Tim Rühsen <tim.ruehsen@gmx.d
2023-08-18 12:40:27 +02:00
0f1abaa11c Fix alternate port requests to proxies
* include/wget/wget.h (wget_http_request_to_buffer): Add param 'port'.
* libwget/http.c (wget_http_request_to_buffer): Likewise,
  (wget_http_send_request): Call wget_http_request_to_buffer with
  connection port.

Copyright-paperwork-exempt: Yes
2023-07-09 12:28:39 +02:00
68a11b7287 Add CIDR support in 'no_proxy' for IPv6
* include/wget/wget.h: Fix http_get_no_proxy -> wget_http_get_no_proxy.
* libwget/http.c: New function cidr_v6_match(),
  check for ipv6 CIDRs in wget_http_match_no_proxy().
* unit-tests/test.c (test_match_no_proxy): Add IPv6 CIDR tests.
2023-06-17 23:50:53 +02:00
6ab47257f0 CIDR support added for no_proxy
* libwget/http.c: Add function wget_http_cidr_match to support
  CIDR IP method for no_proxy
* unit-tests/test.c: Add testcases to verify the functionality
  of the above function

Fixes #615
2023-05-22 17:46:02 +00:00
84d0220e22 New option --dane
* configure.ac: Enable DANE if libgnutls-dane is installed,
  add option --without-libdane.
* docs/wget2.md: Add docs for option --dane.
* include/wget/wget.h: Add WGET_SSL_DANE.
* libwget/ssl_gnutls.c: Include include <gnutls/dane.h> if requested,
  (struct config): New member 'dane',
  (wget_ssl_set_config_int): Set value for dane via WGET_SSL_DANE,
  (wget_ssl_open): Call dane_verify_session_crt().
* src/options.c (options): Add entry for --dane,
  (init): Set config.dane via wget_ssl_set_config_int().
* src/wget_options.h (struct config): Add member 'dane'.
2023-04-23 19:49:12 +02:00
7ab64e25af Change arguments of wget_iri_compare to const
* include/wget/wget.hi (wget_iri_compare): Add 'const' to arguments.
* libwget/iri.c (wget_iri_compare): Likewise.
2022-10-15 19:41:12 +02:00
b89af6d0b8 Introduce XML function to decode entities
* include/wget/wget.h: Add wget_xml_decode_entities_inline().
* libwget/iri.c (iri_unescape_inline): Remove decoding of XML entities.
* libwget/xml.c: Add wget_xml_decode_entities_inline().
* src/wget.c (normalize_uri): Call wget_xml_decode_entities_inline().
2022-09-02 19:51:52 +02:00
2661ab6d47 Support compilation of wget.h from C++
* include/wget/wget.h: Replace restrict with __restrict

Copyright-paperwork-exempt: Yes
2022-08-14 15:07:58 +02:00
9395dd4b79 Implement --check-certificate=quiet
* include/wget/wget.h: Add WGET_SSL_REPORT_INVALID_CERT macro
* libwget/ssl_gnutls.c: Change certificate related error_printf() calls, for error_printf_check()
* libwget/ssl_openssl.c: Consider the case WGET_SSL_REPORT_INVALID_CERT in wget_ssl_set_config_int()
* libwget/ssl_wolfssl.c: Change certificate related error_printf() calls, for error_printf_check()
* src/options.c: Admit quiet as a valid value on --check-certificate
* src/wget_options.h: Move check_certificate from bool to an enum type (with enabled, disabled and log_disabled as values)
2022-07-23 16:28:22 +02:00
3dc7f71098 Update copyright year 2022-02-25 17:46:43 +01:00
20a6046fca Fix issue reported by scan-build
* include/wget/wget.h: /// -> //.
* libwget/netrc.c (unescape_password): Check wget_malloc() return against NULL.
* libwget/xml.c (wget_xml_parse_file): Likewise.
2022-02-19 14:35:40 +01:00