Fix a bug in request parsing
Handle SIGINT and SIGTERM