summaryrefslogtreecommitdiff
path: root/omegle.py
diff options
context:
space:
mode:
authoryvesf <yvesf@d0e8fea9-7529-0410-93fb-d39fd5b9c1dd>2009-07-01 21:25:37 +0000
committeryvesf <yvesf@d0e8fea9-7529-0410-93fb-d39fd5b9c1dd>2009-07-01 21:25:37 +0000
commit082ff2e370ad174c326e0d8417d5dc4928b206ab (patch)
treed00eeae47e485af5b66e8715288cf05cd13b416b /omegle.py
parent0460320393b10033df2badb98daefe0335232876 (diff)
downloadomegle-082ff2e370ad174c326e0d8417d5dc4928b206ab.tar.gz
omegle-082ff2e370ad174c326e0d8417d5dc4928b206ab.zip
icq bot an dranom upda
git-svn-id: http://xapek.org/svn/common/omegle@1173 d0e8fea9-7529-0410-93fb-d39fd5b9c1dd
Diffstat (limited to 'omegle.py')
-rw-r--r--omegle.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/omegle.py b/omegle.py
index 395bf4b..62a3892 100644
--- a/omegle.py
+++ b/omegle.py
@@ -54,6 +54,7 @@ class RESTClient(object):
try:
headers = RESTClient.headers.copy()
headers['Host'] = self.host
+ headers['Content-Length'] = str(len(params))
self.conn.request(method,path,params,headers)
resp = self.conn.getresponse()
finally:
@@ -94,14 +95,14 @@ class OmegleChat(RESTClient):
def disconnect(self):
"""Close a chat session."""
self.logger.debug("disconnect()")
- self.is_connected = False
+ self.is_confirmed = False
self.timer.stop()
if self.is_confirmed:
r = RESTClient.request(self,"POST", "/disconnect", urllib.urlencode({'id': self.id}))
body = r.read()
self.logger.debug("/disconnect sent. Read: %s" % body)
if body == "win":
- self.is_confirmed = False
+ self.is_connected = False
self.id = None
self.conn.close()
else:
@@ -110,9 +111,13 @@ class OmegleChat(RESTClient):
def _events(self):
"""does use its own "HTTPConnection" because its called async from a thread"""
conn = httplib.HTTPConnection(self.host)
+ params = urllib.urlencode({'id' : self.id})
+ headers = OmegleChat.headers.copy()
+ headers['Host'] = "omegle.com"
+ headers['Content-Length'] = str(len(params))
conn.request("POST",
"/events",
- urllib.urlencode({'id' : self.id}),
+ params,
OmegleChat.headers)
r=conn.getresponse()
body=r.read()