From 731183c637152c697b55ccb49bfd17bc9bf7880f Mon Sep 17 00:00:00 2001 From: Chteufleur Date: Mon, 18 Jul 2016 22:22:40 +0200 Subject: [PATCH] Send error code 401 on timeout --- README.md | 3 +-- http/http.go | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6c90da9..378a3c1 100644 --- a/README.md +++ b/README.md @@ -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. * 200 : User accept the request * 400 : One or more mandatory parameter(s) is missing - * 401 : User deny the request - * 504 : User do not provide an answer (timeout) + * 401 : User deny the request or timeout * 520 : Unknown error append * 523 : Server is unreachable diff --git a/http/http.go b/http/http.go index f77c270..f52c2be 100644 --- a/http/http.go +++ b/http/http.go @@ -96,7 +96,7 @@ func authHandler(w http.ResponseWriter, r *http.Request) { w.WriteHeader(StatusUnknownError) } case <-time.After(time.Duration(timeout) * time.Second): - w.WriteHeader(http.StatusGatewayTimeout) + w.WriteHeader(http.StatusUnauthorized) delete(xmpp.WaitMessageAnswers, transaction) } }