import socket
import httplib
import sys

class SocketHTTPConnection(httplib.HTTPConnection):
	def __init__(self, sock, host, port=None, timeout="IGNORE"):
		self.sock = sock
		self._set_hostport(host, port)
		self.timeout = timeout
		if self.timeout == "IGNORE":
			self.timeout = self.sock.gettimeout()
		else:
			self.sock.settimeout(self.timeout)
		self._HTTPConnection__response = None
		self._HTTPConnection__state = httplib._CS_IDLE
		self._buffer = []
		self._method = None

	def connect(self):
		print >> sys.stderr, "warning: .connect() called on SocketHTTPConnection object"

s = socket.socket(socket.AF_UNIX)
s.connect("/home/kyle/tmp/foo")
c = SocketHTTPConnection(s, "localhost")
c.request("GET", "/stupidsserver.py")
resp = c.getresponse()
print resp.read()
