Unverified Commit 71a8a674 authored by Kenton Varda's avatar Kenton Varda Committed by GitHub

Merge pull request #872 from capnproto/http-client-error-details

Add a little more detail to invalid response status line errors.
parents 35627cf5 a167dc19
......@@ -900,18 +900,18 @@ HttpHeaders::ResponseOrProtocolError HttpHeaders::tryParseResponse(kj::ArrayPtr<
KJ_IF_MAYBE(version, consumeWord(ptr)) {
if (!version->startsWith("HTTP/")) {
return ProtocolError { 502, "Bad Gateway",
"ERROR: Invalid response status line.", content };
"ERROR: Invalid response status line (invalid protocol).", content };
}
} else {
return ProtocolError { 502, "Bad Gateway",
"ERROR: Invalid response status line.", content };
"ERROR: Invalid response status line (no spaces).", content };
}
KJ_IF_MAYBE(code, consumeNumber(ptr)) {
response.statusCode = *code;
} else {
return ProtocolError { 502, "Bad Gateway",
"ERROR: Invalid response status code.", content };
"ERROR: Invalid response status line (invalid status code).", content };
}
response.statusText = consumeLine(ptr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment