diff options
Diffstat (limited to 'src/microspdy/session.c')
-rw-r--r-- | src/microspdy/session.c | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/src/microspdy/session.c b/src/microspdy/session.c index 670b4cde..46c15a96 100644 --- a/src/microspdy/session.c +++ b/src/microspdy/session.c | |||
@@ -322,9 +322,40 @@ spdyf_handler_read_rst_stream (struct SPDY_Session *session) | |||
322 | static void | 322 | static void |
323 | spdyf_handler_read_data (struct SPDY_Session *session) | 323 | spdyf_handler_read_data (struct SPDY_Session *session) |
324 | { | 324 | { |
325 | (void)session; | 325 | //just ignore the whole frame for now |
326 | //TODO ignore data frames for now | 326 | struct SPDYF_Data_Frame * frame; |
327 | SPDYF_PANIC("POST requests are Not yet implemented!"); | 327 | |
328 | SPDYF_ASSERT(SPDY_SESSION_STATUS_WAIT_FOR_SUBHEADER == session->status | ||
329 | || SPDY_SESSION_STATUS_WAIT_FOR_BODY == session->status, | ||
330 | "the function is called wrong"); | ||
331 | |||
332 | SPDYF_DEBUG("DATA frame received (POST?). Ignoring"); | ||
333 | |||
334 | //SPDYF_SIGINT(""); | ||
335 | |||
336 | frame = (struct SPDYF_Data_Frame *)session->frame_handler_cls; | ||
337 | |||
338 | //handle subheaders | ||
339 | if(SPDY_SESSION_STATUS_WAIT_FOR_SUBHEADER == session->status) | ||
340 | { | ||
341 | if(frame->length > SPDY_MAX_SUPPORTED_FRAME_SIZE) | ||
342 | { | ||
343 | session->status = SPDY_SESSION_STATUS_IGNORE_BYTES; | ||
344 | return; | ||
345 | } | ||
346 | else | ||
347 | session->status = SPDY_SESSION_STATUS_WAIT_FOR_BODY; | ||
348 | } | ||
349 | |||
350 | //handle body | ||
351 | |||
352 | if(session->read_buffer_offset - session->read_buffer_beginning | ||
353 | >= frame->length) | ||
354 | { | ||
355 | session->read_buffer_beginning += frame->length; | ||
356 | session->status = SPDY_SESSION_STATUS_WAIT_FOR_HEADER; | ||
357 | free(frame); | ||
358 | } | ||
328 | } | 359 | } |
329 | 360 | ||
330 | 361 | ||
@@ -1071,6 +1102,7 @@ SPDYF_session_idle (struct SPDY_Session *session) | |||
1071 | session->read_buffer + session->read_buffer_beginning, | 1102 | session->read_buffer + session->read_buffer_beginning, |
1072 | sizeof(struct SPDYF_Data_Frame)); | 1103 | sizeof(struct SPDYF_Data_Frame)); |
1073 | session->read_buffer_beginning += sizeof(struct SPDYF_Data_Frame); | 1104 | session->read_buffer_beginning += sizeof(struct SPDYF_Data_Frame); |
1105 | SPDYF_DATA_FRAME_NTOH(data_frame); | ||
1074 | 1106 | ||
1075 | session->status = SPDY_SESSION_STATUS_WAIT_FOR_BODY; | 1107 | session->status = SPDY_SESSION_STATUS_WAIT_FOR_BODY; |
1076 | session->frame_handler = &spdyf_handler_read_data; | 1108 | session->frame_handler = &spdyf_handler_read_data; |