Skip to content

Commit

Permalink
#30 Fix for colon in query string
Browse files Browse the repository at this point in the history
  • Loading branch information
neotyk committed Jul 25, 2010
1 parent 372776c commit 32d757b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ private String getBaseUrl(URI uri){
port = getPort(uri);
url = url.substring(0,url.length() -1) + ":" + port;
}
return url.substring(0,url.lastIndexOf(":") + String.valueOf(port).length() +1);
return url.substring(0,url.indexOf(":", 9) + String.valueOf(port).length() +1);
}

private static int getPort(URI uri) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,10 @@ public void urlWithoutSlashTest() throws Throwable {
public void urlWithColonTest() throws Throwable {
AsyncHttpClient c = new AsyncHttpClient();

String body = "hello there";

// once
Response response = c.preparePost(String.format("https://127.0.0.1:%d/foo/test/colon?q=test:colon:", port1))
.setBody(body)
String query = "q=test:colon:";
Response response = c.prepareGet(String.format("https://127.0.0.1:%d/foo/test/colon?%s", port1, query))
.execute().get(TIMEOUT, TimeUnit.SECONDS);

assertEquals(response.getResponseBody(),body);
assertEquals(response.getHeader("X-queryString"), query);
}
}

0 comments on commit 32d757b

Please sign in to comment.