Ethernet web server unreachable after some time

Thnx for the lines of code and the explanation. So I have tried today to implement it your way. Because you are right, i only have to act on the GET / HTTP1.1 line. But the working wasn't any different as to what it did before. And it made it way much harder to only show the page once instead of all the time a new line came in.

Back to the request I get. It is either GET / or GET /?. If the page is first being visited i receive the GET / HTTP1.1. And if the button on the site is pressed, I get the GET /? HTTP1.1. The rest of the lines like the Host:, User-Agent, etc, are not needed. But I get them anyway. Because if I close the connection before receiving the other lines, the browser thinks the lines are not received and retries to sent the request multiple times. Leading to unwanted behavior by my code.

So based on your last message and the other one before. I got the sense that my program could be running out of memory. And so I did some digging on the web to see what and how the memory of the Arduino works. And I found this test to see if the SRAM is running out but it stays the same after each visit. So that would suggest that I am not running out of RAM. And won't need to read every line separately.