gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r27809 - libmicrohttpd/src/microspdy


From: gnunet
Subject: [GNUnet-SVN] r27809 - libmicrohttpd/src/microspdy
Date: Tue, 9 Jul 2013 01:24:35 +0200

Author: andreyu
Date: 2013-07-09 01:24:34 +0200 (Tue, 09 Jul 2013)
New Revision: 27809

Modified:
   libmicrohttpd/src/microspdy/applicationlayer.c
   libmicrohttpd/src/microspdy/structures.c
   libmicrohttpd/src/microspdy/structures.h
Log:
spdy: bug fixed - breaking when no headers are provided for response

Modified: libmicrohttpd/src/microspdy/applicationlayer.c
===================================================================
--- libmicrohttpd/src/microspdy/applicationlayer.c      2013-07-08 22:51:29 UTC 
(rev 27808)
+++ libmicrohttpd/src/microspdy/applicationlayer.c      2013-07-08 23:24:34 UTC 
(rev 27809)
@@ -414,7 +414,7 @@
                goto free_and_fail;
        memset(response, 0, sizeof(struct SPDY_Response));
        
-       if(NULL != headers)
+       if(NULL != headers && !SPDYF_name_value_is_empty(headers))
                num_hdr_containers = 2;
        
        if(NULL == (all_headers = malloc(num_hdr_containers * sizeof(struct 
SPDY_NameValue *))))

Modified: libmicrohttpd/src/microspdy/structures.c
===================================================================
--- libmicrohttpd/src/microspdy/structures.c    2013-07-08 22:51:29 UTC (rev 
27808)
+++ libmicrohttpd/src/microspdy/structures.c    2013-07-08 23:24:34 UTC (rev 
27809)
@@ -27,9 +27,17 @@
 #include "structures.h"
 #include "internal.h"
 #include "session.h"
+//TODO not for here?
 #include <ctype.h>
 
 
+int
+SPDYF_name_value_is_empty(struct SPDY_NameValue *container)
+{
+  SPDYF_ASSERT(NULL != container, "NULL is not an empty container!");
+  return (NULL == container->name && NULL == container->value) ? SPDY_YES : 
SPDY_NO;
+}
+
 struct SPDY_NameValue *
 SPDY_name_value_create ()
 {
@@ -65,7 +73,7 @@
                        return SPDY_INPUT_ERROR;
        }
        
-       if(NULL == container->name && NULL == container->value)
+       if(SPDYF_name_value_is_empty(container))
        {
                //container is empty/just created 
                if (NULL == (container->name = strdup (name)))
@@ -181,7 +189,7 @@
        
        if(NULL == container || NULL == name || NULL == num_values)
                return NULL;
-       if(NULL == container->name && NULL == container->value)
+       if(SPDYF_name_value_is_empty(container))
                return NULL;
        
        do
@@ -232,7 +240,7 @@
                return SPDY_INPUT_ERROR;
                
        //check if container is an empty struct
-       if(NULL == container->name && NULL == container->value)
+       if(SPDYF_name_value_is_empty(container))
                return 0;
        
        count = 0;

Modified: libmicrohttpd/src/microspdy/structures.h
===================================================================
--- libmicrohttpd/src/microspdy/structures.h    2013-07-08 22:51:29 UTC (rev 
27808)
+++ libmicrohttpd/src/microspdy/structures.h    2013-07-08 23:24:34 UTC (rev 
27809)
@@ -1161,6 +1161,18 @@
 
 
 /**
+ * Checks if the container is empty, i.e. created but no values were
+ * added to it.
+ *
+ * @param container
+ * @return SPDY_YES if empty
+ *         SPDY_NO if not
+ */
+int
+SPDYF_name_value_is_empty(struct SPDY_NameValue *container);
+
+
+/**
  * Transforms raw binary decomressed stream of headers
  * into SPDY_NameValue, containing all of the headers and values.
  *




reply via email to

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