From cc0c7e6eb5b27c3a263352ba40ce8ee5209272a2 Mon Sep 17 00:00:00 2001 From: tjpcc Date: Wed, 11 Jan 2023 10:12:32 -0700 Subject: Simple client functionality and an example. --- gemini/response.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gemini/response.go') 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 } -- cgit v1.2.3