swisspol/GCDWebServer

Sending "junk" causes the web server to abort

Closed this issue · 1 comments

boisy commented

I have an application that uses GCDWebServer to serve up data. I've noticed occasional crashing and was experimenting by telnetting to the application's server port.

If I telnet to the app hosting the GCDWebServer, and just type:
GET / HTTP/1.1

I get the expected HTML that is served up.

However, if I type any random characters, press , and THEN the above, the GCDWebServer aborts in the _readRequestHeaders method (line 351 in GCDWebServerConnection.m). There's a macro GWS_DNOT_REACHED() which is triggered if certain variables are nil.

I'm not sure what the code answer would be, but I do expect the server to be more robust in handling random/junk data sent via the connection and simply call a macro which ends up calling abort().

That macro only aborts when building DEBUG. It’s expected behavior to catch unexpected problems,