This commit is contained in:
themighty1
2022-03-29 21:10:10 +03:00
parent 051112bcbf
commit 6b7504bbf1
2 changed files with 8 additions and 0 deletions

View File

@@ -120,6 +120,12 @@ func setBlob(w http.ResponseWriter, req *http.Request) {
writeResponse(out, w) writeResponse(out, w)
} }
// ping is sent to check if notary is available
func ping(w http.ResponseWriter, req *http.Request) {
log.Println("in ping", req.RemoteAddr)
writeResponse(nil, w)
}
// when notary starts we expect the admin to upload a URLFetcher document // when notary starts we expect the admin to upload a URLFetcher document
// it can be uploaded e.g. with: // it can be uploaded e.g. with:
// curl --data-binary '@URLFetcherDoc' 127.0.0.1:10012/setURLFetcherDoc // curl --data-binary '@URLFetcherDoc' 127.0.0.1:10012/setURLFetcherDoc
@@ -200,6 +206,7 @@ func main() {
http.HandleFunc("/getBlob", getBlob) http.HandleFunc("/getBlob", getBlob)
http.HandleFunc("/setBlob", setBlob) http.HandleFunc("/setBlob", setBlob)
http.HandleFunc("/ping", ping)
// all the other request will end up in the httpHandler // all the other request will end up in the httpHandler
http.HandleFunc("/", httpHandler) http.HandleFunc("/", httpHandler)

View File

@@ -142,6 +142,7 @@ func (sm *SessionManager) removeSession(key string) {
s, ok := sm.sessions[key] s, ok := sm.sessions[key]
if !ok { if !ok {
log.Println("Cannot remove: session does not exist ", key) log.Println("Cannot remove: session does not exist ", key)
return
} }
err := os.RemoveAll(s.session.StorageDir) err := os.RemoveAll(s.session.StorageDir)
if err != nil { if err != nil {