[ARVADOS] updated: baa1c3db1f635828dda3cebdc47d98b33bb6518d

Git user git at public.curoverse.com
Thu Apr 27 15:29:40 EDT 2017


Summary of changes:
 services/keepproxy/keepproxy.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

  discards  f7c0c2137ea1035fe46d77e604bb936ba407ddb7 (commit)
       via  baa1c3db1f635828dda3cebdc47d98b33bb6518d (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (f7c0c2137ea1035fe46d77e604bb936ba407ddb7)
            \
             N -- N -- N (baa1c3db1f635828dda3cebdc47d98b33bb6518d)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

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 baa1c3db1f635828dda3cebdc47d98b33bb6518d
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Apr 27 15:24:41 2017 -0400

    11537: Add Via header to get/head/post/put responses.

diff --git a/services/keepproxy/keepproxy.go b/services/keepproxy/keepproxy.go
index 7a673ae..65f7a42 100644
--- a/services/keepproxy/keepproxy.go
+++ b/services/keepproxy/keepproxy.go
@@ -320,6 +320,7 @@ func (h *proxyHandler) Get(resp http.ResponseWriter, req *http.Request) {
 		return
 	}
 	SetCorsHeaders(resp)
+	resp.Header().Set("Via", req.Proto+" "+viaAlias)
 
 	locator := mux.Vars(req)["locator"]
 	var err error
@@ -404,6 +405,7 @@ func (h *proxyHandler) Put(resp http.ResponseWriter, req *http.Request) {
 		return
 	}
 	SetCorsHeaders(resp)
+	resp.Header().Set("Via", "HTTP/1.1 "+viaAlias)
 
 	kc := *h.KeepClient
 	kc.Client = &proxyClient{client: kc.Client, proto: req.Proto}
diff --git a/services/keepproxy/keepproxy_test.go b/services/keepproxy/keepproxy_test.go
index e4ba22a..4e85626 100644
--- a/services/keepproxy/keepproxy_test.go
+++ b/services/keepproxy/keepproxy_test.go
@@ -113,6 +113,31 @@ func runProxy(c *C, args []string, bogusClientToken bool) *keepclient.KeepClient
 	return kc
 }
 
+func (s *ServerRequiredSuite) TestResponseViaHeader(c *C) {
+	runProxy(c, nil, false)
+	defer closeListener()
+
+	req, err := http.NewRequest("POST",
+		"http://"+listener.Addr().String()+"/",
+		strings.NewReader("TestViaHeader"))
+	req.Header.Add("Authorization", "OAuth2 "+arvadostest.ActiveToken)
+	resp, err := (&http.Client{}).Do(req)
+	c.Assert(err, Equals, nil)
+	c.Check(resp.Header.Get("Via"), Equals, "HTTP/1.1 keepproxy")
+	locator, err := ioutil.ReadAll(resp.Body)
+	c.Assert(err, Equals, nil)
+	resp.Body.Close()
+
+	req, err = http.NewRequest("GET",
+		"http://"+listener.Addr().String()+"/"+string(locator),
+		nil)
+	c.Assert(err, Equals, nil)
+	resp, err = (&http.Client{}).Do(req)
+	c.Assert(err, Equals, nil)
+	c.Check(resp.Header.Get("Via"), Equals, "HTTP/1.1 keepproxy")
+	resp.Body.Close()
+}
+
 func (s *ServerRequiredSuite) TestLoopDetection(c *C) {
 	kc := runProxy(c, nil, false)
 	defer closeListener()
@@ -178,7 +203,7 @@ func (s *ServerRequiredSuite) TestPutWrongContentLength(c *C) {
 			bytes.NewReader(content))
 		c.Assert(err, IsNil)
 		req.Header.Set("Content-Length", t.sendLength)
-		req.Header.Set("Authorization", "OAuth2 4axaw8zxe0qm22wa6urpp5nskcne8z88cvbupv653y1njyi05h")
+		req.Header.Set("Authorization", "OAuth2 "+arvadostest.ActiveToken)
 		req.Header.Set("Content-Type", "application/octet-stream")
 
 		resp := httptest.NewRecorder()
@@ -392,7 +417,7 @@ func (s *ServerRequiredSuite) TestPostWithoutHash(c *C) {
 		req, err := http.NewRequest("POST",
 			"http://"+listener.Addr().String()+"/",
 			strings.NewReader("qux"))
-		req.Header.Add("Authorization", "OAuth2 4axaw8zxe0qm22wa6urpp5nskcne8z88cvbupv653y1njyi05h")
+		req.Header.Add("Authorization", "OAuth2 "+arvadostest.ActiveToken)
 		req.Header.Add("Content-Type", "application/octet-stream")
 		resp, err := client.Do(req)
 		c.Check(err, Equals, nil)

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list