Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: tarpit() filter #2760

Merged
merged 1 commit into from
Dec 6, 2023
Merged

feature: tarpit() filter #2760

merged 1 commit into from
Dec 6, 2023

Conversation

szuecs
Copy link
Member

@szuecs szuecs commented Nov 30, 2023

feature: tarpit() filter to let connection to the client open until it closes the connection

@szuecs szuecs force-pushed the feature/tarpit branch 2 times, most recently from 97846cb to 77800f2 Compare November 30, 2023 21:27
@AlexanderYastrebov
Copy link
Member

AlexanderYastrebov commented Dec 1, 2023

I think this is equivalent in behavior with

$ bin/skipper -inline-routes='* -> chunks(1, "1s") -> dropResponseHeader("Content-Length") -> repeatContent("X", 1000000000) -> status(200) -> <shunt>'
...
~$ nc localhost 9090
GET / HTTP/1.1        
Host: localhost:9090

HTTP/1.1 200 OK
Server: Skipper
Date: Fri, 01 Dec 2023 09:32:40 GMT
Transfer-Encoding: chunked

1
X
1
X
1
X
1
X
1
X
1
X
1
X
1
X
^C

-- it responds with Transfer-Encoding: chunked and sends chunks of 1 byte.

If we do not drop Content-Length then it just slowly sends response:

$ bin/skipper -inline-routes='* -> chunks(1, "1s") -> repeatContent("X", 10000) -> status(200) -> <shunt>'
...
~$ nc localhost 9090
GET / HTTP/1.1 
Host: localhost:9090

HTTP/1.1 200 OK
Content-Length: 10000
Server: Skipper
Date: Fri, 01 Dec 2023 09:33:42 GMT

XXXXXX^C

If we want to have second behavior for tarpit then we need to tell content length:

$ bin/skipper -inline-routes='* -> setResponseHeader("Content-Length", "10000") -> tarpit("1s") -> <shunt>
...
~$ nc localhost 9090
GET / HTTP/1.1
Host: localhost:9090

HTTP/1.1 200 OK
Content-Length: 10000
Server: Skipper
Date: Fri, 01 Dec 2023 09:35:19 GMT

   ^C

@szuecs szuecs added the minor no risk changes, for example new filters label Dec 4, 2023
@szuecs
Copy link
Member Author

szuecs commented Dec 5, 2023

👍

1 similar comment
@AlexanderYastrebov
Copy link
Member

👍

@szuecs szuecs merged commit 6f1419f into master Dec 6, 2023
6 checks passed
@szuecs szuecs deleted the feature/tarpit branch December 6, 2023 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor no risk changes, for example new filters
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants