1
0
mirror of https://git.sr.ht/~adnano/go-gemini synced 2024-09-18 13:31:36 +02:00
Commit Graph

63 Commits

Author SHA1 Message Date
adnano
53ac2371ef Use bytes.CutSuffix to trim CRLF 2024-03-10 09:35:32 -04:00
adnano
5ed51c632f response: Remove unnecessary length check 2021-03-20 18:29:40 -04:00
adnano
0fb35e1337 response: Limit response header size 2021-03-20 14:01:45 -04:00
adnano
4ee8740ee3 response: Don't use bufReadCloser 2021-03-20 13:41:53 -04:00
adnano
ca2680a958 Tweak request and response parsing 2021-03-20 12:27:20 -04:00
adnano
b3c0a5040d response: Treat empty meta as invalid 2021-03-20 12:07:24 -04:00
adnano
be3417c785 Remove unused field 2021-03-20 12:05:21 -04:00
adnano
57968c0fce Remove charset=utf-8 from default media type 2021-03-20 12:04:42 -04:00
adnano
f574b1d821 Make Response implement io.WriterTo 2021-02-28 22:21:54 -05:00
adnano
469cf1dd86 Reintroduce Response.Write method 2021-02-28 20:50:18 -05:00
adnano
3255b024e9 Remove ResponseWriter.Close method 2021-02-24 19:00:09 -05:00
adnano
c5bd598947 response: Revert to using fields instead of methods 2021-02-24 18:50:40 -05:00
adnano
85fea6646a Add NewResponse function 2021-02-24 10:48:17 -05:00
adnano
249b13c191 ResponseWriter: Remove unexported method 2021-02-24 10:01:46 -05:00
adnano
55e921883d response: Move to methods 2021-02-24 08:43:57 -05:00
adnano
5126abe562 Move ResponseWriter Conn and TLS methods to Request 2021-02-24 08:24:49 -05:00
adnano
6741248fe4 Remove ResponseWriter.Hijack method 2021-02-24 08:22:12 -05:00
adnano
6a0151c60b Implement TimeoutHandler by wrapping ResponseWriter 2021-02-24 08:18:23 -05:00
adnano
36a67255e0 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
adnano
5bb9ae237d Unexport NewResponseWriter 2021-02-23 22:02:47 -05:00
adnano
29a2789434 Reimplement TimeoutHandler 2021-02-23 21:59:16 -05:00
adnano
b21522f6cb response: Change field names 2021-02-23 21:51:42 -05:00
adnano
ea7415e9af Add ResponseWriter.Hijack method 2021-02-23 21:36:29 -05:00
adnano
d3856730ab ResponseWriter: Add TLS and Conn methods 2021-02-23 20:59:04 -05:00
adnano
5641fb7415 Move I/O utilities to io.go 2021-02-23 20:49:55 -05:00
adnano
06d65b8154 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
adnano
4d7bb87110 Update documentation 2021-02-23 18:45:58 -05:00
adnano
8b7bd5b2d7 Make Response an io.ReadCloser 2021-02-23 17:50:47 -05:00
adnano
6d49b91ab7 response: Add Close method 2021-02-23 17:32:23 -05:00
adnano
b2bbb83827 response: Add Conn and TLS methods 2021-02-23 16:36:17 -05:00
adnano
a0d03c9088 response: Remove TLS field 2021-02-23 15:29:27 -05:00
adnano
ff53535185 Rename ResponseWriter.MediaType to SetMediaType 2021-02-21 18:52:06 -05:00
adnano
122fd434d6 Move Flush back to ResponseWriter 2021-02-21 16:06:56 -05:00
adnano
9318ba666b Make Status a type
Using a type is better than using an integer.
2021-02-20 16:16:32 -05:00
adnano
38e0b9b412 response: Implement Write method 2021-02-18 00:07:43 -05:00
adnano
de1e9f071a response: Rename statusCode to status 2021-02-18 00:06:34 -05:00
adnano
98d74f0b34 response: Ensure that only one header is written 2021-02-17 23:05:24 -05:00
adnano
b704a470a7 Redesign ResponseWriter interface 2021-02-17 13:36:16 -05:00
adnano
e4c50cf9ff Rename Meta to StatusText
Rename Meta to StatusText and support all status codes.
2021-02-17 12:06:43 -05:00
adnano
e23fd5217e Move ResponseWriter.Flush to Flusher interface 2021-02-17 11:44:13 -05:00
adnano
a852aa8ac8 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
adnano
87e336e020 Remove faulty status code check in ReadResponse 2021-02-14 18:57:13 -05:00
adnano
715ce122ef Update Response documentation 2021-02-14 16:23:38 -05:00
adnano
5945788ccd 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
adnano
8c0ff0547d Make ResponseWriter an interface 2021-02-09 09:46:18 -05:00
adnano
ecfb9b2154 Use plain integers to represent status codes 2021-02-09 09:46:13 -05:00
adnano
d93adc7908 Make TLS field nil for unencrypted connections 2021-02-08 12:32:49 -05:00
adnano
c37abecc68 Remove unused field 2021-02-08 12:30:53 -05:00
adnano
456f2686bc Guarantee that (*Response).Body is not nil 2021-01-15 15:18:00 -05:00
adnano
106d0b1c1d Update comments 2021-01-10 01:07:38 -05:00