Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

add proxy support #10

Merged
merged 1 commit into from

2 participants

@comotion

No description provided.

@comotion

Varnish boxen behind egress filtering need proxy support to use the curl module properly. Please take a look at this patch which implements the proxy option for libcurl.

@daghf daghf merged commit 5b9153e into from
@daghf
Collaborator

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 27, 2013
  1. @comotion

    add proxy support

    comotion authored
This page is out of date. Refresh to see the latest.
Showing with 11 additions and 1 deletion.
  1. +9 −1 src/vmod_curl.c
  2. +2 −0  src/vmod_curl.vcc
View
10 src/vmod_curl.c
@@ -42,6 +42,7 @@ struct vmod_curl {
const char *capath;
VTAILQ_HEAD(, hdr) headers;
VTAILQ_HEAD(, req_hdr) req_headers;
+ const char *proxy;
struct vsb *body;
};
@@ -111,6 +112,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) {
@@ -241,7 +243,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);
@@ -461,3 +465,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
2  src/vmod_curl.vcc
@@ -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)
Something went wrong with that request. Please try again.