]> git.ipfire.org Git - thirdparty/openssl.git/blame - include/openssl/http.h
fips: zeroization of public security parameters (PSPs)
[thirdparty/openssl.git] / include / openssl / http.h
CommitLineData
29f178bd 1/*
b6461792 2 * Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved.
29f178bd
DDO
3 * Copyright Siemens AG 2018-2020
4 *
5 * Licensed under the Apache License 2.0 (the "License"). You may not use
6 * this file except in compliance with the License. You can obtain a copy
7 * in the file LICENSE in the source distribution or at
8 * https://www.openssl.org/source/license.html
9 */
10
11#ifndef OPENSSL_HTTP_H
12# define OPENSSL_HTTP_H
13# pragma once
14
15# include <openssl/opensslconf.h>
16
17# include <openssl/bio.h>
18# include <openssl/asn1.h>
19# include <openssl/conf.h>
20
21
22# ifdef __cplusplus
23extern "C" {
24# endif
25
4b1fe471
DDO
26# define OSSL_HTTP_NAME "http"
27# define OSSL_HTTPS_NAME "https"
28# define OSSL_HTTP_PREFIX OSSL_HTTP_NAME"://"
29# define OSSL_HTTPS_PREFIX OSSL_HTTPS_NAME"://"
30# define OSSL_HTTP_PORT "80"
31# define OSSL_HTTPS_PORT "443"
32# define OPENSSL_NO_PROXY "NO_PROXY"
33# define OPENSSL_HTTP_PROXY "HTTP_PROXY"
34# define OPENSSL_HTTPS_PROXY "HTTPS_PROXY"
35
3ca28c9e
VK
36# ifndef OPENSSL_NO_HTTP
37
647a5dbf
DDO
38#define OSSL_HTTP_DEFAULT_MAX_LINE_LEN (4 * 1024)
39#define OSSL_HTTP_DEFAULT_MAX_RESP_LEN (100 * 1024)
7f8aba2f
AN
40#define OSSL_HTTP_DEFAULT_MAX_RESP_HDR_LINES 256
41
d337af18 42
8f965908
DDO
43/* Low-level HTTP API */
44OSSL_HTTP_REQ_CTX *OSSL_HTTP_REQ_CTX_new(BIO *wbio, BIO *rbio, int buf_size);
83b6dc8d 45void OSSL_HTTP_REQ_CTX_free(OSSL_HTTP_REQ_CTX *rctx);
534725fd 46int OSSL_HTTP_REQ_CTX_set_request_line(OSSL_HTTP_REQ_CTX *rctx, int method_POST,
cddbcf02
DDO
47 const char *server, const char *port,
48 const char *path);
83b6dc8d
RS
49int OSSL_HTTP_REQ_CTX_add1_header(OSSL_HTTP_REQ_CTX *rctx,
50 const char *name, const char *value);
8f965908
DDO
51int OSSL_HTTP_REQ_CTX_set_expected(OSSL_HTTP_REQ_CTX *rctx,
52 const char *content_type, int asn1,
53 int timeout, int keep_alive);
1c8505fb 54int OSSL_HTTP_REQ_CTX_set1_req(OSSL_HTTP_REQ_CTX *rctx, const char *content_type,
8f965908 55 const ASN1_ITEM *it, const ASN1_VALUE *req);
83b6dc8d 56int OSSL_HTTP_REQ_CTX_nbio(OSSL_HTTP_REQ_CTX *rctx);
8f965908
DDO
57int OSSL_HTTP_REQ_CTX_nbio_d2i(OSSL_HTTP_REQ_CTX *rctx,
58 ASN1_VALUE **pval, const ASN1_ITEM *it);
59BIO *OSSL_HTTP_REQ_CTX_exchange(OSSL_HTTP_REQ_CTX *rctx);
4d190f99 60BIO *OSSL_HTTP_REQ_CTX_get0_mem_bio(const OSSL_HTTP_REQ_CTX *rctx);
8f965908 61size_t OSSL_HTTP_REQ_CTX_get_resp_len(const OSSL_HTTP_REQ_CTX *rctx);
83b6dc8d
RS
62void OSSL_HTTP_REQ_CTX_set_max_response_length(OSSL_HTTP_REQ_CTX *rctx,
63 unsigned long len);
8f965908 64int OSSL_HTTP_is_alive(const OSSL_HTTP_REQ_CTX *rctx);
83b6dc8d 65
8f965908
DDO
66/* High-level HTTP API */
67typedef BIO *(*OSSL_HTTP_bio_cb_t)(BIO *bio, void *arg, int connect, int detail);
68OSSL_HTTP_REQ_CTX *OSSL_HTTP_open(const char *server, const char *port,
69 const char *proxy, const char *no_proxy,
70 int use_ssl, BIO *bio, BIO *rbio,
71 OSSL_HTTP_bio_cb_t bio_update_fn, void *arg,
be799eb7 72 int buf_size, int overall_timeout);
8f965908
DDO
73int OSSL_HTTP_proxy_connect(BIO *bio, const char *server, const char *port,
74 const char *proxyuser, const char *proxypass,
75 int timeout, BIO *bio_err, const char *prog);
8ccbf00d
DDO
76int OSSL_HTTP_set1_request(OSSL_HTTP_REQ_CTX *rctx, const char *path,
77 const STACK_OF(CONF_VALUE) *headers,
78 const char *content_type, BIO *req,
79 const char *expected_content_type, int expect_asn1,
80 size_t max_resp_len, int timeout, int keep_alive);
8f965908 81BIO *OSSL_HTTP_exchange(OSSL_HTTP_REQ_CTX *rctx, char **redirection_url);
afe554c2 82BIO *OSSL_HTTP_get(const char *url, const char *proxy, const char *no_proxy,
29f178bd
DDO
83 BIO *bio, BIO *rbio,
84 OSSL_HTTP_bio_cb_t bio_update_fn, void *arg,
8f965908
DDO
85 int buf_size, const STACK_OF(CONF_VALUE) *headers,
86 const char *expected_content_type, int expect_asn1,
be799eb7 87 size_t max_resp_len, int timeout);
8f965908
DDO
88BIO *OSSL_HTTP_transfer(OSSL_HTTP_REQ_CTX **prctx,
89 const char *server, const char *port,
90 const char *path, int use_ssl,
91 const char *proxy, const char *no_proxy,
29f178bd
DDO
92 BIO *bio, BIO *rbio,
93 OSSL_HTTP_bio_cb_t bio_update_fn, void *arg,
8f965908
DDO
94 int buf_size, const STACK_OF(CONF_VALUE) *headers,
95 const char *content_type, BIO *req,
96 const char *expected_content_type, int expect_asn1,
be799eb7 97 size_t max_resp_len, int timeout, int keep_alive);
8f965908 98int OSSL_HTTP_close(OSSL_HTTP_REQ_CTX *rctx, int ok);
e8d0819d 99
8f965908 100/* Auxiliary functions */
d546e8e2
DDO
101int OSSL_parse_url(const char *url, char **pscheme, char **puser, char **phost,
102 char **pport, int *pport_num,
103 char **ppath, char **pquery, char **pfrag);
7932982b
DDO
104int OSSL_HTTP_parse_url(const char *url, int *pssl, char **puser, char **phost,
105 char **pport, int *pport_num,
106 char **ppath, char **pquery, char **pfrag);
ab9d67ef
DDO
107const char *OSSL_HTTP_adapt_proxy(const char *proxy, const char *no_proxy,
108 const char *server, int use_ssl);
29f178bd 109
7f8aba2f
AN
110void OSSL_HTTP_REQ_CTX_set_max_response_hdr_lines(OSSL_HTTP_REQ_CTX *rctx,
111 size_t count);
3ca28c9e
VK
112
113# endif /* !defined(OPENSSL_NO_HTTP) */
29f178bd
DDO
114# ifdef __cplusplus
115}
116# endif
b5adba20 117#endif /* !defined(OPENSSL_HTTP_H) */