summaryrefslogtreecommitdiff
path: root/gemini/response.go
diff options
context:
space:
mode:
authortjpcc <tjp@ctrl-c.club>2023-01-11 10:12:32 -0700
committertjpcc <tjp@ctrl-c.club>2023-01-11 10:12:32 -0700
commitcc0c7e6eb5b27c3a263352ba40ce8ee5209272a2 (patch)
treeec19ba822d38e72d3f51284c1488b5a9f8a99925 /gemini/response.go
parente46658d475632d6ec4bdf4f8a3e4ad2d9682383c (diff)
Simple client functionality and an example.
Diffstat (limited to 'gemini/response.go')
-rw-r--r--gemini/response.go5
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
}