diff options
| author | Adnan Maolood <[email protected]> | 2021-02-28 22:20:43 -0500 |
|---|---|---|
| committer | Adnan Maolood <[email protected]> | 2021-02-28 22:20:59 -0500 |
| commit | f7012b38dacc29f9c6f94f9ea9274525ac81ac5d (patch) | |
| tree | f181bd8c5141ebfa37c91181860802f3a185e0a2 /request.go | |
| parent | Make Request implement io.WriterTo (diff) | |
| download | go-gemini-f7012b38dacc29f9c6f94f9ea9274525ac81ac5d.tar.xz go-gemini-f7012b38dacc29f9c6f94f9ea9274525ac81ac5d.zip | |
Request.WriteTo: return int64
Diffstat (limited to 'request.go')
| -rw-r--r-- | request.go | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -79,20 +79,20 @@ func ReadRequest(r io.Reader) (*Request, error) { // WriteTo writes r to w in the Gemini request format. // This method consults the request URL only. -func (r *Request) WriteTo(w io.Writer) (int, error) { +func (r *Request) WriteTo(w io.Writer) (int64, error) { bw := bufio.NewWriterSize(w, 1026) url := r.URL.String() if len(url) > 1024 { return 0, ErrInvalidRequest } - var wrote int + var wrote int64 n, err := bw.WriteString(url) - wrote += n + wrote += int64(n) if err != nil { return wrote, err } n, err = bw.Write(crlf) - wrote += n + wrote += int64(n) if err != nil { return wrote, err } |