Hi,
I work in a company that uses an architecture that does not allow external servers and open the ip addresses to reach the server of MailChimp is difficult.
Would it be possible to add a configuration to MailChimp that configure a proxy for external calls?

Thanks,
Sergio

Comments

alexverb’s picture

I'm trying to get Mailchimp.com itself to implement the wrapper. But they aren't really eager to release a new version of the API with this functionality.

This topic explains to you how to add proxy to the MCAPI. http://jungle.mailchimp.com/forum/topics/proxy-support-in-php-api Then all you would have to do is make some settings where you can set the proxy. Doesn't have SSL support though...

wiifm’s picture

Title: Add proxy configuration » Support HTTPS tunnels to Mailchimp through proxy servers
Version: 7.x-2.4 » 7.x-2.x-dev
Status: Active » Needs review
StatusFileSize
new4.45 KB

So it is worth mentioning that since this issue was raised Drupal now has the capacity (in core) to send HTTP requests through proxies. This works fine for HTTP requests, but are more complicated for HTTPS requests.

One option is to tunnel the request through the proxy server, this can be achieved with cURL with the CURLOPT_HTTPPROXYTUNNEL flag.

Attached is a patch that ports the request from drupal_http_request() to cURL. Existing proxy configuration is maintained as per what Drupal core expects.

Tested to work with HTTPS endpoints (both through a proxy and with a direct connection).

Looking to hear feedback on this patch, and whether it can be included in mailchimp.

wiifm’s picture

StatusFileSize
new4.19 KB

Sorry, had some extra cruft in the patch above, now removed.

wiifm’s picture

StatusFileSize
new4.17 KB

Tracking HEAD, patch re-rolled.

wiifm’s picture

StatusFileSize
new4.41 KB

Remove the silly "No error message was found" when clearly there is one.

acbramley’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Without this patch, I was not able to get secure results while using a proxy, patch fixed my issues.

acbramley’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new793 bytes
new5.13 KB

Enhancing this patch to add in proxy authentication support, interdiff attached.

rroblik’s picture

Hello, this post is old but...

What about a patch / release for 7.x-3.x version (MailChimp API library (2.0)) ?

Thanks

rroblik’s picture

Version: 7.x-2.x-dev » 7.x-3.1
Status: Needs review » Needs work

Redraw to new api version

acbramley’s picture

I can attempt to look into doing that some time in the near future :)

rroblik’s picture

@acbramley It's a good news thanks ! :)

acbramley’s picture

StatusFileSize
new5.01 KB

Ok, this is a first, very mundane, straight port of what seems to me will work. I haven't worked with the new mailchimp API nor have I had a chance to test this, but hopefully this is a good starting point.

rroblik’s picture

Wow thanks but without testing there is few errors

undefined $host
(L63 if ($proxy_server && _drupal_http_use_proxy($host)) {)

returning $result without set him ?!

Patch cannot be applied with netbeans :(

acbramley’s picture

Status: Needs work » Needs review
StatusFileSize
new4.65 KB

Woops, good catchs without applying the patch :)

Here's a less gitty formatted patch with those (hopeful) fixes applied.

Status: Needs review » Needs work

The last submitted patch, 14: 1493900-switch-to-curl-3.x-14.patch, failed testing.

rroblik’s picture

Thanks for update ...

Here are my errors :

 Warning : curl_getinfo(): 1062 is not a valid cURL handle resource dans DrupalMailchimp->call() (ligne 113 ... /mailchimp.inc).
Warning : curl_close(): 1062 is not a valid cURL handle resource dans DrupalMailchimp->call() (ligne  ... mailchimp.inc).
Warning : curl_error(): 1062 is not a valid cURL handle resource dans DrupalMailchimp->call() (ligne 116 ... mailchimp.inc).

EDIT :
Why continue executing code if line 106 the test fail ?

    if (!$response = curl_exec($request)) {

here we should return error and stop processing, to prevent others errors related to response / curl (as curl_getinfo)
That what errors are trowed (up)

Regards

acbramley’s picture

StatusFileSize
new4.67 KB

Sorry about that, I was meant to return at that point, I believe I started trying to make the return filter right down to the bottom when I first started porting the patch and forgot to add that one back in.

acbramley’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 17: 1493900-switch-to-curl-3.x-17.patch, failed testing.

rroblik’s picture

I have timeout error ...

But maybe because my server local platform (debian, offline) use my development computer proxy (windows, online behind corporate proxy) via CCProxy software ... ?

Noticed when I use curl with command line on my debian
curl -x http://my-windows-computer-ccproxy:port -L https://us9.api.mailchimp.com/2.0/lists/subscribe

That is working fine !

rroblik’s picture

Status: Needs work » Closed (works as designed)

I think the best way of doing this is "simply" to use chr

:)