diff Core/HttpServer/MongooseServer.cpp @ 1430:ad94a3583b07

Plugins can send answers as multipart messages
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 29 Jun 2015 17:47:34 +0200
parents feaf2840917c
children af112b7d9cba
line wrap: on
line diff
--- a/Core/HttpServer/MongooseServer.cpp	Mon Jun 29 14:43:08 2015 +0200
+++ b/Core/HttpServer/MongooseServer.cpp	Mon Jun 29 17:47:34 2015 +0200
@@ -82,7 +82,12 @@
       {
         if (length > 0)
         {
-          mg_write(connection_, buffer, length);
+          int status = mg_write(connection_, buffer, length);
+          if (status != static_cast<int>(length))
+          {
+            // status == 0 when the connection has been closed, -1 on error
+            throw OrthancException(ErrorCode_NetworkProtocol);
+          }
         }
       }