简体   繁体   中英

Ibrowse Erlang HTTP Client Proxy Authentication within a Domain

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:
\nibrowse:send_req("http://www.erlang.se/", [], get, [], \n         [{proxy_user, "XXXXX"}, \n          {proxy_password, "XXXXX"}, \n          {proxy_host, "proxy"}, \n          {proxy_port, 8080}], 5000). \n
Now, lets say that my situation is as follows:

\nDomain: kyaug \nDomain Username: muzaayj \nProxy Server: ppi.kyu.co.ug \nProxy Port: 3128 \nDomain Password: xxxxx             \n

Now, When i try thsi below:

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

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 ?

您是否在选项中尝试{proxy_user, "muzaayj"}而不是{proxy_user, "kyaug\\muzaayj"}

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.

我不熟悉ibrowse,但我认为Windows身份验证方法中的问题(ofc取决于AD配置,但我怀疑是NTLM Auth),ibrowse并不支持。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM