Changeset View
Changeset View
Standalone View
Standalone View
crypto/http/http_client.c
/* | /* | ||||
* Copyright 2001-2022 The OpenSSL Project Authors. All Rights Reserved. | * Copyright 2001-2023 The OpenSSL Project Authors. All Rights Reserved. | ||||
* Copyright Siemens AG 2018-2020 | * Copyright Siemens AG 2018-2020 | ||||
* | * | ||||
* Licensed under the Apache License 2.0 (the "License"). You may not use | * Licensed under the Apache License 2.0 (the "License"). You may not use | ||||
Context not available. | |||||
char *port; | char *port; | ||||
char *path; | char *path; | ||||
int use_ssl; | int use_ssl; | ||||
OSSL_HTTP_REQ_CTX *rctx; | OSSL_HTTP_REQ_CTX *rctx = NULL; | ||||
BIO *resp = NULL; | BIO *resp = NULL; | ||||
time_t max_time = timeout > 0 ? time(NULL) + timeout : 0; | time_t max_time = timeout > 0 ? time(NULL) + timeout : 0; | ||||
Context not available. | |||||
NULL /* req */, | NULL /* req */, | ||||
expected_ct, expect_asn1, max_resp_len, | expected_ct, expect_asn1, max_resp_len, | ||||
-1 /* use same max time (timeout) */, | -1 /* use same max time (timeout) */, | ||||
0 /* no keep_alive */)) | 0 /* no keep_alive */)) { | ||||
OSSL_HTTP_REQ_CTX_free(rctx); | OSSL_HTTP_REQ_CTX_free(rctx); | ||||
else | rctx = NULL; | ||||
} else { | |||||
resp = OSSL_HTTP_exchange(rctx, &redirection_url); | resp = OSSL_HTTP_exchange(rctx, &redirection_url); | ||||
} | |||||
} | } | ||||
OPENSSL_free(path); | OPENSSL_free(path); | ||||
if (resp == NULL && redirection_url != NULL) { | if (resp == NULL && redirection_url != NULL) { | ||||
Context not available. | |||||
OPENSSL_free(host); | OPENSSL_free(host); | ||||
OPENSSL_free(port); | OPENSSL_free(port); | ||||
(void)OSSL_HTTP_close(rctx, 1); | (void)OSSL_HTTP_close(rctx, 1); | ||||
rctx = NULL; | |||||
BIO_free(resp); | BIO_free(resp); | ||||
OPENSSL_free(current_url); | OPENSSL_free(current_url); | ||||
return NULL; | return NULL; | ||||
Context not available. | |||||
OPENSSL_free(host); | OPENSSL_free(host); | ||||
OPENSSL_free(port); | OPENSSL_free(port); | ||||
(void)OSSL_HTTP_close(rctx, 1); | (void)OSSL_HTTP_close(rctx, 1); | ||||
rctx = NULL; | |||||
continue; | continue; | ||||
} | } | ||||
/* if redirection not allowed, ignore it */ | /* if redirection not allowed, ignore it */ | ||||
Context not available. | |||||
OPENSSL_free(port); | OPENSSL_free(port); | ||||
if (!OSSL_HTTP_close(rctx, resp != NULL)) { | if (!OSSL_HTTP_close(rctx, resp != NULL)) { | ||||
BIO_free(resp); | BIO_free(resp); | ||||
rctx = NULL; | |||||
resp = NULL; | resp = NULL; | ||||
} | } | ||||
break; | break; | ||||
Context not available. |