returnHash := fmt.Sprintf("%s+%d", hash, req.ContentLength)
apiToken := GetApiToken(req)
if PermissionSecret != nil && apiToken != "" {
- expiry := time.Now().Add(blob_signature_ttl)
+ expiry := time.Now().Add(blobSignatureTTL)
returnHash = SignLocator(returnHash, apiToken, expiry)
}
resp.Write([]byte(returnHash + "\n"))
return
}
- if never_delete {
+ if neverDelete {
http.Error(resp, MethodDisabledError.Error(), MethodDisabledError.HTTPCode)
return
}
var authRe = regexp.MustCompile(`^OAuth2\s+(.*)`)
-// GetAPIToken returns the OAuth2 token from the Authorization
+// GetApiToken returns the OAuth2 token from the Authorization
// header of a HTTP request, or an empty string if no matching
// token is found.
func GetApiToken(req *http.Request) string {
// IsDataManagerToken returns true if apiToken represents the data
// manager's token.
func IsDataManagerToken(apiToken string) bool {
- return data_manager_token != "" && apiToken == data_manager_token
+ return dataManagerToken != "" && apiToken == dataManagerToken
}