directory listings are now properly URL encoded
This commit is contained in:
parent
cfd26f4b23
commit
f1d01ae465
@ -107,7 +107,7 @@ func generateDirectory(path string) Response {
|
|||||||
//Found an index file, return that instead
|
//Found an index file, return that instead
|
||||||
return generateFile(path + file.Name())
|
return generateFile(path + file.Name())
|
||||||
} else {
|
} else {
|
||||||
dirpage += fmt.Sprintf("=> %s %s\r\n", file.Name(), file.Name())
|
dirpage += fmt.Sprintf("=> %s %s\r\n", url.PathEscape(file.Name()), file.Name())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Response{STATUS_SUCCESS, "text/gemini", dirpage}
|
return Response{STATUS_SUCCESS, "text/gemini", dirpage}
|
||||||
|
@ -189,7 +189,11 @@ func (s *Server) ParseRequest(req string, c *conn) Response {
|
|||||||
|
|
||||||
//now check cert stuff
|
//now check cert stuff
|
||||||
capsule := s.HostnameToConfig[u.Hostname()]
|
capsule := s.HostnameToConfig[u.Hostname()]
|
||||||
selector := capsule.RootDir + u.Path
|
unescaped_path, err := url.PathUnescape(u.Path)
|
||||||
|
if err != nil {
|
||||||
|
return Response{STATUS_BAD_REQUEST, "URL invalid", ""}
|
||||||
|
}
|
||||||
|
selector := capsule.RootDir + unescaped_path
|
||||||
for _, idpath := range capsule.AccessControl.Identified {
|
for _, idpath := range capsule.AccessControl.Identified {
|
||||||
if strings.Contains(selector, capsule.RootDir+idpath) && c.Cert == nil {
|
if strings.Contains(selector, capsule.RootDir+idpath) && c.Cert == nil {
|
||||||
return Response{STATUS_CLIENT_CERTIFICATE_REQUIRED, "Please provide a client certificate", ""}
|
return Response{STATUS_CLIENT_CERTIFICATE_REQUIRED, "Please provide a client certificate", ""}
|
||||||
|
Loading…
Reference in New Issue
Block a user