]> granicus.if.org Git - pdns/commitdiff
auth/rec ws: sync caught serveConnection exceptions
authorChristian Hofstaedtler <christian.hofstaedtler@deduktiva.com>
Mon, 26 Jun 2017 13:55:47 +0000 (15:55 +0200)
committerChristian Hofstaedtler <christian@hofstaedtler.name>
Mon, 26 Jun 2017 16:11:47 +0000 (18:11 +0200)
pdns/ws-recursor.cc

index e45d65e6bb5872064bc63c558725e0c1b04e7cba..32b4657b50cd7e5cb31806c6482db73efaae337d 100644 (file)
@@ -560,9 +560,9 @@ void AsyncServer::newConnection()
   getMT()->makeThread(&AsyncServerNewConnectionMT, this);
 }
 
-
+// This is an entry point from FDM, so it needs to catch everything.
 void AsyncWebServer::serveConnection(Socket *client)
-{
+try {
   HttpRequest req;
   YaHTTP::AsyncRequestLoader yarl;
   yarl.initialize(&req);
@@ -595,6 +595,16 @@ void AsyncWebServer::serveConnection(Socket *client)
     L<<Logger::Error<<"Failed sending reply to HTTP client"<<endl;
   }
 }
+catch(PDNSException &e) {
+  L<<Logger::Error<<"HTTP Exception: "<<e.reason<<endl;
+}
+catch(std::exception &e) {
+  if(strstr(e.what(), "timeout")==0)
+    L<<Logger::Error<<"HTTP STL Exception: "<<e.what()<<endl;
+}
+catch(...) {
+  L<<Logger::Error<<"HTTP: Unknown exception"<<endl;
+}
 
 void AsyncWebServer::go() {
   if (!d_server)