From 23bc5f4fb7542e64c94eaa7fe2c7a6aa55010898 Mon Sep 17 00:00:00 2001 From: tjpcc Date: Sat, 12 Aug 2023 09:40:39 -0600 Subject: move common types to an internal package This helps avoid import cycles. --- gemini/request.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gemini/request.go') diff --git a/gemini/request.go b/gemini/request.go index 51aaae5..4eb7cf0 100644 --- a/gemini/request.go +++ b/gemini/request.go @@ -6,7 +6,7 @@ import ( "io" "net/url" - sr "tildegit.org/tjp/sliderule" + "tildegit.org/tjp/sliderule/internal/types" ) // InvalidRequestLineEnding indicates that a gemini request didn't end with "\r\n". @@ -15,7 +15,7 @@ var InvalidRequestLineEnding = errors.New("invalid request line ending") // ParseRequest parses a single gemini request from a reader. // // If the reader argument is a *bufio.Reader, it will only read a single line from it. -func ParseRequest(rdr io.Reader) (*sr.Request, error) { +func ParseRequest(rdr io.Reader) (*types.Request, error) { bufrdr, ok := rdr.(*bufio.Reader) if !ok { bufrdr = bufio.NewReader(rdr) @@ -39,14 +39,14 @@ func ParseRequest(rdr io.Reader) (*sr.Request, error) { u.Scheme = "gemini" } - return &sr.Request{URL: u}, nil + return &types.Request{URL: u}, nil } // GetTitanRequestBody fetches the request body from a titan request. // // It returns nil if the argument is not a titan request or it otherwise // does not have a request body set. -func GetTitanRequestBody(request *sr.Request) io.Reader { +func GetTitanRequestBody(request *types.Request) io.Reader { if request.Scheme != "titan" { return nil } -- cgit v1.2.3