From 66bd27e6f9018832f99be1c211e76c8f71165c92 Mon Sep 17 00:00:00 2001 From: Matthew Shao Date: Sat, 26 Mar 2016 17:49:22 +0800 Subject: [PATCH] update comments --- mitmproxy/models/http.py | 2 +- mitmproxy/protocol/http.py | 4 ++-- netlib/http/http1/assemble.py | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mitmproxy/models/http.py b/mitmproxy/models/http.py index 428b1ba66..40460182e 100644 --- a/mitmproxy/models/http.py +++ b/mitmproxy/models/http.py @@ -225,7 +225,7 @@ class HTTPResponse(MessageMixin, Response): headers: Headers object - content: Content of the request, the value is None if there is content + content: Content of the response, the value is None if there is content associated, but not present. timestamp_start: Timestamp indicating when request transmission started diff --git a/mitmproxy/protocol/http.py b/mitmproxy/protocol/http.py index 7f134efe0..22e714226 100644 --- a/mitmproxy/protocol/http.py +++ b/mitmproxy/protocol/http.py @@ -50,8 +50,8 @@ class _HttpTransmissionLayer(Layer): yield "this is a generator" # pragma: no cover def send_response(self, response): - if response.content == None: - raise HttpException("Cannot assemble flow with None content") + if response.content is None: + raise HttpException("Cannot assemble flow with missing content") self.send_response_headers(response) self.send_response_body(response, [response.content]) diff --git a/netlib/http/http1/assemble.py b/netlib/http/http1/assemble.py index db5a49ce2..f06ad5a10 100644 --- a/netlib/http/http1/assemble.py +++ b/netlib/http/http1/assemble.py @@ -5,8 +5,8 @@ import itertools from ...exceptions import HttpException def assemble_request(request): - if request.content == None: - raise HttpException("Cannot assemble flow with None content") + if request.content is None: + raise HttpException("Cannot assemble flow with missing content") head = assemble_request_head(request) body = b"".join(assemble_body(request.data.headers, [request.data.content])) return head + body @@ -19,8 +19,8 @@ def assemble_request_head(request): def assemble_response(response): - if response.content == None: - raise HttpException("Cannot assemble flow with None content") + if response.content is None: + raise HttpException("Cannot assemble flow with missing content") head = assemble_response_head(response) body = b"".join(assemble_body(response.data.headers, [response.data.content])) return head + body