2 * Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
3 * Copyright Siemens AG 2018-2020
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
11 #ifndef OPENSSL_HTTP_H
12 # define OPENSSL_HTTP_H
15 # include <openssl/opensslconf.h>
17 # include <openssl/bio.h>
18 # include <openssl/asn1.h>
19 # include <openssl/conf.h>
26 typedef BIO *(*OSSL_HTTP_bio_cb_t)(BIO *bio, void *arg, int connect, int detail);
28 # define OSSL_HTTP_NAME "http"
29 # define OSSL_HTTPS_NAME "https"
30 # define OSSL_HTTP_PREFIX OSSL_HTTP_NAME"://"
31 # define OSSL_HTTPS_PREFIX OSSL_HTTPS_NAME"://"
32 # define OSSL_HTTP_PORT "80"
33 # define OSSL_HTTPS_PORT "443"
34 # define OPENSSL_NO_PROXY "NO_PROXY"
35 # define OPENSSL_HTTP_PROXY "HTTP_PROXY"
36 # define OPENSSL_HTTPS_PROXY "HTTPS_PROXY"
38 BIO *OSSL_HTTP_get(const char *url, const char *proxy, const char *no_proxy,
40 OSSL_HTTP_bio_cb_t bio_update_fn, void *arg,
41 const STACK_OF(CONF_VALUE) *headers,
42 int maxline, unsigned long max_resp_len, int timeout,
43 const char *expected_content_type, int expect_asn1);
44 ASN1_VALUE *OSSL_HTTP_get_asn1(const char *url,
45 const char *proxy, const char *no_proxy,
47 OSSL_HTTP_bio_cb_t bio_update_fn, void *arg,
48 const STACK_OF(CONF_VALUE) *headers,
49 int maxline, unsigned long max_resp_len,
50 int timeout, const char *expected_content_type,
52 ASN1_VALUE *OSSL_HTTP_post_asn1(const char *server, const char *port,
53 const char *path, int use_ssl,
54 const char *proxy, const char *no_proxy,
56 OSSL_HTTP_bio_cb_t bio_update_fn, void *arg,
57 const STACK_OF(CONF_VALUE) *headers,
58 const char *content_type,
59 const ASN1_VALUE *req, const ASN1_ITEM *req_it,
60 int maxline, unsigned long max_resp_len,
61 int timeout, const char *expected_ct,
62 const ASN1_ITEM *rsp_it);
63 BIO *OSSL_HTTP_transfer(const char *server, const char *port, const char *path,
64 int use_ssl, const char *proxy, const char *no_proxy,
66 OSSL_HTTP_bio_cb_t bio_update_fn, void *arg,
67 const STACK_OF(CONF_VALUE) *headers,
68 const char *content_type, BIO *req_mem,
69 int maxline, unsigned long max_resp_len, int timeout,
70 const char *expected_ct, int expect_asn1,
71 char **redirection_url);
72 int OSSL_HTTP_proxy_connect(BIO *bio, const char *server, const char *port,
73 const char *proxyuser, const char *proxypass,
74 int timeout, BIO *bio_err, const char *prog);
76 int OSSL_HTTP_parse_url(const char *url, char **phost, char **pport,
77 char **ppath, int *pssl);
82 #endif /* !defined(OPENSSL_HTTP_H) */