[erlang-questions] Proxy authentication with inets

Michael McDaniel <>
Fri Sep 22 16:46:23 CEST 2006


On Fri, Sep 22, 2006 at 07:43:20AM -0700, Michael McDaniel wrote:
> On Fri, Sep 22, 2006 at 10:19:34AM -0400, Serge Aleynikov wrote:
> > Though I haven't tried it, would the following work for the hostname?
> > 
> > "username:"
> > 
> > 
> > Serge
> > 
> > Dmitrii Dimandt wrote:
> > > Documentation show that http:set_options/1 allows only the following for 
> > > proxy:
> > > 
> > > {proxy, {HostName, Port}} where HostName = string(), Port = integer().
> > > 
> > > How can I force inets into accepting a username and a password for the 
> > > proxy as well? If it is at all possible, of course.
> > > 
> > > Thank you
> > 
> _______________________________________________
> 
>  Or (also untested) perhaps the proxy will accept and pass
>  the HTML Authorization header ?
> 
>   http://www.w3.org/Protocols/HTTP/HTRQ_Headers.html
> 
>  I do something like the following in one application ...
> 
> -------
>  case (catch http:request(post,
>   {"https://" ++ ServerName ,
>     [
>      {"Date", httpd_util:rfc1123_date()} ,
>      {"Host", ServerName} ,
>      {"REALM",  "blah"} ,
>      {"API_VERSION", "ver:5.1"} ,
>      {"Authorization", "Basic " ++ http_base_64:encode(UPW)} ,
>      {"Accept", "text/xml/html"},
>      {"User-Agent",  "custom blah client"}
>     ] ,
>      "text/xml; charset=utf-8" ,
>      Body
>    } ,
>    [{keepalive, false}, {nodelay,true}] ,
>    [])) of
> 
>        {ok, Result}    ->
>                       {ok, Result} ;
> 
>        {error, Reason} ->
> 
>              ... etc. etc.
> -------
> 
>  The application server (ServerName) in this case interprets the 
>  Authorization information.
> 
>  I am guessing the proxy (in original question) would pass the
>  headers through (though, as mentioned, I have not tested this).
> 
> ~M
_______________________________________________

  P.S. I mean maybe proxy will accept and use Authorization header;
  whether it passes it through maybe is irrelevant for original
  question



More information about the erlang-questions mailing list