mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-06 19:28:29 +00:00
Remove slowloris handling from Redbean (#737)
It's been superseded by token bucket processing, does not take time into considerations (only the number of fragments), and affects file uploads that may require a large number of reads.
This commit is contained in:
parent
08fef9b277
commit
e323527ffa
1 changed files with 2 additions and 16 deletions
|
@ -5651,12 +5651,6 @@ static char *HandleHugePayload(void) {
|
||||||
return ServeFailure(413, "Payload Too Large");
|
return ServeFailure(413, "Payload Too Large");
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *HandlePayloadSlowloris(void) {
|
|
||||||
LockInc(&shared->c.slowloris);
|
|
||||||
LogClose("payload slowloris");
|
|
||||||
return ServeFailure(408, "Request Timeout");
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *HandleTransferRefused(void) {
|
static char *HandleTransferRefused(void) {
|
||||||
LockInc(&shared->c.transfersrefused);
|
LockInc(&shared->c.transfersrefused);
|
||||||
return ServeFailure(501, "Not Implemented");
|
return ServeFailure(501, "Not Implemented");
|
||||||
|
@ -5715,15 +5709,8 @@ static void HandleForkFailure(void) {
|
||||||
|
|
||||||
static void HandleFrag(size_t got) {
|
static void HandleFrag(size_t got) {
|
||||||
LockInc(&shared->c.frags);
|
LockInc(&shared->c.frags);
|
||||||
if (++cpm.frags == 32) {
|
DEBUGF("(stat) %s fragged msg added %,ld bytes to %,ld byte buffer",
|
||||||
SendTimeout();
|
DescribeClient(), amtread, got);
|
||||||
LogClose("slowloris");
|
|
||||||
LockInc(&shared->c.slowloris);
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
DEBUGF("(stat) %s fragged msg added %,ld bytes to %,ld byte buffer",
|
|
||||||
DescribeClient(), amtread, got);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void HandleReload(void) {
|
static void HandleReload(void) {
|
||||||
|
@ -5823,7 +5810,6 @@ static char *ReadMore(void) {
|
||||||
size_t got;
|
size_t got;
|
||||||
ssize_t rc;
|
ssize_t rc;
|
||||||
LockInc(&shared->c.frags);
|
LockInc(&shared->c.frags);
|
||||||
if (++cpm.frags == 64) return HandlePayloadSlowloris();
|
|
||||||
if ((rc = reader(client, inbuf.p + amtread, inbuf.n - amtread)) != -1) {
|
if ((rc = reader(client, inbuf.p + amtread, inbuf.n - amtread)) != -1) {
|
||||||
if (!(got = rc)) return HandlePayloadDisconnect();
|
if (!(got = rc)) return HandlePayloadDisconnect();
|
||||||
amtread += got;
|
amtread += got;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue