diff options
author | Niall Sheridan <nsheridan@gmail.com> | 2016-10-08 16:02:50 -0500 |
---|---|---|
committer | Niall Sheridan <nsheridan@gmail.com> | 2016-10-08 16:02:50 -0500 |
commit | baf7141d1dd0f99d561a2197a909c66dd389809d (patch) | |
tree | 92c176f713b0b28893344261b1e567db5e30ba79 /vendor/google.golang.org/appengine | |
parent | 696aebffe56853345d679d4d2b3051236423c6db (diff) |
Update dependencies
Diffstat (limited to 'vendor/google.golang.org/appengine')
-rw-r--r-- | vendor/google.golang.org/appengine/README.md | 4 | ||||
-rw-r--r-- | vendor/google.golang.org/appengine/internal/api.go | 28 |
2 files changed, 24 insertions, 8 deletions
diff --git a/vendor/google.golang.org/appengine/README.md b/vendor/google.golang.org/appengine/README.md index 1efd955..b6b11d9 100644 --- a/vendor/google.golang.org/appengine/README.md +++ b/vendor/google.golang.org/appengine/README.md @@ -66,6 +66,8 @@ This list summarises the differences: * `appengine.BackendHostname` and `appengine.BackendInstance` were for the deprecated backends feature. Use `appengine.ModuleHostname`and `appengine.ModuleName` instead. * Most of `appengine/file` and parts of `appengine/blobstore` are deprecated. - Use [Google Cloud Storage](https://godoc.org/google.golang.org/cloud/storage) instead. + Use [Google Cloud Storage](https://godoc.org/cloud.google.com/go/storage) if the + feature you require is not present in the new + [blobstore package](https://google.golang.org/appengine/blobstore). * `appengine/socket` is not required on App Engine flexible environment / Managed VMs. Use the standard `net` package instead. diff --git a/vendor/google.golang.org/appengine/internal/api.go b/vendor/google.golang.org/appengine/internal/api.go index ec5aa59..e9c56d4 100644 --- a/vendor/google.golang.org/appengine/internal/api.go +++ b/vendor/google.golang.org/appengine/internal/api.go @@ -60,6 +60,9 @@ var ( Dial: limitDial, }, } + + defaultTicketOnce sync.Once + defaultTicket string ) func apiURL() *url.URL { @@ -266,6 +269,19 @@ func WithContext(parent netcontext.Context, req *http.Request) netcontext.Contex return withContext(parent, c) } +func getDefaultTicket() string { + defaultTicketOnce.Do(func() { + appID := partitionlessAppID() + escAppID := strings.Replace(strings.Replace(appID, ":", "_", -1), ".", "_", -1) + majVersion := VersionID(nil) + if i := strings.Index(majVersion, "."); i > 0 { + majVersion = majVersion[:i] + } + defaultTicket = fmt.Sprintf("%s/%s.%s.%s", escAppID, ModuleName(nil), majVersion, InstanceID()) + }) + return defaultTicket +} + func BackgroundContext() netcontext.Context { ctxs.Lock() defer ctxs.Unlock() @@ -275,13 +291,7 @@ func BackgroundContext() netcontext.Context { } // Compute background security ticket. - appID := partitionlessAppID() - escAppID := strings.Replace(strings.Replace(appID, ":", "_", -1), ".", "_", -1) - majVersion := VersionID(nil) - if i := strings.Index(majVersion, "."); i > 0 { - majVersion = majVersion[:i] - } - ticket := fmt.Sprintf("%s/%s.%s.%s", escAppID, ModuleName(nil), majVersion, InstanceID()) + ticket := getDefaultTicket() ctxs.bg = &context{ req: &http.Request{ @@ -475,6 +485,10 @@ func Call(ctx netcontext.Context, service, method string, in, out proto.Message) } ticket := c.req.Header.Get(ticketHeader) + // Fall back to use background ticket when the request ticket is not available in Flex. + if ticket == "" { + ticket = getDefaultTicket() + } req := &remotepb.Request{ ServiceName: &service, Method: &method, |