Proxy Specs

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Proxy Specs

The Nux
Hi there,
I am coding a proxy (not something big, I just need it for a project)
in Java, then I would have some questions about proxies :

  * Why does HTTP/FTP/SSL & co proxies exist since SOCKS alone could
do all needed tasks ?
  * Can I force firefox (or anything else) that support both HTTP and
SOCKS to use SOCKS for seeing web pages ?
  * Where can I find specs for doing HTTP/FTP/SSL/Gopher proxy ?
  * How comes that all proxy services are listening on the same port ?
Does the proxy server bind to specific protocol proxy according to
what headers looks like ?

Regards,
Rémy
Reply | Threaded
Open this post in threaded view
|

Re: Proxy Specs

Henrik Nordström
tis 2007-05-29 klockan 21:31 +0200 skrev The Nux:
> Hi there,
> I am coding a proxy (not something big, I just need it for a project)
> in Java, then I would have some questions about proxies :
>
>   * Why does HTTP/FTP/SSL & co proxies exist since SOCKS alone could
> do all needed tasks ?

Squid is a HTTP proxy. All communication to Squid is HTTP. But HTTP
proxies can resolve a number of different URL-schemes for their HTTP
clients..

The difference between an HTTP proxy and SOCKS is that the HTTP proxy is
fully aware of the protocol being proxied, and as result have well
defined behavior. The main difference is the ability to cache results.

SOCKS on the other hand is protocol neutral and SHOULD NOT perform
caching or other heavily protocol dependent actions.

>   * Can I force firefox (or anything else) that support both HTTP and
> SOCKS to use SOCKS for seeing web pages ?

Sure. Just set the SOCKS proxy field in the proxy settings instead of
the HTTP proxy, or use a proxy.pac script returning the desired SOCKS
proxy details. With the proxy.pac method you can select in detail when
to use what kind of proxy.. (HTTP or SOCKS or DIRECT).

>   * Where can I find specs for doing HTTP/FTP/SSL/Gopher proxy ?

HTTP proxies acts as gateways for the other schemes, with the exception
of SSL which is tunneled using the CONNECT method. CONNECT is defined in
RFC2817.

The details regarding ftp and gopher can be found in RFC1738 where the
ftp:// and gopher:// URI schemes is defined.
 
The general stuff regarding HTTP proxying is in RFC2616.

>   * How comes that all proxy services are listening on the same port ?
> Does the proxy server bind to specific protocol proxy according to
> what headers looks like ?

A HTTP proxy only talks HTTP to it's clients regardless of which
URI-scheme the client requests.

An HTTP proxy request for an HTTP object looks like

GET http://server/path HTTP/1.1
Host: server
[other headers]

And for an FTP object

GET ftp://server/path HTTP/1.1.
Host: server
[other headers]

and it's the proxy responsibility to figure out how to get the requested
resource and map it to an HTTP response to the client.

You are welcome to ask HTTP protocol or code questions on
[hidden email]

Regards
Henrik

signature.asc (316 bytes) Download Attachment