Mercurial > urweb
diff src/c/urweb.c @ 860:a738002d5b4d
Serving Hello via FastCGI
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sat, 27 Jun 2009 14:44:00 -0400 |
parents | 86ec89baee01 |
children | 305bc0a431de |
line wrap: on
line diff
--- a/src/c/urweb.c Sat Jun 27 12:38:23 2009 -0400 +++ b/src/c/urweb.c Sat Jun 27 14:44:00 2009 -0400 @@ -1102,6 +1102,20 @@ 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); }