aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_server.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_server.py')
-rw-r--r--test/test_server.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/test/test_server.py b/test/test_server.py
index 8878cf32..e4a62fa5 100644
--- a/test/test_server.py
+++ b/test/test_server.py
@@ -1,6 +1,7 @@
import urllib, urllib2, unittest
import time
import libpathod.test, requests
+from netlib import tcp, http
import tutils
"""
@@ -21,7 +22,19 @@ class SanityMixin:
class TestHTTP(tutils.HTTPProxTest, SanityMixin):
- pass
+ def test_invalid_http(self):
+ t = tcp.TCPClient("127.0.0.1", self.proxy.port)
+ t.connect()
+ t.wfile.write("invalid\n\n")
+ t.wfile.flush()
+ assert "Bad Request" in t.rfile.readline()
+
+ def test_invalid_connect(self):
+ t = tcp.TCPClient("127.0.0.1", self.proxy.port)
+ t.connect()
+ t.wfile.write("CONNECT invalid\n\n")
+ t.wfile.flush()
+ assert "Bad Request" in t.rfile.readline()
class TestHTTPS(tutils.HTTPProxTest, SanityMixin):