From 087c8a62e757ef41beaf437d119699414be39d97 Mon Sep 17 00:00:00 2001 From: adnano Date: Tue, 16 Feb 2021 00:55:54 -0500 Subject: [PATCH] request: Allow User in URLs --- request.go | 8 -------- request_test.go | 16 ---------------- 2 files changed, 24 deletions(-) diff --git a/request.go b/request.go index 99b65a3..4beb7b3 100644 --- a/request.go +++ b/request.go @@ -102,20 +102,12 @@ func ReadRequest(r io.Reader) (*Request, error) { if err != nil { return nil, err } - if u.User != nil { - // User is not allowed - return nil, ErrInvalidURL - } return &Request{URL: u}, nil } // Write writes a Gemini request in wire format. // This method consults the request URL only. func (r *Request) Write(w *bufio.Writer) error { - if r.URL.User != nil { - // User is not allowed - return ErrInvalidURL - } url := r.URL.String() if len(url) > 1024 { return ErrInvalidRequest diff --git a/request_test.go b/request_test.go index ea42c70..3497ed6 100644 --- a/request_test.go +++ b/request_test.go @@ -46,14 +46,6 @@ func TestReadRequest(t *testing.T) { Raw: "gemini://example.com", Err: io.EOF, }, - { - Raw: "gemini://user:password@example.com\r\n", - Err: ErrInvalidURL, - }, - { - Raw: "https://user:password@example.net\r\n", - Err: ErrInvalidURL, - }, { // 1030 bytes Raw: maxURL + "xxxxxx", @@ -121,14 +113,6 @@ func TestWriteRequest(t *testing.T) { Req: newRequest(maxURL + "x"), Err: ErrInvalidRequest, }, - { - Req: newRequest("gemini://user:password@example.org"), - Err: ErrInvalidURL, - }, - { - Req: newRequest("https://user:password@example.org"), - Err: ErrInvalidURL, - }, } for _, test := range tests {