[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r27487 - libmicrohttpd/src/microspdy
From: |
gnunet |
Subject: |
[GNUnet-SVN] r27487 - libmicrohttpd/src/microspdy |
Date: |
Wed, 19 Jun 2013 12:52:51 +0200 |
Author: andreyu
Date: 2013-06-19 12:52:50 +0200 (Wed, 19 Jun 2013)
New Revision: 27487
Modified:
libmicrohttpd/src/microspdy/applicationlayer.c
libmicrohttpd/src/microspdy/session.c
Log:
spdy: ignore POST instead of abort and send 501 no implemented
Modified: libmicrohttpd/src/microspdy/applicationlayer.c
===================================================================
--- libmicrohttpd/src/microspdy/applicationlayer.c 2013-06-19 10:50:09 UTC
(rev 27486)
+++ libmicrohttpd/src/microspdy/applicationlayer.c 2013-06-19 10:52:50 UTC
(rev 27487)
@@ -31,6 +31,22 @@
#include "session.h"
+void
+spdy_callback_response_done(void *cls,
+ struct SPDY_Response *response,
+ struct SPDY_Request *request,
+ enum SPDY_RESPONSE_RESULT
status,
+ bool streamopened)
+{
+ (void)cls;
+ (void)status;
+ (void)streamopened;
+
+ SPDY_destroy_request(request);
+ SPDY_destroy_response(response);
+}
+
+
/**
* Callback called when new stream is created. It extracts the info from
* the stream to create (HTTP) request object and pass it to the client.
@@ -136,6 +152,28 @@
return SPDY_YES;
}
+
+ //ignore everything but GET
+ if(strcasecmp("GET",method))
+ {
+ SPDYF_DEBUG("received method '%s'", method);
+ static char * html = "Method not implemented. libmicrospdy supports now
only GET.";
+ struct SPDY_Response *response = SPDY_build_response(501, NULL,
SPDY_HTTP_VERSION_1_1, NULL, html, strlen(html));
+ if(NULL==response)
+ {
+ SPDY_destroy_request(request);
+ return SPDY_YES;
+ }
+
+ if(SPDY_YES != SPDY_queue_response(request, response, true, false,
&spdy_callback_response_done, NULL))
+ {
+ SPDY_destroy_response(response);
+ SPDY_destroy_request(request);
+ }
+
+ //SPDY_destroy_request(request);
+ return SPDY_YES;
+ }
//call client's callback function to notify
daemon->new_request_cb(daemon->cls,
Modified: libmicrohttpd/src/microspdy/session.c
===================================================================
--- libmicrohttpd/src/microspdy/session.c 2013-06-19 10:50:09 UTC (rev
27486)
+++ libmicrohttpd/src/microspdy/session.c 2013-06-19 10:52:50 UTC (rev
27487)
@@ -322,9 +322,40 @@
static void
spdyf_handler_read_data (struct SPDY_Session *session)
{
- (void)session;
- //TODO ignore data frames for now
- SPDYF_PANIC("POST requests are Not yet implemented!");
+ //just ignore the whole frame for now
+ struct SPDYF_Data_Frame * frame;
+
+ SPDYF_ASSERT(SPDY_SESSION_STATUS_WAIT_FOR_SUBHEADER == session->status
+ || SPDY_SESSION_STATUS_WAIT_FOR_BODY == session->status,
+ "the function is called wrong");
+
+ SPDYF_DEBUG("DATA frame received (POST?). Ignoring");
+
+ //SPDYF_SIGINT("");
+
+ frame = (struct SPDYF_Data_Frame *)session->frame_handler_cls;
+
+ //handle subheaders
+ if(SPDY_SESSION_STATUS_WAIT_FOR_SUBHEADER == session->status)
+ {
+ if(frame->length > SPDY_MAX_SUPPORTED_FRAME_SIZE)
+ {
+ session->status = SPDY_SESSION_STATUS_IGNORE_BYTES;
+ return;
+ }
+ else
+ session->status = SPDY_SESSION_STATUS_WAIT_FOR_BODY;
+ }
+
+ //handle body
+
+ if(session->read_buffer_offset - session->read_buffer_beginning
+ >= frame->length)
+ {
+ session->read_buffer_beginning += frame->length;
+ session->status = SPDY_SESSION_STATUS_WAIT_FOR_HEADER;
+ free(frame);
+ }
}
@@ -1071,6 +1102,7 @@
session->read_buffer +
session->read_buffer_beginning,
sizeof(struct SPDYF_Data_Frame));
session->read_buffer_beginning += sizeof(struct
SPDYF_Data_Frame);
+ SPDYF_DATA_FRAME_NTOH(data_frame);
session->status =
SPDY_SESSION_STATUS_WAIT_FOR_BODY;
session->frame_handler =
&spdyf_handler_read_data;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r27487 - libmicrohttpd/src/microspdy,
gnunet <=