diff options
Diffstat (limited to 'gemini/response.go')
-rw-r--r-- | gemini/response.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gemini/response.go b/gemini/response.go index 478913b..1fa64cf 100644 --- a/gemini/response.go +++ b/gemini/response.go @@ -283,6 +283,9 @@ func ParseResponse(rdr io.Reader) (*Response, error) { if hdrLine[len(hdrLine)-2] != '\r' { return nil, InvalidResponseLineEnding } + if hdrLine[2] != ' ' { + return nil, InvalidResponseHeaderLine + } hdrLine = hdrLine[:len(hdrLine)-2] status, err := strconv.Atoi(string(hdrLine[:2])) @@ -292,7 +295,7 @@ func ParseResponse(rdr io.Reader) (*Response, error) { return &Response{ Status: Status(status), - Meta: string(hdrLine[2:]), + Meta: string(hdrLine[3:]), Body: bufrdr, }, nil } |