Implemented the PROXY protocol

Removed old HttpParser PROXY tests
This commit is contained in:
Greg Wilkins 2014-11-14 10:28:04 +11:00
parent a62f68e438
commit 593cb39059
1 changed files with 0 additions and 57 deletions

View File

@ -1496,63 +1496,6 @@ public class HttpParserTest
}
@Test
public void testProxyProtocol() throws Exception
{
ByteBuffer buffer=BufferUtil
.toBuffer("PROXY TCP4 107.47.45.254 10.0.1.116 27689 80\015\012"
+"GET / HTTP/1.1\015\012"
+"Host: localhost \015\012"
+"Connection: close\015\012"+"\015\012"+"\015\012");
Handler handler=new Handler();
HttpParser parser=new HttpParser((HttpParser.RequestHandler)handler);
parseAll(parser, buffer);
assertTrue(_headerCompleted);
assertTrue(_messageCompleted);
assertEquals("GET", _methodOrVersion);
assertEquals("/", _uriOrStatus);
assertEquals("HTTP/1.1", _versionOrReason);
assertEquals("PROXY TCP4 107.47.45.254 10.0.1.116 27689 80", handler._proxy);
assertEquals("Host", _hdr[0]);
assertEquals("localhost", _val[0]);
assertEquals("Connection", _hdr[1]);
assertEquals("close", _val[1]);
assertEquals(1, _headers);
}
@Test
public void testSplitProxyHeaderParseTest() throws Exception
{
Handler handler=new Handler();
HttpParser parser=new HttpParser((HttpParser.RequestHandler)handler);
ByteBuffer buffer=BufferUtil.toBuffer("PROXY TCP4 207.47.45.254 10.0.1.116 27689 80\015\012");
parser.parseNext(buffer);
buffer=BufferUtil.toBuffer(
"GET / HTTP/1.1\015\012"
+"Host: localhost \015\012"
+"Connection: close\015\012"
+"\015\012"
+"\015\012");
parser.parseNext(buffer);
assertTrue(_headerCompleted);
assertTrue(_messageCompleted);
assertEquals("GET", _methodOrVersion);
assertEquals("/", _uriOrStatus);
assertEquals("HTTP/1.1", _versionOrReason);
assertEquals("PROXY TCP4 207.47.45.254 10.0.1.116 27689 80", handler._proxy);
assertEquals("Host", _hdr[0]);
assertEquals("localhost", _val[0]);
assertEquals("Connection", _hdr[1]);
assertEquals("close", _val[1]);
assertEquals(1, _headers);
}
@Test
public void testFolded() throws Exception
{