Permalink
Browse files

Merge pull request #10 from comotion/3.0

add proxy support
  • Loading branch information...
2 parents d035840 + 951eeec commit 5b9153eabfcf75d80f0cab801c1957e65bc7b96f @daghf daghf committed Feb 28, 2014
Showing with 11 additions and 1 deletion.
  1. +9 −1 src/vmod_curl.c
  2. +2 −0 src/vmod_curl.vcc
View
@@ -40,6 +40,7 @@ struct vmod_curl {
const char *capath;
VTAILQ_HEAD(, hdr) headers;
VTAILQ_HEAD(, req_hdr) req_headers;
+ const char *proxy;
struct vsb *body;
};
@@ -110,6 +111,7 @@ static void cm_clear(struct vmod_curl *c) {
c->capath = NULL;
c->error = NULL;
c->xid = 0;
+ c->proxy = NULL;
}
static struct vmod_curl* cm_get(struct sess *sp) {
@@ -240,7 +242,9 @@ static void cm_perform(struct vmod_curl *c) {
curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, c);
curl_easy_setopt(curl_handle, CURLOPT_HEADERFUNCTION, recv_hdrs);
curl_easy_setopt(curl_handle, CURLOPT_HEADERDATA, c);
-
+ if(c->proxy) {
+ curl_easy_setopt(curl_handle, CURLOPT_PROXY, c->proxy);
+ }
if (c->timeout_ms > 0) {
#ifdef CURL_TIMEOUTMS_WORKS
curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT_MS, c->timeout_ms);
@@ -460,3 +464,7 @@ const char *vmod_unescape(struct sess *sp, const char *str) {
return r;
}
+
+void vmod_proxy(struct sess *sp, const char *proxy) {
+ cm_get(sp)->proxy = proxy;
+}
View
@@ -38,3 +38,5 @@ Function STRING unescape(STRING)
# Add / Remove request headers
Function VOID header_add(STRING)
Function VOID header_remove(STRING)
+
+Function VOID proxy(STRING)

0 comments on commit 5b9153e

Please sign in to comment.