Skip to content

Commit

Permalink
Fix error when ":" is not part of string
Browse files Browse the repository at this point in the history
  • Loading branch information
daneren2005 committed Mar 7, 2015
1 parent a0c6e29 commit 6976d20
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/github/daneren2005/serverproxy/ServerProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,12 @@ protected HttpRequest readRequest() {
try {
String line;
while((line = reader.readLine()) != null && !"".equals(line)) {
String headerName = line.substring(0, line.indexOf(':'));
String headerValue = line.substring(line.indexOf(": ") + 2);
request.addHeader(headerName, headerValue);
int index = line.indexOf(':');
if(index != -1) {
String headerName = line.substring(0, index);
String headerValue = line.substring(index + 2);
request.addHeader(headerName, headerValue);
}
}
} catch(IOException e) {
// Don't really care once past first line
Expand Down

0 comments on commit 6976d20

Please sign in to comment.