[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r28215 - libmicrohttpd/src/examples
From: |
gnunet |
Subject: |
[GNUnet-SVN] r28215 - libmicrohttpd/src/examples |
Date: |
Sat, 20 Jul 2013 19:03:17 +0200 |
Author: andreyu
Date: 2013-07-20 19:03:17 +0200 (Sat, 20 Jul 2013)
New Revision: 28215
Modified:
libmicrohttpd/src/examples/mhd2spdy.c
libmicrohttpd/src/examples/mhd2spdy_http.c
libmicrohttpd/src/examples/mhd2spdy_spdy.c
libmicrohttpd/src/examples/mhd2spdy_structures.c
libmicrohttpd/src/examples/mhd2spdy_structures.h
Log:
mhd2spdy: changes, still importing
Modified: libmicrohttpd/src/examples/mhd2spdy.c
===================================================================
--- libmicrohttpd/src/examples/mhd2spdy.c 2013-07-20 15:04:00 UTC (rev
28214)
+++ libmicrohttpd/src/examples/mhd2spdy.c 2013-07-20 17:03:17 UTC (rev
28215)
@@ -41,6 +41,7 @@
static void catch_signal(int signal)
{
+ (void)signal;
//spdy_close = 1;
run = 0;
}
@@ -122,7 +123,7 @@
if(NULL == glob_opt.spdy_connection && glob_opt.only_proxy)
PRINT_INFO("cannot connect to the proxy");
}
-
+
//PRINT_INFO("while1");
FD_ZERO(&rs);
FD_ZERO(&ws);
@@ -166,7 +167,7 @@
connections, MAX_SPDY_CONNECTIONS,
&spdy_npollfds);
if(maxfd_s > maxfd) maxfd = maxfd_s;
- PRINT_INFO2("MHD timeout %i %i", timeout.tv_sec, timeout.tv_usec);
+ PRINT_INFO2("MHD timeout %lld %lld", (unsigned long long)timeout.tv_sec,
(unsigned long long)timeout.tv_usec);
//TODO
//timeout.tv_sec = 0;
//timeout.tv_usec = 0;
@@ -174,9 +175,10 @@
glob_opt.spdy_data_received = false;
ret = select(maxfd+1, &rs, &ws, &es, &timeout);
- PRINT_INFO2("timeout now %i %i", timeout.tv_sec, timeout.tv_usec);
+ PRINT_INFO2("timeout now %lld %lld", (unsigned long long)timeout.tv_sec,
(unsigned long long)timeout.tv_usec);
- switch(ret) {
+ switch(ret)
+ {
case -1:
PRINT_INFO2("select error: %i", errno);
break;
@@ -184,12 +186,14 @@
break;
default:
PRINT_INFO("run");
- MHD_run_from_select(daemon,&rs, &ws, &es);
+ //MHD_run_from_select(daemon,&rs, &ws, &es); //not closing FDs
+ MHD_run(daemon);
spdy_run_select(&rs, &ws, &es, connections, spdy_npollfds);
if(glob_opt.spdy_data_received)
{
PRINT_INFO("MHD run again");
- MHD_run_from_select(daemon,&rs, &ws, &es);
+ //MHD_run_from_select(daemon,&rs, &ws, &es); //not closing FDs
+ MHD_run(daemon);
}
break;
}
@@ -215,7 +219,7 @@
}*/
}
while(run);
-
+
//TODO exit from loop and clean
MHD_stop_daemon (daemon);
Modified: libmicrohttpd/src/examples/mhd2spdy_http.c
===================================================================
--- libmicrohttpd/src/examples/mhd2spdy_http.c 2013-07-20 15:04:00 UTC (rev
28214)
+++ libmicrohttpd/src/examples/mhd2spdy_http.c 2013-07-20 17:03:17 UTC (rev
28215)
@@ -31,6 +31,7 @@
PRINT_INFO2("log uri '%s'\n", uri);
+ //TODO free
if(NULL == (http_uri = au_malloc(sizeof(struct HTTP_URI ))))
DIE("no memory");
//memset(http_uri, 0 , sizeof(struct HTTP_URI));
@@ -100,6 +101,9 @@
PRINT_INFO2("http_response_callback for %s", proxy->url);
+ if(proxy->error)
+ return MHD_CONTENT_READER_END_WITH_ERROR;
+
if(0 == proxy->http_body_size &&( proxy->done || !proxy->spdy_active)){
PRINT_INFO("sent end of stream");
return MHD_CONTENT_READER_END_OF_STREAM;
@@ -183,7 +187,6 @@
*/
//SPDY_destroy_request(request);
//SPDY_destroy_response(response);
- MHD_destroy_response (proxy->http_response);
//if(!strcmp("/close",proxy->path)) run = 0;
//free(proxy->path);
if(proxy->spdy_active)
@@ -349,7 +352,6 @@
if(MHD_NO == MHD_add_response_header (proxy->http_response,
"Keep-Alive", "timeout=5, max=100"))
PRINT_INFO("SPDY_name_value_add failed: ");
-
/*
const union MHD_ConnectionInfo *info;
info = MHD_get_connection_info (connection,
@@ -447,4 +449,5 @@
//MHD_destroy_response (proxy->http_response);
//PRINT_INFO2("state after %i", proxy->http_connection->state);
//PRINT_INFO2("loop after %i", proxy->http_connection->event_loop_info);
+ MHD_destroy_response (proxy->http_response);
}
Modified: libmicrohttpd/src/examples/mhd2spdy_spdy.c
===================================================================
--- libmicrohttpd/src/examples/mhd2spdy_spdy.c 2013-07-20 15:04:00 UTC (rev
28214)
+++ libmicrohttpd/src/examples/mhd2spdy_spdy.c 2013-07-20 17:03:17 UTC (rev
28215)
@@ -236,6 +236,9 @@
//name = "SYN_REPLY";
stream_id = frame->syn_reply.stream_id;
break;
+ case SPDYLAY_RST_STREAM:
+ stream_id = frame->rst_stream.stream_id;
+ break;
case SPDYLAY_HEADERS:
nv = frame->headers.nv;
//name = "HEADERS";
@@ -247,9 +250,26 @@
}
proxy = spdylay_session_get_stream_user_data(session, stream_id);
+ if(NULL == proxy)
+ DIE("no proxy obj");
+
+ switch(type) {
+ case SPDYLAY_SYN_REPLY:
PRINT_INFO2("received headers for %s", proxy->url);
-
http_create_response(proxy, nv);
+ break;
+ case SPDYLAY_RST_STREAM:
+ PRINT_INFO2("received reset stream for %s", proxy->url);
+ proxy->error = true;
+ break;
+ case SPDYLAY_HEADERS:
+ PRINT_INFO2("received headers for %s", proxy->url);
+ http_create_response(proxy, nv);
+ break;
+ default:
+ return;
+ break;
+ }
glob_opt.spdy_data_received = true;
}
Modified: libmicrohttpd/src/examples/mhd2spdy_structures.c
===================================================================
--- libmicrohttpd/src/examples/mhd2spdy_structures.c 2013-07-20 15:04:00 UTC
(rev 28214)
+++ libmicrohttpd/src/examples/mhd2spdy_structures.c 2013-07-20 17:03:17 UTC
(rev 28215)
@@ -127,7 +127,7 @@
void
free_proxy(struct Proxy *proxy)
{
- //PRINT_INFO("free proxy called");
+ PRINT_INFO2("free proxy called for '%s'", proxy->url);
free(proxy->http_body);
free_uri(proxy->uri);
free(proxy->url);
Modified: libmicrohttpd/src/examples/mhd2spdy_structures.h
===================================================================
--- libmicrohttpd/src/examples/mhd2spdy_structures.h 2013-07-20 15:04:00 UTC
(rev 28214)
+++ libmicrohttpd/src/examples/mhd2spdy_structures.h 2013-07-20 17:03:17 UTC
(rev 28215)
@@ -113,10 +113,12 @@
int status;
int id;
bool done;
+ bool error;
bool http_active;
bool spdy_active;
};
+
struct HTTP_URI
{
char * uri;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r28215 - libmicrohttpd/src/examples,
gnunet <=