[ARVADOS] updated: 1.2.0-150-g77ee37c56
Git user
git at public.curoverse.com
Tue Oct 9 11:37:07 EDT 2018
Summary of changes:
services/keepstore/proxy_remote.go | 31 ++++++++++++++++++++-----------
1 file changed, 20 insertions(+), 11 deletions(-)
via 77ee37c567ba73a0c33455ecf8d5c8200cf69d72 (commit)
via 13fc31b65d1fa7e737d0e3ce345b3d556d14af16 (commit)
via 3b2f0608f7db14524c6afd4a7608e09de8973f96 (commit)
from 005951a5e62a55894eace6e8fb3fe91d5c4ba84c (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 77ee37c567ba73a0c33455ecf8d5c8200cf69d72
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date: Tue Oct 9 11:36:52 2018 -0400
14199: Abandon processing sooner if client disconnects.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>
diff --git a/services/keepstore/proxy_remote.go b/services/keepstore/proxy_remote.go
index 66bfce16e..7dea2b665 100644
--- a/services/keepstore/proxy_remote.go
+++ b/services/keepstore/proxy_remote.go
@@ -174,6 +174,11 @@ func (rrc *remoteResponseCacher) Close() error {
return nil
}
_, err := PutBlock(rrc.Context, rrc.Buffer, rrc.Locator[:32])
+ if rrc.Context.Err() != nil {
+ // If caller hung up, log that instead of subsequent/misleading errors.
+ http.Error(rrc.ResponseWriter, rrc.Context.Err().Error(), http.StatusGatewayTimeout)
+ return err
+ }
if err == RequestHashError {
http.Error(rrc.ResponseWriter, "checksum mismatch in remote response", http.StatusBadGateway)
return err
commit 13fc31b65d1fa7e737d0e3ce345b3d556d14af16
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date: Tue Oct 9 11:24:44 2018 -0400
14199: Rename (*remoteResponseCacher)Flush -> Close.
Finalizing the caching writer is more like Close: it can only happen
once, and only after all Writes are done. Flush means something
different, especially in http.ResponseWriter context.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>
diff --git a/services/keepstore/proxy_remote.go b/services/keepstore/proxy_remote.go
index 4b5c1cc7e..66bfce16e 100644
--- a/services/keepstore/proxy_remote.go
+++ b/services/keepstore/proxy_remote.go
@@ -48,8 +48,9 @@ func (rp *remoteProxy) Get(ctx context.Context, w http.ResponseWriter, r *http.R
Token: token,
Buffer: buf[:0],
ResponseWriter: w,
+ Context: ctx,
}
- defer rrc.Flush(ctx)
+ defer rrc.Close()
w = rrc
}
var remoteClient *keepclient.KeepClient
@@ -147,6 +148,7 @@ type remoteResponseCacher struct {
Locator string
Token string
Buffer []byte
+ Context context.Context
http.ResponseWriter
statusCode int
}
@@ -163,35 +165,37 @@ func (rrc *remoteResponseCacher) WriteHeader(statusCode int) {
rrc.statusCode = statusCode
}
-func (rrc *remoteResponseCacher) Flush(ctx context.Context) {
+func (rrc *remoteResponseCacher) Close() error {
if rrc.statusCode == 0 {
rrc.statusCode = http.StatusOK
} else if rrc.statusCode != http.StatusOK {
rrc.ResponseWriter.WriteHeader(rrc.statusCode)
rrc.ResponseWriter.Write(rrc.Buffer)
- return
+ return nil
}
- _, err := PutBlock(ctx, rrc.Buffer, rrc.Locator[:32])
+ _, err := PutBlock(rrc.Context, rrc.Buffer, rrc.Locator[:32])
if err == RequestHashError {
http.Error(rrc.ResponseWriter, "checksum mismatch in remote response", http.StatusBadGateway)
- return
+ return err
}
if err, ok := err.(*KeepError); ok {
http.Error(rrc.ResponseWriter, err.Error(), err.HTTPCode)
- return
+ return err
}
if err != nil {
http.Error(rrc.ResponseWriter, err.Error(), http.StatusBadGateway)
- return
+ return err
}
unsigned := localOrRemoteSignature.ReplaceAllLiteralString(rrc.Locator, "")
signed := SignLocator(unsigned, rrc.Token, time.Now().Add(theConfig.BlobSignatureTTL.Duration()))
if signed == unsigned {
- http.Error(rrc.ResponseWriter, "could not sign locator", http.StatusInternalServerError)
- return
+ err = errors.New("could not sign locator")
+ http.Error(rrc.ResponseWriter, err.Error(), http.StatusInternalServerError)
+ return err
}
rrc.Header().Set("X-Keep-Locator", signed)
rrc.ResponseWriter.WriteHeader(rrc.statusCode)
- rrc.ResponseWriter.Write(rrc.Buffer)
+ _, err = rrc.ResponseWriter.Write(rrc.Buffer)
+ return err
}
commit 3b2f0608f7db14524c6afd4a7608e09de8973f96
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date: Tue Oct 9 11:19:16 2018 -0400
14199: Require "X-Keep-Signature: local[, ...]" to invoke signing.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>
diff --git a/services/keepstore/proxy_remote.go b/services/keepstore/proxy_remote.go
index 9f4a8ef1a..4b5c1cc7e 100644
--- a/services/keepstore/proxy_remote.go
+++ b/services/keepstore/proxy_remote.go
@@ -36,7 +36,7 @@ func (rp *remoteProxy) Get(ctx context.Context, w http.ResponseWriter, r *http.R
http.Error(w, "no token provided in Authorization header", http.StatusUnauthorized)
return
}
- if sign := r.Header.Get("X-Keep-Signature"); sign != "" {
+ if strings.SplitN(r.Header.Get("X-Keep-Signature"), ",", 2)[0] == "local" {
buf, err := getBufferWithContext(ctx, bufs, BlockSize)
if err != nil {
http.Error(w, err.Error(), http.StatusServiceUnavailable)
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list