inets ssl proxy
Ingela Anderton
ingela@REDACTED
Wed Feb 23 15:54:50 CET 2005
You need to specify some ssl options! Something like:
SSLOptions = [{certfile, CertFile}, {keyfile, CertFile}],
http:request(get, {URL, []}, [{ssl, SSLOptions}], []),
Michael McDaniel wrote:
> Should the following work, or am I doing something wrong?
>
> -module(hd).
> -export([hd/3]).
>
>
> hd(Proxy, Port, URL) ->
> application:start(inets) ,
> application:start(ssl) ,
>
> http:set_options( [ {proxy, {{Proxy,Port}, ["localhost"]} } ] ) ,
>
> http:request(get,
> {URL, [ {"Version", "HTTP/1.0"}, {"Referer", URL},
> {"Host", "www.myhost.org"} ]}, [], []).
>
> $ 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).
> {ok,hd}
> 2> hd:hd("my.proxy.org",3128,"https://test.xquad.com").
> {error,esslerrssl}
> 3> hd:hd("my.proxy.org",3128,"http://www.quickbots.com").
> {ok,{{"HTTP/1.0",200,"OK"},
> [{"date","Wed, 23 Feb 2005 01:34:04 GMT"},
> {"via","1.0 cougora.autosys.us (squid/3.0-PRE3)"},
> {"etag","\"15481-1ee2-da976100\""},
> {"server","Apache"},
> {"content-length","7906"},
> {"content-type","text/html; charset=ISO-8859-1"},
> {"last-modified","Wed, 15 Jan 2003 21:45:08 GMT"},
> {"accept-ranges","bytes"},
> {"x-cache","MISS from cougora.autosys.us"},
> {"x-cache-lookup","HIT from cougora.autosys.us:3128"},
> {"proxy-connection","keep-alive"}],
> "<!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
> hd:hd("my.proxy.org",3128,"https://test.xquad.com").
> to my.proxy.org 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,
>
> ~Michael
--
/m.v.h Ingela
//The highway of life is always under construction. //
|\ _,,,--,,_ ,)
/,`.-'`' -, ;-;;'
|,4- ) )-,_ ) /\
'---''(_/--' (_/-'
Ericsson AB - OTP team
Cellular/Mobile: +46 70 636 78 68
More information about the erlang-questions
mailing list