Send error code 401 on timeout

This commit is contained in:
Chteufleur 2016-07-18 22:22:40 +02:00
parent 283946aa22
commit 731183c637
2 changed files with 2 additions and 3 deletions

View File

@ -52,8 +52,7 @@ GET /auth?jid=user%40host%2fresource&domain=example.org&method=POST&transaction_
This will send a request to the given JID, then return HTTP code depending on what appended. This will send a request to the given JID, then return HTTP code depending on what appended.
* 200 : User accept the request * 200 : User accept the request
* 400 : One or more mandatory parameter(s) is missing * 400 : One or more mandatory parameter(s) is missing
* 401 : User deny the request * 401 : User deny the request or timeout
* 504 : User do not provide an answer (timeout)
* 520 : Unknown error append * 520 : Unknown error append
* 523 : Server is unreachable * 523 : Server is unreachable

View File

@ -96,7 +96,7 @@ func authHandler(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(StatusUnknownError) w.WriteHeader(StatusUnknownError)
} }
case <-time.After(time.Duration(timeout) * time.Second): case <-time.After(time.Duration(timeout) * time.Second):
w.WriteHeader(http.StatusGatewayTimeout) w.WriteHeader(http.StatusUnauthorized)
delete(xmpp.WaitMessageAnswers, transaction) delete(xmpp.WaitMessageAnswers, transaction)
} }
} }