1
0
mirror of https://git.sr.ht/~adnano/go-gemini synced 2024-12-04 17:58:14 +01:00
Commit Graph

10 Commits

Author SHA1 Message Date
Hugo Wetterberg
68767e6bf0 Add missing error handling
Error handling is currently missing is a couple of places. Most of
them are i/o related.

This change adds checks, an therefore sometimes also has to change
function signatures by adding an error return value. In the case of
the response writer the status and meta handling is changed and this
also breaks the API.

In some places where we don't have any reasonable I've added
assignment to a blank identifier to make it clear that we're ignoring
an error.

text: read the Err() that can be set by the scanner.

client: check if conn.SetDeadline() returns an error.

client: check if req.Write() returns an error.

fs: panic if mime type registration fails.

server: stop performing i/o in Header/Status functions

By deferring the actual header write to the first Write() or Flush()
call we don't have to do any error handling in Header() or Status().

As Server.respond() now defers a ResponseWriter.Flush() instead of
directly flushing the underlying bufio.Writer this has the added
benefit of ensuring that we always write a header
to the client, even if the responder is a complete NOOP.

tofu: return an error if we fail to write to the known hosts writer.
2021-01-09 23:53:07 -05:00
adnano
6c278d6654 Add ParseLines function 2020-10-29 09:42:53 -04:00
adnano
b7d4926314 Remove (Text).HTML function 2020-10-26 12:49:16 -04:00
adnano
6cccba3800 Rename repository to go-gemini 2020-10-24 15:15:32 -04:00
adnano
0721c60b28 Add (Text).HTML function to render text to HTML 2020-10-15 00:38:05 -04:00
adnano
e94ae4ad4c Prevent other packages from implementing Line 2020-10-13 20:33:38 -04:00
adnano
1c65b94f52 Update comments 2020-10-11 19:41:44 -04:00
adnano
685ed38703 Fix parsing of links without names 2020-09-29 21:27:16 -04:00
adnano
603704568c Add newlines after Gemini text lines 2020-09-29 10:16:55 -04:00
adnano
38387f3d62 Implement parsing of Gemini text responses 2020-09-29 10:13:57 -04:00