Tweak request and response parsing

This commit is contained in:
Adnan Maolood
2021-03-20 12:27:20 -04:00
parent e5c0afa013
commit 5141eaafaa
5 changed files with 48 additions and 44 deletions

View File

@@ -2,7 +2,6 @@ package gemini
import (
"bufio"
"io"
"net/url"
"strings"
"testing"
@@ -36,25 +35,25 @@ func TestReadRequest(t *testing.T) {
},
{
Raw: "\r\n",
URL: &url.URL{},
Err: ErrInvalidRequest,
},
{
Raw: "gemini://example.com\n",
Err: io.EOF,
Err: ErrInvalidRequest,
},
{
Raw: "gemini://example.com",
Err: io.EOF,
Err: ErrInvalidRequest,
},
{
// 1030 bytes
Raw: maxURL + "xxxxxx",
Err: io.EOF,
Err: ErrInvalidRequest,
},
{
// 1027 bytes
Raw: maxURL + "x" + "\r\n",
Err: io.EOF,
Err: ErrInvalidRequest,
},
{
// 1024 bytes