inets ssl proxy

Michael McDaniel erlang@REDACTED
Wed Feb 23 02:34:05 CET 2005

Should the following work, or am I doing something wrong?


hd(Proxy, Port, URL) ->
  application:start(inets) ,
  application:start(ssl) ,

  http:set_options( [ {proxy, {{Proxy,Port}, ["localhost"]} } ] ) ,

  {URL,  [ {"Version", "HTTP/1.0"}, {"Referer", URL},
	   {"Host", ""} ]}, [], []).

$ uname -a
Linux fangora 2.6.4-52-default #1 Wed Apr 7 02:08:30 UTC 2004 i686 i686 i386 GNU/Linux
$ erl
Erlang (BEAM) emulator version 5.4.4 [source] [hipe]

Eshell V5.4.4  (abort with ^G)
1> c:c(hd).
2> hd:hd("",3128,"").
3> hd:hd("",3128,"").
     [{"date","Wed, 23 Feb 2005 01:34:04 GMT"},
      {"via","1.0 (squid/3.0-PRE3)"},
      {"content-type","text/html; charset=ISO-8859-1"},
      {"last-modified","Wed, 15 Jan 2003 21:45:08 GMT"},
      {"x-cache","MISS from"},
      {"x-cache-lookup","HIT from"},
     "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\r\n<HTML>\r\n<HEAD>\r\n<META HTTP-EQUIV=\"Content-Type\" CONTENT=\ etc. etc. etc.
4> halt().

The problem appears to be (looking at a trace) that the initial packets being sent by
to is all encrypted, rather than being a request that the proxy server
can read, so the proxy server passes back the error INVALID REQUEST.  As you can see,
the http:// request works great via proxy.

thank you,


More information about the erlang-questions mailing list