diff options
author | tjp <tjp@ctrl-c.club> | 2023-11-13 07:27:56 -0700 |
---|---|---|
committer | tjp <tjp@ctrl-c.club> | 2023-11-13 07:27:56 -0700 |
commit | aa9bca810912f102a13a674ee30bf97f5667f662 (patch) | |
tree | 793c215fee17cdf5c728af47ff8510a02aad874e /spartan | |
parent | 629e6a0e0c3a24f35888036f957ee3a631e62816 (diff) |
lint and bug fixes
Diffstat (limited to 'spartan')
-rw-r--r-- | spartan/request.go | 14 | ||||
-rw-r--r-- | spartan/request_test.go | 1 |
2 files changed, 8 insertions, 7 deletions
diff --git a/spartan/request.go b/spartan/request.go index d6a06f3..aa696fa 100644 --- a/spartan/request.go +++ b/spartan/request.go @@ -44,18 +44,20 @@ func ParseRequest(rdr io.Reader) (*types.Request, int, error) { return nil, 0, InvalidRequestLine } + u, err := url.Parse(path) + if err != nil { + return nil, 0, err + } + u.Scheme = "spartan" + u.Host = host + contentlen, err := strconv.Atoi(rest) if err != nil { return nil, 0, err } return &types.Request{ - URL: &url.URL{ - Scheme: "spartan", - Host: host, - Path: path, - RawPath: path, - }, + URL: u, Meta: &io.LimitedReader{R: bufrdr, N: int64(contentlen)}, }, contentlen, nil } diff --git a/spartan/request_test.go b/spartan/request_test.go index 89326f1..cb15459 100644 --- a/spartan/request_test.go +++ b/spartan/request_test.go @@ -38,7 +38,6 @@ func TestParseRequest(t *testing.T) { assert.Equal(t, test.host, request.Host) assert.Equal(t, test.path, request.Path) - assert.Equal(t, test.path, request.RawPath) assert.Equal(t, test.clen, clen) }) } |