aboutsummaryrefslogtreecommitdiff
path: root/src/examples/spdy_fileserver.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/examples/spdy_fileserver.c')
-rw-r--r--src/examples/spdy_fileserver.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/examples/spdy_fileserver.c b/src/examples/spdy_fileserver.c
index f2b8f7b0..024bb644 100644
--- a/src/examples/spdy_fileserver.c
+++ b/src/examples/spdy_fileserver.c
@@ -22,7 +22,10 @@
22 * files directly read from the system 22 * files directly read from the system
23 * @author Andrey Uzunov 23 * @author Andrey Uzunov
24 */ 24 */
25 25
26//for asprintf
27#define _GNU_SOURCE
28
26#include <unistd.h> 29#include <unistd.h>
27#include <stdlib.h> 30#include <stdlib.h>
28#include <stdint.h> 31#include <stdint.h>
@@ -114,6 +117,7 @@ response_done_callback(void *cls,
114 bool streamopened) 117 bool streamopened)
115{ 118{
116 (void)streamopened; 119 (void)streamopened;
120 (void)status;
117 //printf("answer for %s was sent\n", (char *)cls); 121 //printf("answer for %s was sent\n", (char *)cls);
118 122
119 /*if(SPDY_RESPONSE_RESULT_SUCCESS != status) 123 /*if(SPDY_RESPONSE_RESULT_SUCCESS != status)
@@ -135,7 +139,8 @@ standard_request_handler(void *cls,
135 const char *version, 139 const char *version,
136 const char *host, 140 const char *host,
137 const char *scheme, 141 const char *scheme,
138 struct SPDY_NameValue * headers) 142 struct SPDY_NameValue * headers,
143 bool more)
139{ 144{
140 (void)cls; 145 (void)cls;
141 (void)request; 146 (void)request;
@@ -143,6 +148,9 @@ standard_request_handler(void *cls,
143 (void)host; 148 (void)host;
144 (void)scheme; 149 (void)scheme;
145 (void)headers; 150 (void)headers;
151 (void)method;
152 (void)version;
153 (void)more;
146 154
147 struct SPDY_Response *response=NULL; 155 struct SPDY_Response *response=NULL;
148 struct SPDY_NameValue *resp_headers; 156 struct SPDY_NameValue *resp_headers;
@@ -165,7 +173,7 @@ standard_request_handler(void *cls,
165 || -1 == (filesize = ftell(fd)) 173 || -1 == (filesize = ftell(fd))
166 || 0 != (ret = fseek(fd, 0L, SEEK_SET))) 174 || 0 != (ret = fseek(fd, 0L, SEEK_SET)))
167 { 175 {
168 printf("Error on opening %s\n%i %i %i\n",fname, fd, ret, filesize); 176 printf("Error on opening %s\n%p %i %zd\n",fname, fd, ret, filesize);
169 response = SPDY_build_response(SPDY_HTTP_INTERNAL_SERVER_ERROR,NULL,SPDY_HTTP_VERSION_1_1,NULL,NULL,0); 177 response = SPDY_build_response(SPDY_HTTP_INTERNAL_SERVER_ERROR,NULL,SPDY_HTTP_VERSION_1_1,NULL,NULL,0);
170 } 178 }
171 else 179 else
@@ -185,7 +193,7 @@ standard_request_handler(void *cls,
185 } 193 }
186 free(date); 194 free(date);
187 195
188 if(-1 == asprintf(&fsize, "%i", filesize) 196 if(-1 == asprintf(&fsize, "%zd", filesize)
189 || SPDY_YES != SPDY_name_value_add(resp_headers,SPDY_HTTP_HEADER_CONTENT_LENGTH,fsize)) 197 || SPDY_YES != SPDY_name_value_add(resp_headers,SPDY_HTTP_HEADER_CONTENT_LENGTH,fsize))
190 { 198 {
191 printf("SPDY_name_value_add or asprintf failed\n"); 199 printf("SPDY_name_value_add or asprintf failed\n");