Adnan Maolood
3fa55b52dd
server: Use separate context to cancel listeners
...
Use a separate context to cancel listeners so that cancelling the
listener does not cancel it's connections.
2021-02-21 00:41:41 -05:00
Adnan Maolood
6c701ad9fe
examples/stream: Showcase Server.Shutdown method
2021-02-21 00:29:41 -05:00
Adnan Maolood
7084a226f4
examples: Use context
2021-02-21 00:26:30 -05:00
Adnan Maolood
f6505ae4c4
server: Use explicit context arguments
...
Replace the Server.Context field with explicit context.Context arguments
to most Server functions.
2021-02-21 00:21:31 -05:00
Adnan Maolood
0c8c945eba
client: Inline result type
2021-02-21 00:20:42 -05:00
Adnan Maolood
7668345daa
server: Add Context field
2021-02-20 18:52:33 -05:00
Adnan Maolood
0baa66a4e7
Update examples
2021-02-20 18:30:49 -05:00
Adnan Maolood
d479c6391c
certificate.Store: Support "*" wildcard pattern
2021-02-20 18:26:15 -05:00
Adnan Maolood
423914d6e0
certificate.Store: Generate certificates by default
2021-02-20 18:25:02 -05:00
Adnan Maolood
15f3e764c5
server: Populate Request.Host field
2021-02-20 18:12:51 -05:00
Adnan Maolood
fadb2aed97
mux: Use StatusHandler instead of RedirectHandler
2021-02-20 16:45:37 -05:00
Adnan Maolood
252fe678fd
Rename RedirectHandler to StatusHandler
2021-02-20 16:44:42 -05:00
Adnan Maolood
351fb92c7e
Remove NotFound function
2021-02-20 16:42:18 -05:00
Adnan Maolood
2308c6407f
server: Make Request.RemoteAddr a net.Addr
...
A concrete type is better.
2021-02-20 16:27:35 -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
99a8f09c22
TimeoutHandler: Use provided context
2021-02-20 15:52:54 -05:00
Adnan Maolood
e9a68917c9
handler: Make ServeGemini accept a Context
2021-02-20 15:49:14 -05:00
Adnan Maolood
eca2afeb32
examples/client: Remove dependency on go-xdg
2021-02-20 15:42:06 -05:00
Adnan Maolood
28b6232fbf
examples/client: Use context
2021-02-20 15:39:47 -05:00
Adnan Maolood
3f4fd10b6d
client: Make Get and Do accept a Context
...
This removes the need for Request.Context.
2021-02-20 15:34:21 -05:00
Adnan Maolood
a7f958b20d
server: Make Request.RemoteAddr a string
2021-02-20 13:31:55 -05:00
Adnan Maolood
0ab236c736
client: Allow Request.Host to omit a port
2021-02-20 13:30:55 -05:00
Adnan Maolood
5922cff2e5
Implement TimeoutHandler
2021-02-20 00:49:21 -05:00
Adnan Maolood
64dbb3eecb
server: Clarify GetCertificate documentation
2021-02-19 18:53:06 -05:00
Adnan Maolood
69674fcdd5
examples/server: Use certificate.Store
2021-02-19 18:45:19 -05:00
Adnan Maolood
66e03ef1e4
certificate: Implement GetCertificate callback
2021-02-19 18:42:53 -05:00
Adnan Maolood
76967dad2e
mux: Reject empty patterns
2021-02-19 18:06:54 -05:00
Adnan Maolood
2e149c9ccd
server: Remove Certificates field
...
Use GetCertificate to retrieve certificates without consulting
Certificates.
2021-02-18 22:22:20 -05:00
Adnan Maolood
229ebb4106
request.Write: Accept an io.Writer
2021-02-18 21:58:37 -05:00
Adnan Maolood
c70ef5c470
client: Remove superfluous call to Flush
2021-02-18 21:55:17 -05:00
Adnan Maolood
6928a1efef
request.Write: return error from Flush
2021-02-18 21:54:38 -05:00
Adnan Maolood
a80aae44a9
doc: Update package documentation
2021-02-18 00:38:03 -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
33a1fa4e0d
Remove .gitignore
2021-02-17 20:40:53 -05:00
Adnan Maolood
7475687caa
examples: Use Server.Handler
2021-02-17 20:35:27 -05:00
Adnan Maolood
6edde376c4
server: Add Handler field and remove Handle methods
2021-02-17 20:31:03 -05:00
Adnan Maolood
f3cd70612b
mux: Implement matching of schemes and hostnames
2021-02-17 20:09:42 -05:00
Adnan Maolood
3d6ac90e08
Reverse order of RedirectHandler arguments
2021-02-17 19:53:00 -05:00
Adnan Maolood
b5a3c0adc5
Add utility Handler functions
2021-02-17 19:27:25 -05:00
Adnan Maolood
f81c32a211
examples: Use new ResponseWriter interface
2021-02-17 13:39:23 -05:00
Adnan Maolood
110c2de6de
Redesign ResponseWriter interface
2021-02-17 13:36:16 -05:00
Adnan Maolood
8543eca416
status: Fix typo
2021-02-17 12:23:03 -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
fb9b50871c
fs: Reject potentially unsafe requests in ServeFile
...
Reject requests where r.URL.Path contains a ".." path element to protect
against callers who might unsafely use filepath.Join on r.URL.Path
without sanitizing it.
2021-02-17 11:17:13 -05:00
Adnan Maolood
96dc161b4a
fs: Add ServeContent function
2021-02-17 11:15:30 -05:00
Adnan Maolood
246b252fd7
examples/server: Use os.DirFS
2021-02-17 09:25:44 -05:00
Adnan Maolood
2e5569d5b5
fs: Fix redirect to canonical file path
2021-02-17 09:24:09 -05:00