I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 2f59a4b3 authored by str4d's avatar str4d
Browse files

Fix test

parent 63e934f8
No related branches found
No related tags found
No related merge requests found
...@@ -817,7 +817,7 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer { ...@@ -817,7 +817,7 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
* @throws BadRequestException on bad headers * @throws BadRequestException on bad headers
* @throws IOException on other errors in the underlying stream * @throws IOException on other errors in the underlying stream
*/ */
private static Map<String, List<String>> readHeaders(I2PSocket socket, InputStream in, StringBuilder command, static Map<String, List<String>> readHeaders(I2PSocket socket, InputStream in, StringBuilder command,
String[] skipHeaders, I2PAppContext ctx) throws IOException { String[] skipHeaders, I2PAppContext ctx) throws IOException {
HashMap<String, List<String>> headers = new HashMap<String, List<String>>(); HashMap<String, List<String>> headers = new HashMap<String, List<String>>();
StringBuilder buf = new StringBuilder(128); StringBuilder buf = new StringBuilder(128);
......
...@@ -28,7 +28,7 @@ public class I2PTunnelHTTPServerTest extends TestCase { ...@@ -28,7 +28,7 @@ public class I2PTunnelHTTPServerTest extends TestCase {
headerString += "BLAH: something\r\n"; headerString += "BLAH: something\r\n";
headerString += "\r\n"; headerString += "\r\n";
InputStream in = fillInputStream(headerString); InputStream in = fillInputStream(headerString);
Map<String, List<String>> headers = I2PTunnelHTTPServer.readHeaders(in, new StringBuilder(128), new String[0], I2PAppContext.getGlobalContext()); Map<String, List<String>> headers = I2PTunnelHTTPServer.readHeaders(null, in, new StringBuilder(128), new String[0], I2PAppContext.getGlobalContext());
assertEquals(headers.size(), 1); //One header assertEquals(headers.size(), 1); //One header
} }
...@@ -38,7 +38,7 @@ public class I2PTunnelHTTPServerTest extends TestCase { ...@@ -38,7 +38,7 @@ public class I2PTunnelHTTPServerTest extends TestCase {
headerString += "someHeader: oh my, duplication!\r\n"; headerString += "someHeader: oh my, duplication!\r\n";
headerString += "\r\n"; headerString += "\r\n";
InputStream in = fillInputStream(headerString); InputStream in = fillInputStream(headerString);
Map<String, List<String>> headers = I2PTunnelHTTPServer.readHeaders(in, new StringBuilder(128), new String[0], I2PAppContext.getGlobalContext()); Map<String, List<String>> headers = I2PTunnelHTTPServer.readHeaders(null, in, new StringBuilder(128), new String[0], I2PAppContext.getGlobalContext());
assertEquals(headers.size(), 1); assertEquals(headers.size(), 1);
assertEquals(headers.get("someHeader").size(), 2); assertEquals(headers.get("someHeader").size(), 2);
} }
...@@ -51,7 +51,7 @@ public class I2PTunnelHTTPServerTest extends TestCase { ...@@ -51,7 +51,7 @@ public class I2PTunnelHTTPServerTest extends TestCase {
headerString += "\r\n"; headerString += "\r\n";
InputStream in = fillInputStream(headerString); InputStream in = fillInputStream(headerString);
StringBuilder builder = new StringBuilder(128); StringBuilder builder = new StringBuilder(128);
Map<String, List<String>> headers = I2PTunnelHTTPServer.readHeaders(in, builder, new String[0], I2PAppContext.getGlobalContext()); Map<String, List<String>> headers = I2PTunnelHTTPServer.readHeaders(null, in, builder, new String[0], I2PAppContext.getGlobalContext());
String result = I2PTunnelHTTPServer.formatHeaders(headers, builder); String result = I2PTunnelHTTPServer.formatHeaders(headers, builder);
int first = result.indexOf("abc"); int first = result.indexOf("abc");
assertTrue(first >= 0); assertTrue(first >= 0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment