Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
13 check-ins
|
2026-11-02
| ||
| 14:58 |
portability: include xlocale.h for the _l date functions on macOS
macOS declares strptime_l() and strftime_l() in <xlocale.h>, not in <time.h> like the BSDs and glibc do. leaf check-in: 036225132b user: bapt tags: trunk | |
| 14:57 |
date: parse and format HTTP dates in the C locale
HTTP dates are English by definition, but strptime() and strftime() with %a and %b follow LC_TIME. Under a French locale the Last-Modified and If-Modified-Since dates were neither parsed nor produced correctly. Use strptime_l() and strftime_l() with a cached C locale instead of touching the global locale, which a library shared between threads must not do. musl has no locales: the plain calls are already the C locale there. check-in: 91a54f029e user: bapt tags: trunk | |
| 14:42 |
portability: build on macOS
macOS has no SOCK_CLOEXEC and no pthread_condattr_setclock. Create the socket without the flag and set FD_CLOEXEC with fcntl, and use a relative condition wait (pthread_cond_timedwait_relative_np) since the condition variable cannot be bound to the monotonic clock. check-in: 773c600627 user: bapt tags: trunk | |
| 14:39 |
auth: report a challenge with no supported scheme
When a server only offers a scheme this library cannot answer (Bearer, for instance), http_authorize() and http_authorize_proxy() returned -1 without setting the error, so callers saw an empty failure and could not tell it apart from a transport error. Report HTTP_E_AUTH, which is what the callers use to decide that the response belongs to them. check-in: 23c5e56de8 user: bapt tags: trunk | |
| 14:37 |
http: do not require a connection on a produced response
After a 401 handed back to the caller, the connection is already back in the pool, so resp->conn is NULL and the final sanity check reported "no response after retries" even though a response was there. Only treat the absence of a connection as an error when no status was received at all. check-in: e0a4e081b7 user: bapt tags: trunk | |
| 14:35 |
http: return the 401 when no credentials are available
A 401 without usable credentials made http_perform() fail and discard the response, so a caller could not see the status or the WWW-Authenticate challenge. An HTTP status is not a transport error: keep it for the caller, and only report a failure when credentials were supplied and rejected. Covered by a new test for the HTTP/1.1 path; the HTTP/2 path follows the same rule. check-in: 7e8a6d3bd5 user: bapt tags: trunk | |
| 14:33 |
tls: accept a partially parsed CA bundle
mbedtls_x509_crt_parse_file() returns a negative count when some of the certificates in a bundle cannot be parsed, but it still loads the others. Treating any non-zero return as a failure made every request fail on a stock Debian bundle, where a couple of certificates use algorithms this build does not implement. Consider the chain usable as soon as at least one certificate was loaded, both for the default bundle and for an explicit ca_file or ca_path. check-in: 11291791ab user: bapt tags: trunk | |
| 13:58 |
http: let callers walk the response headers
http_resp_header() only answers for a known name, so a caller that mirrors the headers elsewhere (an HTTP adapter, a logger) cannot enumerate them. Add http_resp_header_count() and http_resp_header_at(), and keep the header list opaque otherwise. check-in: 1882846953 user: bapt tags: trunk | |
| 13:57 |
http: add HTTP_CTX_NO_REDIRECT
A caller that wants to see the 3xx response itself, as libcurl does by default, had no way to ask for it: max_redirects of zero means the built-in default of 16. Add a context flag that stops the redirect loop after the first response, leaving the 3xx status and its body to the caller. check-in: 3a80bdb32b user: bapt tags: trunk | |
| 13:48 |
tls: add an mbed TLS backend and drop OpenSSL from the rest
The TLS interface introduced in the previous commit makes a second backend possible. Add tls_mbedtls.c, driven through the non-blocking mbed TLS API: the BIO callbacks translate EAGAIN into WANT_READ and WANT_WRITE, so the caller keeps driving the loops as with libssl. A context keeps two mbed TLS configurations, one offering h2 and one offering http/1.1 only, because ALPN is part of the configuration and the configuration is shared by every connection. HTTP authentication was the other OpenSSL user: auth.c called EVP_Digest, EVP_EncodeBlock and RAND_bytes. Bundle MD5 and SHA-256 (Brad Conte, public domain), a base64 encoder and a random helper in src/crypto.c, so that TLS=mbedtls needs no OpenSSL at all. The random helper never opens a file (arc4random_buf, then getrandom), because the library must keep working in capability mode. Both backends pass the whole suite. The TLS test servers stay on OpenSSL, which makes the mbed TLS client run against an OpenSSL server. check-in: 79c02a0599 user: bapt tags: trunk | |
| 13:40 |
tls: add a backend interface and move OpenSSL behind it
conn.c called SSL_read/SSL_write directly and http_int.h included <openssl/ssl.h>, so the TLS implementation leaked into the whole library: every translation unit needed the OpenSSL headers, and the connection state carried an SSL pointer. Add src/tls.h: an opaque context and connection, with handshake, read, write, pending, shutdown and ALPN accessors. They return HTTP_TLS_OK, WANT_READ, WANT_WRITE, EOF or ERROR, so the retry loop, the polling and the timeouts stay in conn.c and the backend never calls back into it. The existing code moves verbatim to tls_openssl.c, still the default backend. The Makefile picks the implementation with TLS=openssl or TLS=mbedtls, and only one is compiled in. check-in: 374105c790 user: bapt tags: trunk | |
|
2026-10-31
| ||
| 20:52 | Initial import of libhttp check-in: 5ec3e6878d user: bapt tags: trunk | |
| 20:52 | initial empty check-in check-in: 0f1d96ac3c user: bapt tags: trunk | |