Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b0f27c6f74 | ||
|
|
8c0af18617 | ||
|
|
353416685a | ||
|
|
0ceec22705 |
@@ -6,7 +6,7 @@ Package gemini implements the [Gemini protocol](https://gemini.circumlunar.space
|
||||
in Go. It provides an API similar to that of net/http to facilitate the
|
||||
development of Gemini clients and servers.
|
||||
|
||||
Compatible with version v0.14.3 of the Gemini specification.
|
||||
Compatible with version v0.16.0 of the Gemini specification.
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
6
doc.go
6
doc.go
@@ -30,7 +30,7 @@ Servers should be configured with certificates:
|
||||
server.GetCertificate = certificates.Get
|
||||
|
||||
Mux is a Gemini request multiplexer.
|
||||
Mux can handle requests for multiple hosts and schemes.
|
||||
Mux can handle requests for multiple hosts and paths.
|
||||
|
||||
mux := &gemini.Mux{}
|
||||
mux.HandleFunc("example.com", func(ctx context.Context, w gemini.ResponseWriter, r *gemini.Request) {
|
||||
@@ -39,8 +39,8 @@ Mux can handle requests for multiple hosts and schemes.
|
||||
mux.HandleFunc("example.org/about.gmi", func(ctx context.Context, w gemini.ResponseWriter, r *gemini.Request) {
|
||||
fmt.Fprint(w, "About example.org")
|
||||
})
|
||||
mux.HandleFunc("http://example.net", func(ctx context.Context, w gemini.ResponseWriter, r *gemini.Request) {
|
||||
fmt.Fprint(w, "Proxied content from http://example.net")
|
||||
mux.HandleFunc("/images/", func(ctx context.Context, w gemini.ResponseWriter, r *gemini.Request) {
|
||||
w.WriteHeader(gemini.StatusGone, "Gone forever")
|
||||
})
|
||||
server.Handler = mux
|
||||
|
||||
|
||||
2
fs.go
2
fs.go
@@ -169,7 +169,7 @@ func dirList(w ResponseWriter, f fs.File) {
|
||||
}
|
||||
link := LineLink{
|
||||
Name: name,
|
||||
URL: (&url.URL{Path: name}).EscapedPath(),
|
||||
URL: "./" + url.PathEscape(name),
|
||||
}
|
||||
fmt.Fprintln(w, link.String())
|
||||
}
|
||||
|
||||
4
text.go
4
text.go
@@ -125,8 +125,8 @@ func ParseLines(r io.Reader, handler func(Line)) error {
|
||||
name = strings.TrimLeft(name, spacetab)
|
||||
line = LineLink{url, name}
|
||||
}
|
||||
} else if strings.HasPrefix(text, "*") {
|
||||
text = text[1:]
|
||||
} else if strings.HasPrefix(text, "* ") {
|
||||
text = text[2:]
|
||||
text = strings.TrimLeft(text, spacetab)
|
||||
line = LineListItem(text)
|
||||
} else if strings.HasPrefix(text, "###") {
|
||||
|
||||
Reference in New Issue
Block a user