0
votes

My Ibrowse HTTP Client is behind a Network and any HTTP request to the outside has to go through a Proxy. Now, Ibrowse has a good example for this. However, i got a little confused. The Proxy behind which i am running the application uses Domain Authentication (this Domain is an Active Directory kinda setup) whereby usually in a browser we would have to enter settings like this (say the domain is "kyaug"),

username: kyaug\[YOUR_DOMAIN_USERNAME]
password: [Domain Password]
This means that [YOUR_DOMAIN_USERNAME] is your Domain Username actually.

Now in the Ibrowse, an example that looks like this comes along:
ibrowse:send_req("http://www.erlang.se/", [], get, [],
         [{proxy_user, "XXXXX"},
          {proxy_password, "XXXXX"},
          {proxy_host, "proxy"},
          {proxy_port, 8080}], 5000).
Now, lets say that my situation is as follows:
Domain:                kyaug
Domain Username:       muzaayj
Proxy Server:          ppi.kyu.co.ug
Proxy Port:            3128
Domain Password:       xxxxx            

Now, When i try thsi below:

Options = [
            {proxy_user, "kyaug\muzaayj"},
            {proxy_password, "My Domain Password"},
            {proxy_host, "ppi.kyu.co.ug"},
            {proxy_port, 3128}
        ],
ibrowse:send_req("http://www.google.com",[],post,Data,Options,infinity).

The proxy spits back to me an HTML page informing me that PROXY_AUTH_REQUIRED and many other things about its administrators. Now, i have a feeling that its because i am putting the proxy_user wrongly. In the above, i am supplying this parameter the way the browsers take it as well, probably behind the scenes, its changed into a different arrangement. Some one assist in how i can correct this. How do browsers send their data to a proxy server for authentication given that the username must be append to the Domain to be used for authentication at the Proxy end ?

3

3 Answers

1
votes

Have you tried {proxy_user, "muzaayj"} in the options instead of {proxy_user, "kyaug\muzaayj"}?

1
votes

Have you tried {proxy_user, "kyaug\\muzaayj"}? A single backslash escapes the m back to an m, but a double backslash becomes a single backslash in the string.

0
votes

I am not familiar with ibrowse, but i think that problem in windows authentication method (ofc it depends on AD config, but i suspect that is NTLM Auth) which ibrowse doesnt supprot.