Skip to content

Commit 7779c75

Browse files
committed
drop pipe_response
1 parent 64f0658 commit 7779c75

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

local/proxy.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2140,13 +2140,10 @@ def do_METHOD_FWD(self):
21402140
if response.status in (400, 405):
21412141
common.GAE_CRLF = 0
21422142
self.wfile.write(('HTTP/1.1 %s\r\n%s\r\n' % (response.status, ''.join('%s: %s\r\n' % (k.title(), v) for k, v in response.getheaders() if k.title() != 'Transfer-Encoding'))))
2143-
queue = Queue.Queue()
2144-
threading._start_new_thread(pipe_response_to_queue, (response, queue, 8192))
21452143
while True:
2146-
data = queue.get()
2147-
if data is StopIteration or isinstance(data, Exception):
2148-
response.close()
2149-
return
2144+
data = response.read(8192)
2145+
if not data:
2146+
break
21502147
self.wfile.write(data)
21512148
response.close()
21522149
except NetWorkIOError as e:
@@ -2268,11 +2265,9 @@ def do_METHOD_AGENT(self):
22682265
start, end, length = tuple(int(x) for x in re.search(r'bytes (\d+)-(\d+)/(\d+)', content_range).group(1, 2, 3))
22692266
else:
22702267
start, end, length = 0, content_length-1, content_length
2271-
queue = Queue.Queue()
2272-
threading._start_new_thread(pipe_response_to_queue, (response, queue, 8192))
22732268
while True:
2274-
data = queue.get()
2275-
if data is StopIteration or isinstance(data, Exception):
2269+
data = response.read(8192)
2270+
if not data:
22762271
response.close()
22772272
return
22782273
start += len(data)
@@ -2549,11 +2544,9 @@ def do_METHOD_AGENT(self):
25492544
self.wfile.write('HTTP/1.1 %s\r\n%s\r\n' % (response.status, ''.join('%s: %s\r\n' % (k, v) for k, v in response.getheaders())))
25502545

25512546
cipher = response.status == 200 and response.getheader('Content-Type', '') == 'image/gif' and XORCipher(common.PHP_PASSWORD[0])
2552-
queue = Queue.Queue()
2553-
threading._start_new_thread(pipe_response_to_queue, (response, queue, 8192))
25542547
while True:
2555-
data = queue.get()
2556-
if data is StopIteration or isinstance(data, Exception):
2548+
data = response.read(8192)
2549+
if not data:
25572550
response.close()
25582551
break
25592552
if cipher:

0 commit comments

Comments
 (0)