diff options
Diffstat (limited to 'src/microspdy/applicationlayer.c')
-rw-r--r-- | src/microspdy/applicationlayer.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/microspdy/applicationlayer.c b/src/microspdy/applicationlayer.c index 4335fd69..e706a89d 100644 --- a/src/microspdy/applicationlayer.c +++ b/src/microspdy/applicationlayer.c | |||
@@ -31,6 +31,22 @@ | |||
31 | #include "session.h" | 31 | #include "session.h" |
32 | 32 | ||
33 | 33 | ||
34 | void | ||
35 | spdy_callback_response_done(void *cls, | ||
36 | struct SPDY_Response *response, | ||
37 | struct SPDY_Request *request, | ||
38 | enum SPDY_RESPONSE_RESULT status, | ||
39 | bool streamopened) | ||
40 | { | ||
41 | (void)cls; | ||
42 | (void)status; | ||
43 | (void)streamopened; | ||
44 | |||
45 | SPDY_destroy_request(request); | ||
46 | SPDY_destroy_response(response); | ||
47 | } | ||
48 | |||
49 | |||
34 | /** | 50 | /** |
35 | * Callback called when new stream is created. It extracts the info from | 51 | * Callback called when new stream is created. It extracts the info from |
36 | * the stream to create (HTTP) request object and pass it to the client. | 52 | * the stream to create (HTTP) request object and pass it to the client. |
@@ -136,6 +152,28 @@ spdy_handler_new_stream (void *cls, | |||
136 | 152 | ||
137 | return SPDY_YES; | 153 | return SPDY_YES; |
138 | } | 154 | } |
155 | |||
156 | //ignore everything but GET | ||
157 | if(strcasecmp("GET",method)) | ||
158 | { | ||
159 | SPDYF_DEBUG("received method '%s'", method); | ||
160 | static char * html = "Method not implemented. libmicrospdy supports now only GET."; | ||
161 | struct SPDY_Response *response = SPDY_build_response(501, NULL, SPDY_HTTP_VERSION_1_1, NULL, html, strlen(html)); | ||
162 | if(NULL==response) | ||
163 | { | ||
164 | SPDY_destroy_request(request); | ||
165 | return SPDY_YES; | ||
166 | } | ||
167 | |||
168 | if(SPDY_YES != SPDY_queue_response(request, response, true, false, &spdy_callback_response_done, NULL)) | ||
169 | { | ||
170 | SPDY_destroy_response(response); | ||
171 | SPDY_destroy_request(request); | ||
172 | } | ||
173 | |||
174 | //SPDY_destroy_request(request); | ||
175 | return SPDY_YES; | ||
176 | } | ||
139 | 177 | ||
140 | //call client's callback function to notify | 178 | //call client's callback function to notify |
141 | daemon->new_request_cb(daemon->cls, | 179 | daemon->new_request_cb(daemon->cls, |