From 6b99c8d9cff7b3e8ae8f3204b99e7ea40f791349 Mon Sep 17 00:00:00 2001 From: Yves-Alexis Perez Date: Sun, 25 Aug 2013 15:37:26 +0200 Subject: Imported Upstream version 5.1.0 --- src/scepclient/scep.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/scepclient/scep.c') diff --git a/src/scepclient/scep.c b/src/scepclient/scep.c index 3fdcd6c28..5bb29bbd8 100644 --- a/src/scepclient/scep.c +++ b/src/scepclient/scep.c @@ -339,15 +339,22 @@ static char* escape_http_request(chunk_t req) * Send a SCEP request via HTTP and wait for a response */ bool scep_http_request(const char *url, chunk_t msg, scep_op_t op, - bool http_get_request, u_int timeout, chunk_t *response) + bool http_get_request, u_int timeout, char *src, + chunk_t *response) { int len; status_t status; char *complete_url = NULL; + host_t *srcip = NULL; /* initialize response */ *response = chunk_empty; + if (src) + { + srcip = host_create_from_string(src, 0); + } + DBG2(DBG_APP, "sending scep request to '%s'", url); if (op == SCEP_PKI_OPERATION) @@ -371,6 +378,7 @@ bool scep_http_request(const char *url, chunk_t msg, scep_op_t op, FETCH_REQUEST_HEADER, "Pragma:", FETCH_REQUEST_HEADER, "Host:", FETCH_REQUEST_HEADER, "Accept:", + FETCH_SOURCEIP, srcip, FETCH_END); } else /* HTTP_POST */ @@ -386,6 +394,7 @@ bool scep_http_request(const char *url, chunk_t msg, scep_op_t op, FETCH_REQUEST_DATA, msg, FETCH_REQUEST_TYPE, "", FETCH_REQUEST_HEADER, "Expect:", + FETCH_SOURCEIP, srcip, FETCH_END); } } @@ -412,9 +421,11 @@ bool scep_http_request(const char *url, chunk_t msg, scep_op_t op, status = lib->fetcher->fetch(lib->fetcher, complete_url, response, FETCH_HTTP_VERSION_1_0, FETCH_TIMEOUT, timeout, + FETCH_SOURCEIP, srcip, FETCH_END); } + DESTROY_IF(srcip); free(complete_url); return (status == SUCCESS); } -- cgit v1.2.3