1
0
Fork 0
mirror of https://git.sr.ht/~adnano/go-gemini synced 2024-05-06 00:26:19 +02:00
Commit Graph

63 Commits

Author SHA1 Message Date
Adnan Maolood b95b0e6a69 Use bytes.CutSuffix to trim CRLF 2024-03-10 09:35:32 -04:00
Adnan Maolood 056e55abbb response: Remove unnecessary length check 2021-03-20 18:29:40 -04:00
Adnan Maolood 72d437c82e response: Limit response header size 2021-03-20 14:01:45 -04:00
Adnan Maolood 3dca29eb41 response: Don't use bufReadCloser 2021-03-20 13:41:53 -04:00
Adnan Maolood 5141eaafaa Tweak request and response parsing 2021-03-20 12:27:20 -04:00
Adnan Maolood e5c0afa013 response: Treat empty meta as invalid 2021-03-20 12:07:24 -04:00
Adnan Maolood 4c7c200f92 Remove unused field 2021-03-20 12:05:21 -04:00
Adnan Maolood 0a709da439 Remove charset=utf-8 from default media type 2021-03-20 12:04:42 -04:00
Adnan Maolood 69f0913b3d Make Response implement io.WriterTo 2021-02-28 22:21:54 -05:00
Adnan Maolood 845f8e9bd1 Reintroduce Response.Write method 2021-02-28 20:50:18 -05:00
Adnan Maolood 1764e02d1e Remove ResponseWriter.Close method 2021-02-24 19:00:09 -05:00
Adnan Maolood 1bc5c68c3f response: Revert to using fields instead of methods 2021-02-24 18:50:40 -05:00
Adnan Maolood cb7879c966 Add NewResponse function 2021-02-24 10:48:17 -05:00
Adnan Maolood b66b287f94 ResponseWriter: Remove unexported method 2021-02-24 10:01:46 -05:00
Adnan Maolood 3101856afa response: Move to methods 2021-02-24 08:43:57 -05:00
Adnan Maolood de339490f4 Move ResponseWriter Conn and TLS methods to Request 2021-02-24 08:24:49 -05:00
Adnan Maolood b488146cc6 Remove ResponseWriter.Hijack method 2021-02-24 08:22:12 -05:00
Adnan Maolood 069b473c28 Implement TimeoutHandler by wrapping ResponseWriter 2021-02-24 08:18:23 -05:00
Adnan Maolood 3660698a4b Make ResponseWriter an interface
Make ResponseWriter an interface with an unexported method. Implementors
must embed a ResponseWriter from elsewhere. This gives us the
flexibility of an interface while allowing us to add new methods in the
future.
2021-02-24 00:13:46 -05:00
Adnan Maolood 310bd16344 Unexport NewResponseWriter 2021-02-23 22:02:47 -05:00
Adnan Maolood 9eae88f00c Reimplement TimeoutHandler 2021-02-23 21:59:16 -05:00
Adnan Maolood b386a9ba41 response: Change field names 2021-02-23 21:51:42 -05:00
Adnan Maolood f28a63ff0c Add ResponseWriter.Hijack method 2021-02-23 21:36:29 -05:00
Adnan Maolood d35dd3d867 ResponseWriter: Add TLS and Conn methods 2021-02-23 20:59:04 -05:00
Adnan Maolood e8d98ef4ec Move I/O utilities to io.go 2021-02-23 20:49:55 -05:00
Adnan Maolood a65c3c3d4f Make ResponseWriter a struct
Make ResponseWriter a struct again so that it can be extended in a
backwards-compatible way.
2021-02-23 20:41:16 -05:00
Adnan Maolood 02bbedc330 Update documentation 2021-02-23 18:45:58 -05:00
Adnan Maolood e1c04ee605 Make Response an io.ReadCloser 2021-02-23 17:50:47 -05:00
Adnan Maolood ae3fc2fc73 response: Add Close method 2021-02-23 17:32:23 -05:00
Adnan Maolood 83c904913f response: Add Conn and TLS methods 2021-02-23 16:36:17 -05:00
Adnan Maolood 62e22b4cf2 response: Remove TLS field 2021-02-23 15:29:27 -05:00
Adnan Maolood 2c64db3863 Rename ResponseWriter.MediaType to SetMediaType 2021-02-21 18:52:06 -05:00
Adnan Maolood c3feafa90b Move Flush back to ResponseWriter 2021-02-21 16:06:56 -05:00
Adnan Maolood 8938038797 Make Status a type
Using a type is better than using an integer.
2021-02-20 16:16:32 -05:00
Adnan Maolood aab3ac4dfe response: Implement Write method 2021-02-18 00:07:43 -05:00
Adnan Maolood a3a995df35 response: Rename statusCode to status 2021-02-18 00:06:34 -05:00
Adnan Maolood 9ed2363b66 response: Ensure that only one header is written 2021-02-17 23:05:24 -05:00
Adnan Maolood 110c2de6de Redesign ResponseWriter interface 2021-02-17 13:36:16 -05:00
Adnan Maolood ec22e762c3 Rename Meta to StatusText
Rename Meta to StatusText and support all status codes.
2021-02-17 12:06:43 -05:00
Adnan Maolood a3c1804395 Move ResponseWriter.Flush to Flusher interface 2021-02-17 11:44:13 -05:00
Adnan Maolood bf4959a8ba Return ErrInvalidResponse on error reading status
Return ErrInvalidResponse when unable to read the response status code
instead of returning the error from strconv.
2021-02-15 19:18:23 -05:00
Adnan Maolood 198a0b31c8 Remove faulty status code check in ReadResponse 2021-02-14 18:57:13 -05:00
Adnan Maolood 0c303588a4 Update Response documentation 2021-02-14 16:23:38 -05:00
Adnan Maolood 37e5686764 Remove StatusClass* constants
Re-use the existing Status* constants and adjust StatusClass to return a
valid Status.
2021-02-14 16:01:39 -05:00
Adnan Maolood f6824bd813 Make ResponseWriter an interface 2021-02-09 09:46:18 -05:00
Adnan Maolood 5ef5824d6f Use plain integers to represent status codes 2021-02-09 09:46:13 -05:00
Adnan Maolood 29f2b3738d Make TLS field nil for unencrypted connections 2021-02-08 12:32:49 -05:00
Adnan Maolood 1f39cab063 Remove unused field 2021-02-08 12:30:53 -05:00
Adnan Maolood 31de8d49b0 Guarantee that (*Response).Body is not nil 2021-01-15 15:18:00 -05:00
Adnan Maolood 5e977250ec Update comments 2021-01-10 01:07:38 -05:00