From 688973e51e94d2c24185f0899227dfe7dd3dd93b Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sat, 27 Jun 2009 14:44:00 -0400 Subject: Serving Hello via FastCGI --- src/c/urweb.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/c/urweb.c') diff --git a/src/c/urweb.c b/src/c/urweb.c index fd056a33..f5f11a2b 100644 --- a/src/c/urweb.c +++ b/src/c/urweb.c @@ -1102,6 +1102,20 @@ int uw_print(uw_context ctx, int fd) { return uw_really_write(fd, ctx->page.start, ctx->page.front - ctx->page.start); } +int uw_output(uw_context ctx, int (*output)(void *data, char *buf, size_t len), void *data) { + int n = output(data, ctx->outHeaders.start, ctx->outHeaders.front - ctx->outHeaders.start); + + if (n < 0) + return n; + + n = output(data, "\r\n", 2); + + if (n < 0) + return n; + + return output(data, ctx->page.start, ctx->page.front - ctx->page.start); +} + static void uw_check_headers(uw_context ctx, size_t extra) { buf_check(&ctx->outHeaders, extra); } -- cgit v1.2.3