EM HTTP request & proxy authorization

65 views
Skip to first unread message

Christoph Pilka

unread,
May 18, 2012, 3:27:24 PM5/18/12
to EventMachine
Howdy,

I try to auth against a HTTP proxy for hours now. What's going wrong
here?

#!/usr/bin/env ruby
require 'eventmachine'
require 'em-http-request'

EM::run do
connection_opts = {:proxy => {:host => 'proxy.example.com', :port
=> 3128 }}
request_opts = {:proxy => {:authorization => ['jdoe',
'secretpw']}}
req = EM::HttpRequest.new('http://www.example.com',
connection_opts).get request_opts
req.callback do |resp|
puts resp.response_header.status
end
end

I always get a 407 (Access denied). Same proxy login data work in
browsers (Firefox, Chrome etc.) like a charm. The proxy is a Squid
3.1.10. Totally confused about this behaviour. By the way: event
machine-1.0.0.beta.4, em-http-request-1.0.2.

Cheerio,
Chris

Christoph Pilka

unread,
May 18, 2012, 3:38:43 PM5/18/12
to EventMachine
By the way, same behavior with:

request_opts = {:head => {:proxy => {:authorization => ['jdoe',
'secretpw']}}}

Christoph Pilka

unread,
May 19, 2012, 12:50:16 PM5/19/12
to EventMachine
Argh, guys, what's wrong with the code above? A simple wget with the
same login data works like a charm :(

export http_proxy=http://jdoe:secr...@proxy.example.com:3128 && wget
http://www.example.com

Thanks in advance,
Chris

Iñaki Baz Castillo

unread,
May 19, 2012, 12:58:32 PM5/19/12
to eventm...@googlegroups.com
2012/5/19 Christoph Pilka <c.p...@asconix.com>:
> Argh, guys, what's wrong with the code above? A simple wget with the
> same login data works like a charm :(
>
> export http_proxy=http://jdoe:secr...@proxy.example.com:3128 && wget
> http://www.example.com

Hi Christoph. Your issue is about em-http-request rather than the core
EventMachine. You would do better by reporting the issue in
em-http-request Github project.

--
Iñaki Baz Castillo
<i...@aliax.net>

Christoph Pilka

unread,
May 19, 2012, 1:08:28 PM5/19/12
to EventMachine
OK, I've opened an issue ticket at https://github.com/igrigorik/em-http-request/issues/191
-> wasn't sure if it my fault or a em-http-request bug.

Iñaki Baz Castillo

unread,
May 19, 2012, 1:41:14 PM5/19/12
to eventm...@googlegroups.com
2012/5/19 Christoph Pilka <c.p...@asconix.com>:
> OK, I've opened an issue ticket at https://github.com/igrigorik/em-http-request/issues/191
> -> wasn't sure if it my fault or a em-http-request bug.

Yeah, but anyhow this is the maillist about eventmachine, not about
em-http-request :)
Reply all
Reply to author
Forward
0 new messages