[ARVADOS] updated: 1.1.0-169-g2fcbfc1

Git user git at public.curoverse.com
Wed Nov 22 12:48:34 EST 2017


Summary of changes:
 services/keep-web/cadaver_test.go |  6 +++---
 services/keep-web/handler.go      | 27 +++++++++++++++------------
 2 files changed, 18 insertions(+), 15 deletions(-)

       via  2fcbfc106c807aa17d2f73ce40fe2a64ed4c5b13 (commit)
       via  907fdae023d547a5fe1b7ec6e6ad67204b617ab6 (commit)
      from  f089d5d392804f848ab498f9176dc60771e4a880 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 2fcbfc106c807aa17d2f73ce40fe2a64ed4c5b13
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date:   Wed Nov 22 12:45:08 2017 -0500

    12483: Fix cadaver tests.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>

diff --git a/services/keep-web/cadaver_test.go b/services/keep-web/cadaver_test.go
index 7c05ccc..02bdf7e 100644
--- a/services/keep-web/cadaver_test.go
+++ b/services/keep-web/cadaver_test.go
@@ -97,12 +97,12 @@ func (s *IntegrationSuite) TestWebdavWithCadaver(c *check.C) {
 		},
 		{
 			path:  writePath,
-			cmd:   "move testfile newdir0\n",
+			cmd:   "move testfile newdir0/\n",
 			match: `(?ms).*Moving .* succeeded.*`,
 		},
 		{
 			path:  writePath,
-			cmd:   "move testfile newdir0\n",
+			cmd:   "move testfile newdir0/\n",
 			match: `(?ms).*Moving .* failed.*`,
 		},
 		{
@@ -122,7 +122,7 @@ func (s *IntegrationSuite) TestWebdavWithCadaver(c *check.C) {
 		},
 		{
 			path:  writePath,
-			cmd:   "move newdir0/testfile newdir1\n",
+			cmd:   "move newdir0/testfile newdir1/\n",
 			match: `(?ms).*Moving .* succeeded.*`,
 		},
 		{

commit 907fdae023d547a5fe1b7ec6e6ad67204b617ab6
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date:   Wed Nov 22 12:32:38 2017 -0500

    12483: Fix multiple WriteHeader(). Skip updates on readonly methods.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>

diff --git a/services/keep-web/handler.go b/services/keep-web/handler.go
index a30d40d..576ecdb 100644
--- a/services/keep-web/handler.go
+++ b/services/keep-web/handler.go
@@ -6,7 +6,6 @@ package main
 
 import (
 	"encoding/json"
-	"errors"
 	"fmt"
 	"html"
 	"html/template"
@@ -101,19 +100,17 @@ func (h *handler) serveStatus(w http.ResponseWriter, r *http.Request) {
 // sends an HTTP header indicating success, updateOnSuccess first
 // calls the provided update func. If the update func fails, a 500
 // response is sent, and the status code and body sent by the handler
-// are ignored (all response writes return errors).
+// are ignored (all response writes return the update error).
 type updateOnSuccess struct {
 	httpserver.ResponseWriter
 	update     func() error
 	sentHeader bool
-	dropBody   bool
+	err        error
 }
 
-var errUpdateFailed = errors.New("update failed")
-
 func (uos *updateOnSuccess) Write(p []byte) (int, error) {
-	if uos.dropBody {
-		return 0, errUpdateFailed
+	if uos.err != nil {
+		return 0, uos.err
 	}
 	if !uos.sentHeader {
 		uos.WriteHeader(http.StatusOK)
@@ -123,19 +120,25 @@ func (uos *updateOnSuccess) Write(p []byte) (int, error) {
 
 func (uos *updateOnSuccess) WriteHeader(code int) {
 	if !uos.sentHeader {
+		uos.sentHeader = true
 		if code >= 200 && code < 400 {
-			if err := uos.update(); err != nil {
-				http.Error(uos.ResponseWriter, err.Error(), http.StatusInternalServerError)
-				uos.dropBody = true
+			if uos.err = uos.update(); uos.err != nil {
+				http.Error(uos.ResponseWriter, uos.err.Error(), http.StatusInternalServerError)
 				return
 			}
 		}
-		uos.sentHeader = true
 	}
 	uos.ResponseWriter.WriteHeader(code)
 }
 
 var (
+	writeMethod = map[string]bool{
+		"DELETE": true,
+		"MKCOL":  true,
+		"MOVE":   true,
+		"PUT":    true,
+		"RMCOL":  true,
+	}
 	webdavMethod = map[string]bool{
 		"DELETE":   true,
 		"MKCOL":    true,
@@ -407,7 +410,7 @@ func (h *handler) ServeHTTP(wOrig http.ResponseWriter, r *http.Request) {
 		return
 	}
 	if webdavMethod[r.Method] {
-		writing := !arvadosclient.PDHMatch(targetID)
+		writing := !arvadosclient.PDHMatch(targetID) && writeMethod[r.Method]
 		if writing {
 			// Save the collection only if/when all
 			// webdav->filesystem operations succeed --

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list