[tools] gmp: update to 5.0.4
[openwrt.git] / package / uhttpd / src / uhttpd.c
index 50c3b32..9b96086 100644 (file)
@@ -337,11 +337,14 @@ static struct http_request * uh_http_header_parse(struct client *cl, char *buffe
                        }
 
                        /* have name but no value and found a colon, start of value */
-                       else if( hdrname && !hdrdata && ((i+2) < buflen) &&
-                               (buffer[i] == ':') && (buffer[i+1] == ' ')
+                       else if( hdrname && !hdrdata &&
+                           ((i+1) < buflen) && (buffer[i] == ':')
                        ) {
                                buffer[i] = 0;
-                               hdrdata = &buffer[i+2];
+                               hdrdata = &buffer[i+1];
+
+                               while ((hdrdata + 1) < (buffer + buflen) && *hdrdata == ' ')
+                                       hdrdata++;
                        }
 
                        /* have no name and found [A-Za-z], start of name */
@@ -512,7 +515,22 @@ static void uh_mainloop(struct config *conf, fd_set serv_fds, int max_fd)
 #ifdef HAVE_TLS
                                                        /* setup client tls context */
                                                        if( conf->tls )
-                                                               conf->tls_accept(cl);
+                                                       {
+                                                               if( conf->tls_accept(cl) < 1 )
+                                                               {
+                                                                       fprintf(stderr,
+                                                                               "tls_accept failed, "
+                                                                               "connection dropped\n");
+
+                                                                       /* close client socket */
+                                                                       close(new_fd);
+
+                                                                       /* remove from global client list */
+                                                                       uh_client_remove(new_fd);
+
+                                                                       continue;
+                                                               }
+                                                       }
 #endif
 
                                                        /* add client socket to global fdset */
@@ -621,7 +639,7 @@ static void uh_mainloop(struct config *conf, fd_set serv_fds, int max_fd)
 }
 
 #ifdef HAVE_TLS
-static inline uh_inittls(struct config *conf)
+static inline int uh_inittls(struct config *conf)
 {
        /* library handle */
        void *lib;
This page took 0.024131 seconds and 4 git commands to generate.