time_t max_time; /* Maximum end time of current transfer, or 0 */
time_t max_total_time; /* Maximum end time of total transfer, or 0 */
char *redirection_url; /* Location obtained from HTTP status 301/302 */
- size_t max_hdr_lines; /* Max. number of http hdr lines, or 0 */
+ size_t max_hdr_lines; /* Max. number of response header lines, or 0 */
};
/* HTTP states */
resp_hdr_lines++;
if (rctx->max_hdr_lines != 0 && rctx->max_hdr_lines < resp_hdr_lines) {
ERR_raise(ERR_LIB_HTTP, HTTP_R_RESPONSE_TOO_MANY_HDRLINES);
- OSSL_TRACE(HTTP, "Received too many headers\n");
rctx->state = OHS_ERROR;
return 0;
}
if (OSSL_TRACE_ENABLED(HTTP))
OSSL_TRACE(HTTP, "]\n");
- resp_hdr_lines = 0;
-
if (rctx->keep_alive != 0 /* do not let server initiate keep_alive */
&& !found_keep_alive /* otherwise there is no change */) {
if (rctx->keep_alive == 2) {
OSSL_HTTP_REQ_CTX_get0_mem_bio,
OSSL_HTTP_REQ_CTX_get_resp_len,
OSSL_HTTP_REQ_CTX_set_max_response_length,
-OSSL_HTTP_is_alive,
-OSSL_HTTP_REQ_CTX_set_max_response_hdr_lines
+OSSL_HTTP_REQ_CTX_set_max_response_hdr_lines,
+OSSL_HTTP_is_alive
- HTTP client low-level functions
=head1 SYNOPSIS
size_t OSSL_HTTP_REQ_CTX_get_resp_len(const OSSL_HTTP_REQ_CTX *rctx);
void OSSL_HTTP_REQ_CTX_set_max_response_length(OSSL_HTTP_REQ_CTX *rctx,
unsigned long len);
-
- int OSSL_HTTP_is_alive(const OSSL_HTTP_REQ_CTX *rctx);
-
void OSSL_HTTP_REQ_CTX_set_max_response_hdr_lines(OSSL_HTTP_REQ_CTX *rctx,
size_t count);
+ int OSSL_HTTP_is_alive(const OSSL_HTTP_REQ_CTX *rctx);
+
=head1 DESCRIPTION
B<OSSL_HTTP_REQ_CTX> is a context structure for an HTTP request and response,
response content length for I<rctx> to I<len>. If not set or I<len> is 0
then the B<OSSL_HTTP_DEFAULT_MAX_RESP_LEN> is used, which currently is 100 KiB.
+OSSL_HTTP_REQ_CTX_set_max_response_hdr_lines() changes the limit for
+the number of HTTP header lines allowed to be received in a response.
+The default limit is B<OSSL_HTTP_DEFAULT_MAX_RESP_HDR_LINES>, currently 256.
+If the limit is not 0 and the number of lines exceeds the limit,
+then the HTTP_R_RESPONSE_TOO_MANY_HDRLINES error is indicated.
+Setting the limit to 0 disables the check.
+
OSSL_HTTP_is_alive() can be used to query if the HTTP connection
given by I<rctx> is still alive, i.e., has not been closed.
It returns 0 if I<rctx> is NULL.
for any reason at the server side, it will notice this obtaining an
I/O error when trying to send the next request via I<rctx>.
-The OSSL_HTTP_REQ_CTX_set_max_response_hdr_lines() function changes the limit
-for the number of HTTP headers which can be received in a response. The default
-value is 256. If the number of HTTP headers in a response exceeds the limit,
-then the HTTP_R_RESPONSE_TOO_MANY_HDRLINES error is indicated. Setting the
-limit to 0 disables the check.
-
=head1 WARNINGS
The server's response may be unexpected if the hostname that was used to
OSSL_HTTP_REQ_CTX_new() returns a pointer to a B<OSSL_HTTP_REQ_CTX>, or NULL
on error.
-OSSL_HTTP_REQ_CTX_free() and OSSL_HTTP_REQ_CTX_set_max_response_length()
-do not return values.
+OSSL_HTTP_REQ_CTX_free(), OSSL_HTTP_REQ_CTX_set_max_response_length(), and
+OSSL_HTTP_REQ_CTX_set_max_response_hdr_lines() do not return values.
OSSL_HTTP_REQ_CTX_set_request_line(), OSSL_HTTP_REQ_CTX_add1_header(),
OSSL_HTTP_REQ_CTX_set1_req(), and OSSL_HTTP_REQ_CTX_set_expected()
=head1 HISTORY
-The functions described here were added in OpenSSL 3.0.
+OSSL_HTTP_REQ_CTX_set_max_response_hdr_lines() was added in OpenSSL 3.3.
+
+All other functions described here were added in OpenSSL 3.0.
=head1 COPYRIGHT
size_t OSSL_HTTP_REQ_CTX_get_resp_len(const OSSL_HTTP_REQ_CTX *rctx);
void OSSL_HTTP_REQ_CTX_set_max_response_length(OSSL_HTTP_REQ_CTX *rctx,
unsigned long len);
+void OSSL_HTTP_REQ_CTX_set_max_response_hdr_lines(OSSL_HTTP_REQ_CTX *rctx,
+ size_t count);
int OSSL_HTTP_is_alive(const OSSL_HTTP_REQ_CTX *rctx);
/* High-level HTTP API */
const char *OSSL_HTTP_adapt_proxy(const char *proxy, const char *no_proxy,
const char *server, int use_ssl);
-void OSSL_HTTP_REQ_CTX_set_max_response_hdr_lines(OSSL_HTTP_REQ_CTX *rctx,
- size_t count);
-
# endif /* !defined(OPENSSL_NO_HTTP) */
# ifdef __cplusplus
}