gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r30125 - libmicrohttpd/src/spdy2http


From: gnunet
Subject: [GNUnet-SVN] r30125 - libmicrohttpd/src/spdy2http
Date: Thu, 10 Oct 2013 23:50:28 +0200

Author: andreyu
Date: 2013-10-10 23:50:28 +0200 (Thu, 10 Oct 2013)
New Revision: 30125

Modified:
   libmicrohttpd/src/spdy2http/proxy.c
Log:
spdy2http: send Bad Gateway when curl encounters network problem

Modified: libmicrohttpd/src/spdy2http/proxy.c
===================================================================
--- libmicrohttpd/src/spdy2http/proxy.c 2013-10-10 20:36:11 UTC (rev 30124)
+++ libmicrohttpd/src/spdy2http/proxy.c 2013-10-10 21:50:28 UTC (rev 30125)
@@ -1173,7 +1173,7 @@
         else
         {
           PRINT_VERBOSE2("bad curl result (%i) for '%s'", msg->data.result, 
proxy->url);
-          if(proxy->spdy_done || proxy->spdy_error || NULL == proxy->response)
+          if(proxy->spdy_done || proxy->spdy_error || (NULL == proxy->response 
&& !*(proxy->session_alive)))
           {
             PRINT_VERBOSE("cleaning");
             SPDY_name_value_destroy(proxy->headers);
@@ -1181,32 +1181,37 @@
             SPDY_destroy_response(proxy->response);
             cleanup(proxy);
           }
-          else
+          else if(NULL == proxy->response && *(proxy->session_alive))
           {
-            proxy->curl_error = true;
-          }
-          /*if(NULL == proxy->response)
-          {
+            //generate error for the client
+            PRINT_VERBOSE("will send Bad Gateway");
             SPDY_name_value_destroy(proxy->headers);
-            *//*if(!*(proxy->session_alive))
+            proxy->headers = NULL;
+            if(NULL == (proxy->response = 
SPDY_build_response(SPDY_HTTP_BAD_GATEWAY,
+                  NULL,
+                  SPDY_HTTP_VERSION_1_1,
+                  NULL,
+                  ERROR_RESPONSE,
+                  strlen(ERROR_RESPONSE))))
+              DIE("no response");
+            if(SPDY_YES != SPDY_queue_response(proxy->request,
+                      proxy->response,
+                      true,
+                      false,
+                      &response_done_callback,
+                      proxy))
             {
-              free(proxy->http_body);
-              proxy->http_body = NULL;
-*//*
+              //clean and forget
+              PRINT_VERBOSE("cleaning");
               SPDY_destroy_request(proxy->request);
+              SPDY_destroy_response(proxy->response);
               cleanup(proxy);
-            *//*}
-            else
-              proxy->error = true;*/
-         /* }
+            }
+          }
           else
           {
-            //TODO too early to clean them
-            proxy->error = true;
-            //SPDY_destroy_request(proxy->request);
-            //SPDY_destroy_response(proxy->response);
-            //cleanup(proxy);
-          }*/
+            proxy->curl_error = true;
+          }
           call_spdy_run = true;
           //TODO spdy should be notified to send RST_STREAM
         }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]