This commit is contained in:
Lennart J. Kurzweg (Nx2)
2026-03-22 18:48:45 +01:00
parent 41e36a4545
commit 1d99749f72
12 changed files with 567 additions and 216 deletions

View File

@@ -34,7 +34,7 @@ func main() {
return
}
// Verify user against database (bcrypt)
// Verify via Database (bcrypt)
valid, err := be.VerifyUser(r.Context(), user, password)
if err != nil {
log.Printf("auth error for %s: %v", user, err)
@@ -43,11 +43,12 @@ func main() {
}
if !valid {
log.Printf("auth failed for %s", user)
http.Error(w, "Unauthorized", http.StatusUnauthorized)
return
}
log.Printf("%s %s %s", user, r.Method, r.URL.Path)
log.Printf("%s %s (user: %s)", r.Method, r.URL.Path, user)
principalPath := fmt.Sprintf("/%s/", user)
ctx := context.WithValue(r.Context(), "principal", principalPath)
@@ -63,8 +64,8 @@ func main() {
fmt.Printf("Starting CalDAV server on %s...\n", cfg.Server.BindAddress)
server := &http.Server{
Addr: cfg.Server.BindAddress,
ReadTimeout: 5 * time.Second,
WriteTimeout: 10 * time.Second,
ReadTimeout: 30 * time.Second,
WriteTimeout: 30 * time.Second,
}
if err := server.ListenAndServe(); err != nil {
log.Fatalf("server failed: %v", err)