mirror of
https://github.com/3proxy/3proxy.git
synced 2026-11-16 06:05:50 +08:00
httpsrv: a limit exceeded answered with 503, not ignored
Authorization reports 10 when a limit of the service was exceeded,
which every other child answers with 503; the http server took it as
success and answered the request anyway. It now says 503 for itself,
after the body of the request is drained as any answer here does.
(cherry picked from commit 5a2e9d27c3)
This commit is contained in:
parent
c687380776
commit
3040de2b55
@ -1463,16 +1463,27 @@ static int httpsrv_request(struct clientparam *param, struct httpreq *r)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(i && i != 10){
|
if(i){
|
||||||
/* The body goes before the answer, as for any answer this server
|
/* The body goes before the answer, as for any answer this server
|
||||||
gives: left in the stream it would be read as the next request. */
|
gives: left in the stream it would be read as the next request. */
|
||||||
if(!r->drained){
|
if(!r->drained){
|
||||||
if(r->contentlen) httpsrv_drain(param, r->contentlen);
|
if(r->contentlen) httpsrv_drain(param, r->contentlen);
|
||||||
r->drained = 1;
|
r->drained = 1;
|
||||||
}
|
}
|
||||||
|
/* 10: a limit of the service was exceeded, which the other
|
||||||
|
services answer with 503. */
|
||||||
|
if(i == 10){
|
||||||
|
static const char body[] = "exceeded your limits\n";
|
||||||
|
|
||||||
|
r->hdrs = NULL;
|
||||||
|
r->maxage = -1;
|
||||||
|
r->keepalive = 0;
|
||||||
|
if(httpsrv_head(r, 503, "text/plain", (int64_t)sizeof(body) - 1, NULL)) return 1;
|
||||||
|
httpsrv_send(r, body, (int)sizeof(body) - 1);
|
||||||
|
}
|
||||||
/* 4 no credentials, 5 unknown user, 6 wrong password: all of them
|
/* 4 no credentials, 5 unknown user, 6 wrong password: all of them
|
||||||
should let the client offer credentials again. */
|
should let the client offer credentials again. */
|
||||||
if(i >= 4 && i <= 6) op_authrequired(r);
|
else if(i >= 4 && i <= 6) op_authrequired(r);
|
||||||
else op_forbidden(r);
|
else op_forbidden(r);
|
||||||
RETURN(i);
|
RETURN(i);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user