950acf1408b8a1d70bc49a54436452978d6ce0f7
[openssl.git] / include / openssl / http.h
1 /*
2  * Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
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
23 extern "C" {
24 # endif
25
26 typedef BIO *(*OSSL_HTTP_bio_cb_t)(BIO *bio, void *arg, int connect, int detail);
27
28 BIO *OSSL_HTTP_get(const char *url, const char *proxy, const char *proxy_port,
29                    BIO *bio, BIO *rbio,
30                    OSSL_HTTP_bio_cb_t bio_update_fn, void *arg,
31                    const STACK_OF(CONF_VALUE) *headers,
32                    int maxline, unsigned long max_resp_len, int timeout,
33                    const char *expected_content_type, int expect_asn1);
34 ASN1_VALUE *OSSL_HTTP_get_asn1(const char *url,
35                                const char *proxy, const char *proxy_port,
36                                BIO *bio, BIO *rbio,
37                                OSSL_HTTP_bio_cb_t bio_update_fn, void *arg,
38                                const STACK_OF(CONF_VALUE) *headers,
39                                int maxline, unsigned long max_resp_len,
40                                int timeout, const char *expected_content_type,
41                                const ASN1_ITEM *it);
42 ASN1_VALUE *OSSL_HTTP_post_asn1(const char *server, const char *port,
43                                 const char *path, int use_ssl,
44                                 const char *proxy, const char *proxy_port,
45                                 BIO *bio, BIO *rbio,
46                                 OSSL_HTTP_bio_cb_t bio_update_fn, void *arg,
47                                 const STACK_OF(CONF_VALUE) *headers,
48                                 const char *content_type,
49                                 ASN1_VALUE *req, const ASN1_ITEM *req_it,
50                                 int maxline, unsigned long max_resp_len,
51                                 int timeout, const char *expected_ct,
52                                 const ASN1_ITEM *rsp_it);
53 BIO *OSSL_HTTP_transfer(const char *server, const char *port, const char *path,
54                         int use_ssl, const char *proxy, const char *proxy_port,
55                         BIO *bio, BIO *rbio,
56                         OSSL_HTTP_bio_cb_t bio_update_fn, void *arg,
57                         const STACK_OF(CONF_VALUE) *headers,
58                         const char *content_type, BIO *req_mem,
59                         int maxline, unsigned long max_resp_len, int timeout,
60                         const char *expected_ct, int expect_asn1,
61                         char **redirection_url);
62 int OSSL_HTTP_proxy_connect(BIO *bio, const char *server, const char *port,
63                             const char *proxyuser, const char *proxypass,
64                             int timeout, BIO *bio_err, const char *prog);
65
66 int OSSL_HTTP_parse_url(const char *url, char **phost, char **pport,
67                         char **ppath, int *pssl);
68
69 # ifdef  __cplusplus
70 }
71 # endif
72 #endif /* !defined(OPENSSL_HTTP_H) */