Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

fixed sync lib to munch up trailing breaks so we can send the same ha…

…ndler more than one message
  • Loading branch information...
commit ff0362b6de1cc3a7c20ced1af958a52902ba5904 1 parent edb1c61
shu.chen sirpengi authored javisantana committed

Showing 1 changed file with 8 additions and 2 deletions. Show diff stats Hide diff stats

  1. +8 2 varnish.py
10 varnish.py
@@ -27,11 +27,17 @@ def fetch(self, command):
27 27 """
28 28 logging.debug('SENT: %s: %s' % (self.host, command))
29 29 self.write('%s\n' % command)
30   - (status, length), content = map(int, self.read_until('\n').split()), ''
31   - assert status == 200, 'Bad response code: %s %s' % (status, self.read_until('\n').rstrip())
  30 + while 1:
  31 + buffer = self.read_until('\n').strip()
  32 + if len(buffer):
  33 + break
  34 + status, length = map(int, buffer.split())
  35 + content = ''
  36 + assert status == 200, 'Bad response code: {status} {text} ({command})'.format(status=status, text=self.read_until('\n').strip(), command=command)
32 37 while len(content) < length:
33 38 content += self.read_until('\n')
34 39 logging.debug('RECV: %s: %dB %s' % (status,length,content[:30]))
  40 + self.read_eager()
35 41 return (status, length), content
36 42
37 43 # Service control methods

0 comments on commit ff0362b

Please sign in to comment.
Something went wrong with that request. Please try again.