title: urllib2.urlopen throws 404 exception for urls that browser opens
body: <p>The following url (and others like it) can be opened in a browser but causes urllib2.urlopen to throw a 404 exception: <a href="http://store.ovi.com/#/applications?categoryId=20&amp;fragment=1&amp;page=1" rel="nofollow noreferrer">http://store.ovi.com/#/applications?categoryId=20&amp;fragment=1&amp;page=1</a></p>
  
  <p>geturl() returns the same url (no redirect). The headers are copied and pasted from firebug. I tried passing in the headers as a dictionary to Request, but got the same result.  wget opens the url in the console but not from the script.</p>
  
  <p><strong>the code:</strong></p>
  
  <p>source_url = '<a href="http://store.ovi.com/#/applications?categoryId=20&amp;fragment=1&amp;page=2" rel="nofollow noreferrer">http://store.ovi.com/#/applications?categoryId=20&amp;fragment=1&amp;page=2</a>'<br>
  try:  </p>
  
  <pre><code>    socket.setdefaulttimeout(10)
      hdrs = [('Host','store.ovi.com'),('User-Agent','Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US;rv:1.9.0.13) Gecko/2009073021 Firefox/3.0.13 AppEngine-Google;(+http://code.google.com/appengine)'),('Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'),('Accept-Language','en-us,en;q=0.5'),('Accept-Encoding','gzip,deflate'),('Accept-Charset','ISO-8859-1,utf-8;q=0.7,*;q=0.7'),('Keep-Alive','115'),('Connection','keep-alive'),('Cookie','JNPRSESSID=4u4devdrt7eb6e0qem3gin47i2; s_cc=true; undefined_s=First%20Visit; s_nr=1282817443274; s_sq=%5B%5BB%5D%5D; view=Grid; menu=menuOpen; OVI_DEVICE=b5130'),('Cache-Control','max-age=0')]
  ree = urllib2.Request(source_url)
      ree.addheaders = hdrs
      opener = urllib2.build_opener()
      htmlSource = opener.open(ree).read()
  </code></pre>
  
  <p>except urllib2.HTTPError, e:  </p>
  
  <pre><code>    print e.code  
      print e.msg
      print e.headers
  </code></pre>
  
  <p><strong>The error output:</strong><br>
  404<br>
  Not Found<br>
  Date: Sat, 28 Aug 2010 00:36:57 GMT<br>
  Server: Apache/2.2.3 (Red Hat)<br>
  X-Powered-By: PHP/5.2.2<br>
  Expires: Thu, 19 Nov 1981 08:52:00 GMT<br>
  Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0<br>
  Pragma: no-cache<br>
  Keep-Alive: timeout=7, max=333<br>
  Connection: Keep-Alive<br>
  Transfer-Encoding: chunked<br>
  Content-Type: text/html; charset=UTF-8  </p>
  
  <p>What, if anything, am I doing incorrectly?  Is this a bug? And if so, is there a workaround?  Thanks!</p>