Browse Source

webdav: set the Lock-Token HTTP header when LOCKing existing files, not
just new files.

Section 10.5 says the Lock-Token applies when creating a new lock, not
just when (implicitly) creating a new file.

The litmus test expects this.

Change-Id: I8746154c9baba9a90b4e9db79cadb6839fc170c7
Reviewed-on: https://go-review.googlesource.com/3567
Reviewed-by: Dave Cheney <dave@cheney.net>

Nigel Tao 11 years ago
parent
commit
2033b3a5e8
1 changed files with 4 additions and 3 deletions
  1. 4 3
      webdav/webdav.go

+ 4 - 3
webdav/webdav.go

@@ -351,10 +351,11 @@ func (h *Handler) handleLock(w http.ResponseWriter, r *http.Request) (retStatus
 			}
 			f.Close()
 			w.WriteHeader(http.StatusCreated)
-			// http://www.webdav.org/specs/rfc4918.html#HEADER_Lock-Token says that the
-			// Lock-Token value is a Coded-URL. We add angle brackets.
-			w.Header().Set("Lock-Token", "<"+token+">")
 		}
+
+		// http://www.webdav.org/specs/rfc4918.html#HEADER_Lock-Token says that the
+		// Lock-Token value is a Coded-URL. We add angle brackets.
+		w.Header().Set("Lock-Token", "<"+token+">")
 	}
 
 	w.Header().Set("Content-Type", "application/xml; charset=utf-8")