From: Uwe Petschke Date: 2008-11-21T18:26:15+09:00 Subject: Re: What's the Best Way to Mimic an HTTP Request? Daniel Miessler wrote: > The problem is that I keep getting a redirect > (#), which doesn't happen when I > make the request from a regular browser. > > So I sniffed the regular request with wireshark, and a browser sends a > bunch of additional headers when it makes the request. Cookies, > referrer, etc. > > Are any of these headers more necessary than others, and is there a > preferred way to send the headers using Ruby? > We have had similar issues where we didn't see a redirect when sniffing the browser but it happened for our code. The reason was HTTP/1.1. With HTTP/1.1 it is required to specify the host you expect to be talking with (as more than one virtual host may be serviced by one server): GET / HTTP/1.1 Host: www.apache.org (see http://www.apacheweek.com/features/http11 for reference) Hope that helps in avoiding the redirect ;-) Uwe -- Posted via http://www.ruby-forum.com/.