Fix connection issue affecting some sites

This commit is contained in:
Trevor Slocum 2021-07-10 11:28:08 -07:00
parent f933e9dd1b
commit a23ad13fd8
2 changed files with 48 additions and 39 deletions

View file

@ -1,5 +1,9 @@
1.0.4: 1.0.5:
- Add option ConvertImages (thanks to @f) - Add option ConvertImages (thanks to @f)
- Fix connection issue affecting some sites
1.0.4:
- Migrate to code.rocketnine.space
1.0.3: 1.0.3:
- Add hostname option - Add hostname option

View file

@ -22,7 +22,14 @@ var assetLock sync.Mutex
var imageExtensions = []string{"png", "jpg", "jpeg", "gif", "svg", "webp"} var imageExtensions = []string{"png", "jpg", "jpeg", "gif", "svg", "webp"}
func rewriteURL(u string, loc *url.URL) string { func rewriteURL(u string, loc *url.URL) string {
if daemonAddress != "" { if daemonAddress == "" {
return u
}
if loc.Path == "" {
loc.Path = "/"
}
scheme := "gemini" scheme := "gemini"
if strings.HasPrefix(loc.Path, "/file/") { if strings.HasPrefix(loc.Path, "/file/") {
scheme = "file" scheme = "file"
@ -59,8 +66,6 @@ func rewriteURL(u string, loc *url.URL) string {
return "http://" + daemonAddress + "/" + scheme + "/" + strings.ToLower(loc.Host) + u return "http://" + daemonAddress + "/" + scheme + "/" + strings.ToLower(loc.Host) + u
} }
return "http://" + daemonAddress + "/" + scheme + "/" + u return "http://" + daemonAddress + "/" + scheme + "/" + u
}
return u
} }
func newPage() []byte { func newPage() []byte {