Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Header Field Parsing Exception #8

Open
Oliver-Loeffler opened this issue Mar 11, 2017 · 0 comments
Open

Header Field Parsing Exception #8

Oliver-Loeffler opened this issue Mar 11, 2017 · 0 comments
Assignees

Comments

@Oliver-Loeffler
Copy link
Owner

Messages w/o message body (payload) cause an Exception as the HttpResponse.fromBytes() method tries to access message lines which do not exist.

int lineIndex = 1;
	String line = responseLines[lineIndex];
	while (!line.isEmpty()) {
	    HeaderField messageField = HeaderFieldFactory.getInstance().fromString(line);
	    int separation = line.indexOf(SPACE) + 1;
	    responseBuilder.addMessageField(messageField, line.substring(separation, line.length()));
	    line = responseLines[lineIndex++];
	}

The last call of java line = responseLines[lineIndex++]; will cause an exception when lineIndex exceeds length or java responseLines.length .

@Oliver-Loeffler Oliver-Loeffler self-assigned this Mar 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant