Send HTTP code depending on authorization received (for real ;))

This commit is contained in:
Chteufleur 2016-06-20 20:10:34 +02:00
parent df795bf0ce
commit 5d61cf33cf
1 changed files with 6 additions and 2 deletions

View File

@ -57,8 +57,12 @@ func authHandler(w http.ResponseWriter, r *http.Request) {
ChanRequest <- chanAnswer
select {
case answer = <-chanAnswer:
w.WriteHeader(http.StatusOK)
case answer := <-chanAnswer:
if answer {
w.WriteHeader(http.StatusOK)
} else {
w.WriteHeader(http.StatusForbidden)
}
case <-time.After(time.Duration(TimeoutSec) * time.Second):
w.WriteHeader(http.StatusForbidden)
delete(xmpp.WaitMessageAnswers, transaction)