Commit Graph

144 Commits

Author SHA1 Message Date
Sasha Koshka f6d3c47816 Export TLS & remove conn in request struct
This makes it possible to fully create another request outside of this module
(which Hnakra will need) and has better parity with net/http.
2023-05-26 00:38:12 -04:00
Adnan Maolood 21ad3a2ded server: Disallow ServeConn usage after Shutdown 2021-02-24 19:25:52 -05:00
Adnan Maolood 094c16297b server: Fix comment 2021-02-24 08:38:08 -05:00
Adnan Maolood de339490f4 Move ResponseWriter Conn and TLS methods to Request 2021-02-24 08:24:49 -05:00
Adnan Maolood 310bd16344 Unexport NewResponseWriter 2021-02-23 22:02:47 -05:00
Adnan Maolood d35dd3d867 ResponseWriter: Add TLS and Conn methods 2021-02-23 20:59:04 -05:00
Adnan Maolood 75abb99518 request: Remove TLS and Conn methods 2021-02-23 20:57:53 -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 c688defefd request: Add Conn and TLS methods 2021-02-23 17:29:50 -05:00
Adnan Maolood 833edaf63d server: Cancel context on IO errors 2021-02-23 16:06:57 -05:00
Adnan Maolood 1080e95bb4 server: Document use of context in ListenAndServe 2021-02-23 12:10:55 -05:00
Adnan Maolood f722747abd server: Make ErrorLog an interface 2021-02-23 11:10:35 -05:00
Adnan Maolood 5ab7617efd server: Fix Shutdown with no active listeners
Shutdown and Close will hang if there are no active listeners or
connections. Try to close the done channel to avoid that.
2021-02-23 09:28:14 -05:00
Adnan Maolood 8190e819e8 server: Mention certificate store 2021-02-23 09:08:44 -05:00
Adnan Maolood d61cf6318a server: Document use of contexts 2021-02-22 21:33:23 -05:00
Adnan Maolood 99e6c37d92 server: Remove unused constants 2021-02-22 21:28:18 -05:00
Adnan Maolood 31077afbbe server: Return context.Canceled after Shutdown 2021-02-22 21:27:44 -05:00
Adnan Maolood 35f7958083 server: Revert to closing contexts on Shutdown 2021-02-22 21:13:44 -05:00
Adnan Maolood 118e019df0 server: Use channel to communicate shutdown 2021-02-22 20:06:19 -05:00
Adnan Maolood 0a3db2ce41 server: Don't close pending connections after Shutdown 2021-02-21 16:05:10 -05:00
Adnan Maolood 49dac34aff server: Export ServeConn method 2021-02-21 11:53:15 -05:00
Adnan Maolood bb444fb364 server: Don't recover from panics 2021-02-21 11:04:45 -05:00
Adnan Maolood e3d48b2cad server: Return ErrServerClosed 2021-02-21 00:51:02 -05:00
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 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 7668345daa server: Add Context field 2021-02-20 18:52:33 -05:00
Adnan Maolood 15f3e764c5 server: Populate Request.Host field 2021-02-20 18:12:51 -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 e9a68917c9 handler: Make ServeGemini accept a Context 2021-02-20 15:49:14 -05:00
Adnan Maolood a7f958b20d server: Make Request.RemoteAddr a string 2021-02-20 13:31:55 -05:00
Adnan Maolood 64dbb3eecb server: Clarify GetCertificate documentation 2021-02-19 18:53:06 -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 6edde376c4 server: Add Handler field and remove Handle methods 2021-02-17 20:31:03 -05:00
Adnan Maolood b5a3c0adc5 Add utility Handler functions 2021-02-17 19:27:25 -05:00
Adnan Maolood 110c2de6de Redesign ResponseWriter interface 2021-02-17 13:36:16 -05:00
Adnan Maolood a3c1804395 Move ResponseWriter.Flush to Flusher interface 2021-02-17 11:44:13 -05:00
Adnan Maolood 1d6cbddc5b server: Prevent adding Listeners after Close
Check done after calling trackListener to prevent the listener from
being registered after the server is closed.
2021-02-15 20:19:44 -05:00
Adnan Maolood a05fa6d6bd server: Avoid creating a new Listener after Close 2021-02-15 20:16:32 -05:00
Adnan Maolood f158bb5f1d server: Use separate mutex for handlers 2021-02-15 20:05:47 -05:00
Adnan Maolood 5a784693ef server: Rename responder to handler 2021-02-15 01:15:23 -05:00
Adnan Maolood 2c7f8273e9 server: Recover from ServeGemini panics 2021-02-15 00:36:33 -05:00
Adnan Maolood 3f2d540579 server: Implement Close and Shutdown methods 2021-02-14 23:58:33 -05:00
Adnan Maolood 6f7c183662 server: Don't populate Request.Certificate field
Handlers should instead use the certificate provided in Request.TLS.
2021-02-14 17:34:57 -05:00
Adnan Maolood 7c703e95de Update documentation 2021-02-14 15:50:41 -05:00
Adnan Maolood 595b0d0490 server: Populate Request.RemoteAddr field 2021-02-13 21:10:19 -05:00
Adnan Maolood f6824bd813 Make ResponseWriter an interface 2021-02-09 09:46:18 -05:00
Adnan Maolood 7910ed433b Rename Responder to Handler 2021-02-08 12:50:52 -05:00
Adnan Maolood 29f2b3738d Make TLS field nil for unencrypted connections 2021-02-08 12:32:49 -05:00
Adnan Maolood 9e89b93bab server: Allow handling any hostname with "*"
Allow registering a responder with the special pattern "*" to handle any
hostname.
2021-01-25 10:55:40 -05:00