aboutsummaryrefslogtreecommitdiffstats
path: root/apps/ocsp.c
diff options
context:
space:
mode:
authorbluelineXY <m.schroen@web.de>2015-08-04 13:23:00 +0200
committerRich Salz <rsalz@openssl.org>2015-08-08 18:18:03 -0400
commitff4a9394a2380140209a9ce2849f011063af1ecc (patch)
tree256085a4b09050b40b2157291f5e4d637c80dd7f /apps/ocsp.c
parent2bfbeb264573342bea475f6dbb5b4c7fec8fdb0a (diff)
downloadopenssl-ff4a9394a2380140209a9ce2849f011063af1ecc.tar.gz
GH357: Update ocsp.c
Add Host Header in OCSP query if no host header is set via -header Signed-off-by: Rich Salz <rsalz@akamai.com> Reviewed-by: Ben Laurie <ben@openssl.org>
Diffstat (limited to 'apps/ocsp.c')
-rw-r--r--apps/ocsp.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/apps/ocsp.c b/apps/ocsp.c
index 44f5841fff..5b3092a4d2 100644
--- a/apps/ocsp.c
+++ b/apps/ocsp.c
@@ -1262,6 +1262,8 @@ OCSP_RESPONSE *process_responder(OCSP_REQUEST *req,
BIO *cbio = NULL;
SSL_CTX *ctx = NULL;
OCSP_RESPONSE *resp = NULL;
+ int found, i;
+
cbio = BIO_new_connect(host);
if (!cbio) {
BIO_printf(bio_err, "Error creating connect BIO\n");
@@ -1280,6 +1282,17 @@ OCSP_RESPONSE *process_responder(OCSP_REQUEST *req,
sbio = BIO_new_ssl(ctx, 1);
cbio = BIO_push(sbio, cbio);
}
+ for (found = i = 0; i < sk_CONF_VALUE_num(headers); i++) {
+ CONF_VALUE *hdr = sk_CONF_VALUE_value(headers, i);
+ if (strcasecmp("host", hdr->name) == 0) {
+ found = 1;
+ break;
+ }
+ }
+
+ if (!found && !X509V3_add_value("Host", host, &headers))
+ BIO_printf(bio_err, "Error setting HTTP Host header\n");
+
resp = query_responder(cbio, path, headers, req, req_timeout);
if (!resp)
BIO_printf(bio_err, "Error querying OCSP responder\n");