From: Tim Roberts Date: 2012-01-09T15:21:46+09:00 Subject: Re: Http proxy, string chomp error is nil? Bigmac Turdsplash wrote: > >im building a proxy, im having a problem with processing the get request >i recive from the client. >... >this works every time in irb testing, but is inconsistent when my script >is running, the proxy works 90% of the time. when www.yahoo.com is >requested the script crashes with Host nil error but when yahoo.com is >request the script works fine... >... >host = header.to_a[1].chomp[6..-1] => nil Do you realize that the headers in an HTTP request can come in any order? There is absolutely no guarantee that Host: will be first. You're relying on that assumption. -- Tim Roberts, timr@probo.com Providenza & Boekelheide, Inc.