cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Using curl to setup TCP connection through squid proxy

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 11 Jun 2014 11:22:08 +0200 (CEST)

On Wed, 11 Jun 2014, PenguinWhispererThe . wrote:

> I'm setting up a nagios machine and it's behind a proxy.
> For this machine the connect method is allowed to all ports.
>
> The idea is to use curl with the proxytunnel option and open a TCP
> connection like that to other protocols: SMTP, IMAP, ... I would be happy if
> I already could do a TCP check (so the proxy being able to connect). Is this
> possible using curl?

curl is not a generic check-your-TCP tool. It does transfers using internet
protocols, most of them using TCP.
>
> curl -x x.x.x.x:3128 --proxytunnel target.com:25 -v

This command line tells curl to tunnel HTTP through the proxy to the host on
port 25 and do a GET /.

> However I see the proxy sending HTTP requests (or that is what it looks
> like).

Yes, as that's actually what you ask for there.

> When I use SMTP as the protocol (so in the proxytunnel part): curl: (1)
> Protocol smtp not supported or disabled in libcurl

So your libcurl doesn't suport SMTP...

> Is there a generic way where curl only sets up the connection through the
> proxy and the protocol is handled by me?

That would possibly be telnet:// but I'm not sure we support that properly
tunnelled through a proxy.

> Are there alternatives to accomplish this?

I don't know. libcurl has a CONNECT_ONLY feature that probably could be used
for this, but it isn't exposed/used by the command line tool.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2014-06-11