src/server/daemon/protocol.c

changeset 45
a24aa388f02f
parent 44
3da1f7b6847f
child 48
37a512d7b8f6
equal deleted inserted replaced
44:3da1f7b6847f 45:a24aa388f02f
246 pblock *h = rq->srvhdrs; 246 pblock *h = rq->srvhdrs;
247 pb_entry *p; 247 pb_entry *p;
248 248
249 for(int i=0;i<h->hsize;i++) { 249 for(int i=0;i<h->hsize;i++) {
250 p = h->ht[i]; 250 p = h->ht[i];
251 while(p != NULL) { 251 while(p != NULL) {
252 /* from http.cpp */ 252 /* from http.cpp */
253 const pb_key *key = PARAM_KEY(p->param); 253 const pb_key *key = PARAM_KEY(p->param);
254 if (key == pb_key_status || key == pb_key_server || key == pb_key_date) { 254 if (key == pb_key_status || key == pb_key_server || key == pb_key_date) {
255 /* Skip internal Status:, Server:, and Date: information */ 255 /* Skip internal Status:, Server:, and Date: information */
256 p = p->next; 256 p = p->next;
260 260
261 char *name = p->param->name; 261 char *name = p->param->name;
262 char *value = p->param->value; 262 char *value = p->param->value;
263 263
264 /* make first char of name uppercase */ 264 /* make first char of name uppercase */
265 // TODO: don't modify the headers
265 if(name[0] > 90) { 266 if(name[0] > 90) {
266 name[0] -= 32; 267 name[0] -= 32;
267 } 268 }
268 269
269 sbuf_write(out, name, strlen(name)); 270 sbuf_write(out, name, strlen(name));
286 /* set socket blocking */ 287 /* set socket blocking */
287 int flags; 288 int flags;
288 flags = fcntl(fd, F_GETFL, 0); 289 flags = fcntl(fd, F_GETFL, 0);
289 fcntl(fd, F_SETFL, flags ^ O_NONBLOCK); 290 fcntl(fd, F_SETFL, flags ^ O_NONBLOCK);
290 291
291 /* iovec output buffer */ 292 /* output buffer */
292 sbuf_t *out = sbuf_new(512); 293 sbuf_t *out = sbuf_new(512);
293 294
294 /* add the http status line to the output buffer */ 295 /* add the http status line to the output buffer */
295 add_http_status_line(out, sn->pool, rq); 296 add_http_status_line(out, sn->pool, rq);
296 297

mercurial