[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r27653 - in libmicrohttpd/src: examples include microspdy s
From: |
gnunet |
Subject: |
[GNUnet-SVN] r27653 - in libmicrohttpd/src: examples include microspdy spdy2http |
Date: |
Thu, 27 Jun 2013 16:41:35 +0200 |
Author: grothoff
Date: 2013-06-27 16:41:35 +0200 (Thu, 27 Jun 2013)
New Revision: 27653
Modified:
libmicrohttpd/src/examples/spdy_event_loop.c
libmicrohttpd/src/examples/spdy_response_with_callback.c
libmicrohttpd/src/include/microspdy.h
libmicrohttpd/src/microspdy/applicationlayer.c
libmicrohttpd/src/microspdy/daemon.c
libmicrohttpd/src/microspdy/session.c
libmicrohttpd/src/microspdy/structures.c
libmicrohttpd/src/spdy2http/proxy.c
Log:
-fixing misc minor bugs and compiler warnings in libmicrospdy
Modified: libmicrohttpd/src/examples/spdy_event_loop.c
===================================================================
--- libmicrohttpd/src/examples/spdy_event_loop.c 2013-06-27 13:37:50 UTC
(rev 27652)
+++ libmicrohttpd/src/examples/spdy_event_loop.c 2013-06-27 14:41:35 UTC
(rev 27653)
@@ -41,15 +41,17 @@
//#include "../framinglayer/structures.h"
//#include "../applicationlayer/alstructures.h"
-int run = 1;
-int run2 = 1;
+static int run = 1;
+static int run2 = 1;
+
- uint64_t loops;
- time_t start;
+static uint64_t loops;
+static time_t start;
-void
+
+static void
new_session_callback (void *cls,
struct SPDY_Session * session)
{
@@ -88,7 +90,8 @@
}
}
-void
+
+static void
session_closed_handler (void *cls,
struct SPDY_Session * session,
int by_client)
@@ -108,7 +111,8 @@
//session_closed_called = 1;
}
-void
+
+static void
response_done_callback(void *cls,
struct SPDY_Response *response,
struct SPDY_Request *request,
@@ -135,7 +139,8 @@
free(cls);
}
-int
+
+static int
print_headers (void *cls,
const char *name, const char *value)
{
@@ -163,11 +168,12 @@
}
*/
-int
+
+static int
append_headers_to_data (void *cls,
- const char *name, const char **value, int
num_values)
+ const char *name, const char * const *value, int
num_values)
{
- char **data = (char **)cls;
+ char **data = cls;
void *tofree = *data;
int i;
@@ -183,7 +189,8 @@
return SPDY_YES;
}
-void
+
+static void
standard_request_handler(void *cls,
struct SPDY_Request * request,
uint8_t priority,
@@ -251,11 +258,14 @@
}
}
-void sig_handler(int signo)
+
+static void
+sig_handler(int signo)
{
printf("received signal\n");
}
+
int
main (int argc, char *const *argv)
{
Modified: libmicrohttpd/src/examples/spdy_response_with_callback.c
===================================================================
--- libmicrohttpd/src/examples/spdy_response_with_callback.c 2013-06-27
13:37:50 UTC (rev 27652)
+++ libmicrohttpd/src/examples/spdy_response_with_callback.c 2013-06-27
14:41:35 UTC (rev 27653)
@@ -32,10 +32,10 @@
#include <errno.h>
#include "microspdy.h"
-int run = 1;
+static int run = 1;
-ssize_t
+static ssize_t
response_callback (void *cls,
void *buffer,
size_t max,
@@ -53,11 +53,12 @@
}
-void
+static void
response_done_callback(void *cls,
- struct SPDY_Response *response,
- struct SPDY_Request *request,
- bool streamopened)
+ struct SPDY_Response *response,
+ struct SPDY_Request *request,
+ enum SPDY_RESPONSE_RESULT status,
+ bool streamopened)
{
(void)streamopened;
printf("answer for %s was sent\n", (char *)cls);
@@ -67,7 +68,8 @@
free(cls);
}
-void
+
+static void
standard_request_handler(void *cls,
struct SPDY_Request * request,
uint8_t priority,
@@ -141,6 +143,7 @@
}
}
+
int
main (int argc, char *const *argv)
{
Modified: libmicrohttpd/src/include/microspdy.h
===================================================================
--- libmicrohttpd/src/include/microspdy.h 2013-06-27 13:37:50 UTC (rev
27652)
+++ libmicrohttpd/src/include/microspdy.h 2013-06-27 14:41:35 UTC (rev
27653)
@@ -51,6 +51,30 @@
#include <zlib.h>
#include <stdbool.h>
+/* While we generally would like users to use a configure-driven
+ build process which detects which headers are present and
+ hence works on any platform, we use "standard" includes here
+ to build out-of-the-box for beginning users on common systems.
+
+ Once you have a proper build system and go for more exotic
+ platforms, you should define MHD_PLATFORM_H in some header that
+ you always include *before* "microhttpd.h". Then the following
+ "standard" includes won't be used (which might be a good
+ idea, especially on platforms where they do not exist). */
+#ifndef MHD_PLATFORM_H
+#include <unistd.h>
+#include <stdarg.h>
+#include <stdint.h>
+#ifdef __MINGW32__
+#include <ws2tcpip.h>
+#else
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#endif
+#endif
+
+
/**
* return code for "YES".
*/
Modified: libmicrohttpd/src/microspdy/applicationlayer.c
===================================================================
--- libmicrohttpd/src/microspdy/applicationlayer.c 2013-06-27 13:37:50 UTC
(rev 27652)
+++ libmicrohttpd/src/microspdy/applicationlayer.c 2013-06-27 14:41:35 UTC
(rev 27653)
@@ -217,11 +217,11 @@
int streamopened;
struct SPDY_Request *request = (struct SPDY_Request *)cls;
- SPDYF_ASSERT(NULL == response_queue->data_frame
- && NULL != response_queue->control_frame
- || NULL != response_queue->data_frame
- && NULL == response_queue->control_frame,
- "response queue must have either control frame or data frame");
+ SPDYF_ASSERT( ( (NULL == response_queue->data_frame) &&
+ (NULL != response_queue->control_frame) ) ||
+ ( (NULL != response_queue->data_frame) &&
+ (NULL == response_queue->control_frame) ),
+ "response queue must have either control frame or data
frame");
streamopened = !response_queue->stream->is_out_closed;
Modified: libmicrohttpd/src/microspdy/daemon.c
===================================================================
--- libmicrohttpd/src/microspdy/daemon.c 2013-06-27 13:37:50 UTC (rev
27652)
+++ libmicrohttpd/src/microspdy/daemon.c 2013-06-27 14:41:35 UTC (rev
27653)
@@ -423,15 +423,15 @@
{
fd = pos->socket_fd;
FD_SET(fd, read_fd_set);
- if(all
- || NULL != pos->response_queue_head //frames pending
- || NULL != pos->write_buffer //part of last frame
pending
- || SPDY_SESSION_STATUS_CLOSING == pos->status //the
session is about to be closed
- || daemon->session_timeout //timeout passed for the
session
- && (pos->last_activity +
daemon->session_timeout < SPDYF_monotonic_time())
- || SPDY_YES == SPDYF_tls_is_pending(pos) //data in TLS'
read buffer pending
- || ((pos->read_buffer_offset -
pos->read_buffer_beginning) > 0) // data in lib's read buffer pending
- )
+ if (all
+ || (NULL != pos->response_queue_head) //frames pending
+ || (NULL != pos->write_buffer) //part of last frame pending
+ || (SPDY_SESSION_STATUS_CLOSING == pos->status) //the
session is about to be closed
+ || (daemon->session_timeout //timeout passed for the session
+ && (pos->last_activity + daemon->session_timeout <
SPDYF_monotonic_time()))
+ || (SPDY_YES == SPDYF_tls_is_pending(pos)) //data in TLS'
read buffer pending
+ || ((pos->read_buffer_offset - pos->read_buffer_beginning)
> 0) // data in lib's read buffer pending
+ )
FD_SET(fd, write_fd_set);
if(fd > max_fd)
max_fd = fd;
Modified: libmicrohttpd/src/microspdy/session.c
===================================================================
--- libmicrohttpd/src/microspdy/session.c 2013-06-27 13:37:50 UTC (rev
27652)
+++ libmicrohttpd/src/microspdy/session.c 2013-06-27 14:41:35 UTC (rev
27653)
@@ -932,6 +932,7 @@
//on respones with callbacks it is possible that their
is no
//data available
if(0 == session->write_buffer_size)//nothing to write
+ {
if(response_queue !=
session->response_queue_head)
{
//the handler modified the queue
@@ -942,6 +943,7 @@
//no need to try the same frame again
break;
}
+ }
}
session->last_activity = SPDYF_monotonic_time();
Modified: libmicrohttpd/src/microspdy/structures.c
===================================================================
--- libmicrohttpd/src/microspdy/structures.c 2013-06-27 13:37:50 UTC (rev
27652)
+++ libmicrohttpd/src/microspdy/structures.c 2013-06-27 14:41:35 UTC (rev
27653)
@@ -27,6 +27,7 @@
#include "structures.h"
#include "internal.h"
#include "session.h"
+#include <ctype.h>
struct SPDY_NameValue *
@@ -60,7 +61,7 @@
for(i=0; i<len; ++i)
{
- if(isupper(name[i]))
+ if(isupper((int) name[i]))
return SPDY_INPUT_ERROR;
}
@@ -289,12 +290,12 @@
unsigned int i;
bool is_last;
- SPDYF_ASSERT(!is_data
- || 0 == data_size && NULL != response->rcb
- || 0 < data_size && NULL == response->rcb,
- "either data or request->rcb must not be null");
+ SPDYF_ASSERT((! is_data)
+ || ((0 == data_size) && (NULL != response->rcb))
+ || ((0 < data_size) && (NULL == response->rcb)),
+ "either data or request->rcb must not be null");
- if(is_data && data_size > SPDY_MAX_SUPPORTED_FRAME_SIZE)
+ if (is_data && (data_size > SPDY_MAX_SUPPORTED_FRAME_SIZE))
{
//separate the data in more frames and add them to the queue
Modified: libmicrohttpd/src/spdy2http/proxy.c
===================================================================
--- libmicrohttpd/src/spdy2http/proxy.c 2013-06-27 13:37:50 UTC (rev 27652)
+++ libmicrohttpd/src/spdy2http/proxy.c 2013-06-27 14:41:35 UTC (rev 27653)
@@ -127,12 +127,15 @@
while(0)
-int loop = 1;
-CURLM *multi_handle;
-int still_running = 0; /* keep number of running handles */
-regex_t uri_preg;
+static int loop = 1;
+static CURLM *multi_handle;
+static int still_running = 0; /* keep number of running handles */
+
+static regex_t uri_preg;
+
+
struct Proxy
{
char *url;
@@ -151,7 +154,7 @@
};
-void
+static void
free_uri(struct URI * uri)
{
if(NULL != uri)
@@ -170,7 +173,8 @@
}
}
-int
+
+static int
init_parse_uri(regex_t * preg)
{
// RFC 2396
@@ -186,14 +190,16 @@
return regcomp(preg,
"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?", REG_EXTENDED);
}
-void
+
+static void
deinit_parse_uri(regex_t * preg)
{
regfree(preg);
}
-int
-parse_uri(regex_t * preg, char * full_uri, struct URI ** uri)
+
+static int
+parse_uri(regex_t * preg, const char * full_uri, struct URI ** uri)
{
int ret;
char *colon;
@@ -305,7 +311,7 @@
}
-void
+static void
response_done_callback(void *cls,
struct SPDY_Response *response,
struct SPDY_Request *request,
@@ -490,7 +496,7 @@
}
-int
+static int
iterate_cb (void *cls, const char *name, const char * const * value, int
num_values)
{
struct Proxy *proxy = (struct Proxy *)cls;
@@ -528,7 +534,7 @@
}
-void
+static void
standard_request_handler(void *cls,
struct SPDY_Request * request,
uint8_t priority,
@@ -627,8 +633,9 @@
}
}
-int
-run()
+
+static int
+run ()
{
unsigned long long timeoutlong=0;
long curl_timeo = -1;
@@ -645,9 +652,7 @@
CURLMsg *msg;
int msgs_left;
struct Proxy *proxy;
- struct sockaddr_in *addr;
- struct sockaddr_in addr4;
- struct in_addr inaddr4;
+ struct sockaddr_in *addr;
struct addrinfo hints;
char service[NI_MAXSERV];
struct addrinfo *gai;
@@ -679,16 +684,16 @@
}
else
{
- snprintf(service, sizeof(service), "%u", glob_opt.listen_port);
- memset(&hints, 0, sizeof(struct addrinfo));
- hints.ai_family = AF_UNSPEC;
+ snprintf (service, sizeof(service), "%u", glob_opt.listen_port);
+ memset (&hints, 0, sizeof(struct addrinfo));
+ hints.ai_family = AF_INET;
hints.ai_socktype = SOCK_STREAM;
ret = getaddrinfo(glob_opt.listen_host, service, &hints, &gai);
if(ret != 0)
DIE("problem with specified host");
- addr=gai->ai_addr;
+ addr = (struct sockaddr_in *) gai->ai_addr;
daemon = SPDY_start_daemon(0,
glob_opt.cert,
@@ -836,7 +841,8 @@
return 0;
}
-void
+
+static void
display_usage()
{
printf(
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r27653 - in libmicrohttpd/src: examples include microspdy spdy2http,
gnunet <=