diff options
author | tjpcc <tjp@ctrl-c.club> | 2023-01-11 10:12:32 -0700 |
---|---|---|
committer | tjpcc <tjp@ctrl-c.club> | 2023-01-11 10:12:32 -0700 |
commit | cc0c7e6eb5b27c3a263352ba40ce8ee5209272a2 (patch) | |
tree | ec19ba822d38e72d3f51284c1488b5a9f8a99925 /gemini/response.go | |
parent | e46658d475632d6ec4bdf4f8a3e4ad2d9682383c (diff) |
Simple client functionality and an example.
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 } |