gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r30070 - libmicrohttpd/src/spdy2http
Date: Thu, 10 Oct 2013 02:34:52 +0200

Author: andreyu
Date: 2013-10-10 02:34:52 +0200 (Thu, 10 Oct 2013)
New Revision: 30070

Modified:
   libmicrohttpd/src/spdy2http/proxy.c
Log:
spdy2http: handle servers which dont use CR

Modified: libmicrohttpd/src/spdy2http/proxy.c
===================================================================
--- libmicrohttpd/src/spdy2http/proxy.c 2013-10-09 22:25:41 UTC (rev 30069)
+++ libmicrohttpd/src/spdy2http/proxy.c 2013-10-10 00:34:52 UTC (rev 30070)
@@ -452,6 +452,7 @@
        
        if(!proxy->http_body_size)//nothing to write now
   {
+    PRINT_VERBOSE2("nothing to write now? %i", proxy->done);
     if(proxy->done) *more = false;
                return 0;
   }
@@ -503,7 +504,6 @@
        
        if(SPDY_RESPONSE_RESULT_SUCCESS != status)
        {
-               PRINT_VERBOSE2("answer was NOT sent, %i\n",status);
     free(proxy->http_body);
     proxy->http_body = NULL;
        }
@@ -540,7 +540,7 @@
   //trailer
   if(NULL != proxy->response) return 0;
 
-       if('\r' == line[0])
+       if('\r' == line[0] || '\n' == line[0])
        {
                //all headers were already handled; prepare spdy frames
                if(NULL == (proxy->response = 
SPDY_build_response_with_callback(proxy->status,
@@ -589,16 +589,16 @@
                pos = i+1;
                
                //status (number)
-               for(i=pos; i<realsize && ' '!=line[i] && '\r'!=line[i]; ++i);
+               for(i=pos; i<realsize && ' '!=line[i] && '\r'!=line[i] && 
'\n'!=line[i]; ++i);
                if(NULL == (status = strndup(&(line[pos]), i - pos)))
         DIE("No memory");
                proxy->status = atoi(status);
                free(status);
-               if(i<realsize && '\r'!=line[i])
+               if(i<realsize && '\r'!=line[i] && '\n'!=line[i])
                {
                        //status (message)
                        pos = i+1;
-                       for(i=pos; i<realsize && '\r'!=line[i]; ++i);
+                       for(i=pos; i<realsize && '\r'!=line[i] && 
'\n'!=line[i]; ++i);
                        if(NULL == (proxy->status_msg = strndup(&(line[pos]), i 
- pos)))
         DIE("No memory");
                }
@@ -608,7 +608,7 @@
        
        //other lines
        //header name
-       for(i=pos; i<realsize && ':'!=line[i] && '\r'!=line[i]; ++i)
+       for(i=pos; i<realsize && ':'!=line[i] && '\r'!=line[i] && 
'\n'!=line[i]; ++i)
                line[i] = tolower(line[i]); //spdy requires lower case
        if(NULL == (name = strndup(line, i - pos)))
         DIE("No memory");
@@ -621,7 +621,7 @@
                free(name);
                return realsize;
        }
-       if(i == realsize || '\r'==line[i])
+       if(i == realsize || '\r'==line[i] || '\n'==line[i])
        {
                //no value. is it possible?
                if(SPDY_YES != SPDY_name_value_add(proxy->headers, name, ""))
@@ -632,7 +632,7 @@
        //header value
        pos = i+1;
        while(pos<realsize && isspace(line[pos])) ++pos; //remove leading space
-       for(i=pos; i<realsize && '\r'!=line[i]; ++i);
+       for(i=pos; i<realsize && '\r'!=line[i] && '\n'!=line[i]; ++i);
        if(NULL == (value = strndup(&(line[pos]), i - pos)))
         DIE("No memory");
   PRINT_VERBOSE2("Adding header: '%s': '%s'", name, value);




reply via email to

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