Description
This issue was originally filed by [email protected]
I was doing 'telnet localhost 8000' and the Dart HttpServer crashes on some simple mal-formed HTTP:
GET /
and got:
Unhandled exception:
HttpParserException: Invalid request URI
0. Function: '[email protected]' url: 'dart:io' line:510 col:388
1. Function: '_HttpConnection@19ffb8b9._onConnectionClosed@19ffb8b9' url: 'dart:io' line:497 col:133
2. Function: '_HttpConnectionBase@19ffb8b9._onError@19ffb8b9' url: 'dart:io' line:487 col:237
3. Function: '[email protected]' url: 'dart:io' line:497 col:1
4. Function: '[email protected]' url: 'dart:io' line:673 col:22
5. Function: '_HttpConnectionBase@19ffb8b9._onData@19ffb8b9' url: 'dart:io' line:486 col:71
6. Function: '_SocketBase@19ffb8b9._multiplex@19ffb8b9' url: 'dart:io' line:926 col:1
7. Function: '[email protected]' url: 'dart:io' line:942 col:142
8. Function: '_ReceivePortImpl@38422f21._handleMessage@38422f21' url: 'dart:isolate' line:19 col:46
GET / h
listening on 8000...
Unhandled exception:
HttpParserException: Failed to parse HTTP
0. Function: '[email protected]' url: 'dart:io' line:510 col:388
1. Function: '_HttpConnection@19ffb8b9._onConnectionClosed@19ffb8b9' url: 'dart:io' line:497 col:133
2. Function: '_HttpConnectionBase@19ffb8b9._onError@19ffb8b9' url: 'dart:io' line:487 col:237
3. Function: '[email protected]' url: 'dart:io' line:497 col:1
4. Function: '[email protected]' url: 'dart:io' line:673 col:22
5. Function: '_HttpConnectionBase@19ffb8b9._onData@19ffb8b9' url: 'dart:io' line:486 col:71
6. Function: '_SocketBase@19ffb8b9._multiplex@19ffb8b9' url: 'dart:io' line:926 col:1
7. Function: '[email protected]' url: 'dart:io' line:942 col:142
8. Function: '_ReceivePortImpl@38422f21._handleMessage@38422f21' url: 'dart:isolate' line:19 col:46
The Http Server should be resilient enough not to crash when it receives invalid HTTP.
If throwing these exceptions is expected behaviour how do we catch it and prevent it from taking the server down?