Location and "up" Link for Challenge

This commit is contained in:
Jakub Warmuz 2015-04-30 19:05:02 +00:00
parent 7d98856ad7
commit 37f430d80f
No known key found for this signature in database
GPG Key ID: 2A7BAD3A489B52EA
1 changed files with 6 additions and 0 deletions

View File

@ -351,7 +351,13 @@ func (wfe *WebFrontEndImpl) Challenge(authz core.Authorization, response http.Re
wfe.sendError(response, "Failed to marshal challenge", http.StatusInternalServerError)
return
}
authzURL := wfe.AuthzBase + string(authz.ID)
challengeURL := authzURL + "?challenge=" + strconv.Itoa(challengeIndex)
response.Header().Add("Location", challengeURL)
response.Header().Set("Content-Type", "application/json")
response.Header().Add("Link", link(wfe.authzURL, "up"))
response.WriteHeader(http.StatusAccepted)
if _, err = response.Write(jsonReply); err != nil {
wfe.log.Warning(fmt.Sprintf("Could not write response: %s", err))