comparison src/c/urweb.c @ 1915:52e88e139b25

Add Connection and Content-length headers to raw HTTP responses
author Adam Chlipala <adam@chlipala.net>
date Wed, 27 Nov 2013 15:28:55 -0500
parents 0354df1b6849
children f5d1037effc9
comparison
equal deleted inserted replaced
1914:6a2cc604a322 1915:52e88e139b25
1278 void uw_memstats(uw_context ctx) { 1278 void uw_memstats(uw_context ctx) {
1279 printf("Headers: %lu/%lu\n", (unsigned long)uw_buffer_used(&ctx->outHeaders), (unsigned long)uw_buffer_avail(&ctx->outHeaders)); 1279 printf("Headers: %lu/%lu\n", (unsigned long)uw_buffer_used(&ctx->outHeaders), (unsigned long)uw_buffer_avail(&ctx->outHeaders));
1280 printf("Script: %lu/%lu\n", (unsigned long)uw_buffer_used(&ctx->script), (unsigned long)uw_buffer_avail(&ctx->script)); 1280 printf("Script: %lu/%lu\n", (unsigned long)uw_buffer_used(&ctx->script), (unsigned long)uw_buffer_avail(&ctx->script));
1281 printf("Page: %lu/%lu\n", (unsigned long)uw_buffer_used(&ctx->page), (unsigned long)uw_buffer_avail(&ctx->page)); 1281 printf("Page: %lu/%lu\n", (unsigned long)uw_buffer_used(&ctx->page), (unsigned long)uw_buffer_avail(&ctx->page));
1282 printf("Heap: %lu/%lu\n", (unsigned long)uw_buffer_used(&ctx->heap), (unsigned long)uw_buffer_avail(&ctx->heap)); 1282 printf("Heap: %lu/%lu\n", (unsigned long)uw_buffer_used(&ctx->heap), (unsigned long)uw_buffer_avail(&ctx->heap));
1283 }
1284
1285 int uw_pagelen(uw_context ctx) {
1286 return ctx->page.front - ctx->page.start;
1283 } 1287 }
1284 1288
1285 int uw_send(uw_context ctx, int sock) { 1289 int uw_send(uw_context ctx, int sock) {
1286 int n = uw_really_send(sock, ctx->outHeaders.start, ctx->outHeaders.front - ctx->outHeaders.start); 1290 int n = uw_really_send(sock, ctx->outHeaders.start, ctx->outHeaders.front - ctx->outHeaders.start);
1287 1291