http_server: avoid race conditions on SIGQUIT