progress
This commit is contained in:
9
main.go
9
main.go
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user