Send HTTP code depending on authorization received (for real ;))
This commit is contained in:
parent
df795bf0ce
commit
5d61cf33cf
|
|
@ -57,8 +57,12 @@ func authHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
ChanRequest <- chanAnswer
|
ChanRequest <- chanAnswer
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case answer = <-chanAnswer:
|
case answer := <-chanAnswer:
|
||||||
w.WriteHeader(http.StatusOK)
|
if answer {
|
||||||
|
w.WriteHeader(http.StatusOK)
|
||||||
|
} else {
|
||||||
|
w.WriteHeader(http.StatusForbidden)
|
||||||
|
}
|
||||||
case <-time.After(time.Duration(TimeoutSec) * time.Second):
|
case <-time.After(time.Duration(TimeoutSec) * time.Second):
|
||||||
w.WriteHeader(http.StatusForbidden)
|
w.WriteHeader(http.StatusForbidden)
|
||||||
delete(xmpp.WaitMessageAnswers, transaction)
|
delete(xmpp.WaitMessageAnswers, transaction)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue