Commit Graph
131 Commits
Author SHA1 Message Date
Claude 9868ae2e33 Implement HTTP client in consistent style with server.c
Refactored HTTP client implementation to follow the same coding
patterns and style as server.c:

- Added static helper functions (http_client_conn_init,
  http_client_conn_free, check_response_buffer, request_builder_to_conn)
- Implemented buffer limit setters (http_client_set_input_limit,
  http_client_set_output_limit)
- Fully implemented request builder API (url, header, body, send)
- Implemented event processing with state machine approach
- Added connection reuse support via http_free_response
- Used consistent naming, formatting, and error handling patterns
- Renamed builder_to_conn to request_builder_to_conn to avoid
  symbol conflicts with server.c during amalgamation

The implementation follows the same architecture as the server:
- Connection state machine for managing request/response lifecycle
- ByteQueue for input/output buffering
- Ready queue for completed responses
- Generation counters for builder validation
- Socket manager integration for async I/O
2025-11-21 19:17:18 +00:00
Claude 2d407b63c2 Fix TODOs unrelated to HTTP client
- Add documentation comments for print_bytes() and HTTP_UNPACK macro in src/basic.h
- Improve error handling in src/socket.c: add checks for ioctlsocket, socket creation,
  and connection failures; implement socket_manager_wakeup with proper signaling;
  consume wakeup signals; add memory cleanup for registered names
- Add header validation in src/server.c to prevent HTTP response splitting attacks
- Enhance HTTP parsing in src/parse.c: support percent-encoded characters in userinfo,
  expand HTTP methods without request bodies, add response body detection logic,
  improve cookie parsing comments
- Document unused 'ad' parameter in src/secure_context.c SNI callback
2025-11-21 19:07:51 +00:00
cozis ccdd573e90 Add HTTPS support 2025-11-21 19:52:28 +01:00
cozis 3f76d1827e Add .gitignore and resolve simple TODOs 2025-11-21 18:39:28 +01:00
cozis 3c2ef70c66 Fix compiler errors 2025-11-21 18:30:35 +01:00
cozis aab1b8e7b8 Fix more compilation errors 2025-11-21 15:12:32 +01:00
Claude 93ccb5d6a1 Fix minor refactoring errors
Minor fixes:
- Add missing includes in src/includes.h (stdbool, string, stdlib, poll, fcntl, errno, netdb, arpa/inet, netinet/in)
- Fix empty Mutex struct in src/thread.h
- Fix String -> HTTP_String typos in 5 source files
- Fix server_secure_context_add_certificate missing key_file parameter

Non-trivial issues remain (see PR description for details)
2025-11-21 12:15:11 +00:00
cozis 879dc74e34 First version of the refactor 2025-11-21 12:53:03 +01:00
cozis 7be22fed4b Add comment to 060_virtual_hosts_over_https.c about adding entries to /etc/hosts for testing 2025-10-17 12:21:26 +02:00
cozis 17ad7ad383 Add http_match_host and update 060_virtual_hosts_over_https.c 2025-10-17 12:10:35 +02:00
cozis e26042e2e7 Allowing switching HTTPS builds on/off using the HTTPS Makefile parameter 2025-10-17 11:36:23 +02:00
cozis 13c578d347 Remove router 2025-10-17 10:50:49 +02:00
cozis a4f8f3abb7 Fix missing definition of SIZEOF 2025-09-23 09:44:36 +02:00
cozis b985a5faae Add HTTP_NOINCLUDE option 2025-09-23 09:36:40 +02:00
cozis 477d4bec4c Remove duplicate declaration of is_digit 2025-09-23 09:36:27 +02:00
cozis dc5376f8f3 Update chttp.c/.h 2025-09-23 09:35:36 +02:00
cozis d2fa677ac8 Add http_get_cookie, http_get_param, http_get_param_i 2025-09-21 10:47:48 +02:00
cozis b1021deb15 Add secure field to HTTP_Request to mark whether the underlying connection uses TLS or not 2025-09-18 09:19:38 +02:00
cozis a63e68f969 Add support for Transfer-Encoding 2025-07-28 16:32:31 +02:00
cozis 5d12070a29 Bug fix 2025-07-22 13:57:53 +02:00
cozis b99c4e9ccb Add beta-quality disclaimer 2025-07-22 12:25:47 +02:00
cozis 25f52444dd Add disclaimer 2025-07-22 12:19:20 +02:00
cozis 5c1cca6a2f Update README 2025-07-22 12:13:21 +02:00
cozis 536657b9ed Update README 2025-07-22 12:11:49 +02:00
cozis b73ad9f234 Update README 2025-07-22 12:07:26 +02:00
cozis 6412aab833 Update README 2025-07-22 12:03:49 +02:00
cozis f888b6b0a0 Update README 2025-07-22 12:02:09 +02:00
cozis 038df69372 Update README 2025-07-22 11:45:24 +02:00
cozis f810d284a9 Update README 2025-07-22 11:37:05 +02:00
cozis 2ec5c807fc Update README 2025-07-22 11:33:08 +02:00
cozis ecf5bedc43 Update README and move files to misc/ 2025-07-22 11:30:47 +02:00
cozis b7d8b82ec0 Remove resolved TODOs from the list 2025-07-21 23:33:28 +02:00
cozis c134de645b Rename HTTP_ResponseHandle to HTTP_ResponseBuilder 2025-07-21 23:30:32 +02:00
cozis a67d4dea9f Bug fixes 2025-07-21 23:19:11 +02:00
cozis 43627f81ab Initialize global state in the server examples 2025-07-21 22:56:12 +02:00
cozis 254bcbd666 Update README 2025-07-21 22:52:00 +02:00
cozis 73263da2c9 Fix the HTTPS build 2025-07-21 22:42:43 +02:00
cozis 51d0729aaf Fix Linux build bug 2025-07-21 21:58:26 +02:00
cozis 17b4c3d91a Improve windows support 2025-07-21 21:54:56 +02:00
cozis 58f8ace725 Add global state initialization functions 2025-07-21 21:37:02 +02:00
cozis a2912b5191 Refactoring for an improved event loop 2025-07-21 20:29:35 +02:00
cozis 5cb3977c3c Fix windows compilation errors 2025-07-21 12:06:23 +02:00
cozis acf4746611 Simplify amalgamation script 2025-07-21 02:21:33 +02:00
cozis c3bfb86707 Fix compiler errors 2025-07-20 23:53:23 +02:00
cozis 3b196546da Simplify print statements by using HTTP_UNPACK 2025-07-20 21:29:41 +02:00
cozis 1c6c0a75cf Remove compilation artifacts 2025-07-20 21:25:06 +02:00
cozis 3201eac013 Fix compiler errors 2025-07-20 21:19:58 +02:00
cozis 01bf34b58d Update README 2025-07-20 20:46:30 +02:00
cozis 8010e0ec1b Update README 2025-07-20 20:45:34 +02:00
cozis 9df891b409 Update README 2025-07-20 20:44:04 +02:00