title: Various timeouts for python httplib
body: <p>I'm implementing a little service that fetches web pages from various servers. I need to be able to configure different types of timeouts. I've tried mucking around with the <code>settimeout</code> method of sockets but it's not exactly as I'd like it. Here are the problems. </p>
  
  <ol>
  <li><p>I need to specify a timeout for the initial DNS lookup. I understand this is done when I instantiate the <code>HTTPConnection</code> at the beginning. </p></li>
  <li><p>My code is written in such a way that I first <code>.read</code> a chunk of data (around 10 MB) and if the entire payload fits in this, I move on to other parts of the code. If it doesn't fit in this, I directly stream the payload out to a file rather than into memory. When this happens, I do an unbounded <code>.read()</code> to get the data and if the remote side sends me, say, a byte of data every second, the connection just keeps waiting receiving one byte every second. I want to be able to disconnect with a "you're taking too long". A thread based solution would be the last resort. </p></li>
  </ol>