From dbd11bf3873382500bbee5769a7276ba90384162 Mon Sep 17 00:00:00 2001 From: Channel Cat Date: Fri, 14 Oct 2016 03:59:41 -0700 Subject: [PATCH] Reverting --- sanic/sanic.py | 2 +- sanic/server.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sanic/sanic.py b/sanic/sanic.py index a8b532ce..6092b838 100644 --- a/sanic/sanic.py +++ b/sanic/sanic.py @@ -111,7 +111,7 @@ class Sanic: if not response: # Fetch handler from router handler, args, kwargs = self.router.get(request) - if not handler: + if handler is None: raise ServerError("'None' was returned while requesting a handler from the router") # Run response handler diff --git a/sanic/server.py b/sanic/server.py index 2939b54f..f824d17e 100644 --- a/sanic/server.py +++ b/sanic/server.py @@ -25,7 +25,7 @@ class HttpProtocol(asyncio.Protocol): self.loop = loop self.transport = None self.request = None - self.parser = False + self.parser = None self.url = None self.headers = None self.signal = signal @@ -64,7 +64,8 @@ class HttpProtocol(asyncio.Protocol): return self.bail_out("Request too large ({}), connection closed".format(self._total_request_size)) # Create parser if this is the first time we're receiving data - if not self.parser: + if self.parser is None: + assert self.request is None self.headers = [] self.parser = httptools.HttpRequestParser(self)