diff src/c/urweb.c @ 921:ae0110465421

Don't replace <sc> in blob returns; optimize more 'option' pattern matches; detect more opportunities for 'let' inlining
author Adam Chlipala <adamc@hcoop.net>
date Wed, 09 Sep 2009 08:00:45 -0400
parents 321a2d6feb40
children d6a71f19a3d8
line wrap: on
line diff
--- a/src/c/urweb.c	Tue Sep 08 20:12:17 2009 -0400
+++ b/src/c/urweb.c	Wed Sep 09 08:00:45 2009 -0400
@@ -346,6 +346,7 @@
   void *get_header_data;
 
   buf outHeaders, page, heap, script;
+  int returning_blob;
   input *inputs, *subinputs, *cur_container;
   size_t n_subinputs, used_subinputs;
 
@@ -386,6 +387,7 @@
 
   buf_init(&ctx->outHeaders, 0);
   buf_init(&ctx->page, 0);
+  ctx->returning_blob = 0;
   buf_init(&ctx->heap, 0);
   buf_init(&ctx->script, 1);
   ctx->script.start[0] = 0;
@@ -458,6 +460,7 @@
   buf_reset(&ctx->script);
   ctx->script.start[0] = 0;
   buf_reset(&ctx->page);
+  ctx->returning_blob = 0;
   buf_reset(&ctx->heap);
   ctx->regions = NULL;
   ctx->cleanup_front = ctx->cleanup;
@@ -2549,7 +2552,7 @@
     ctx->transactionals[i].free(ctx->transactionals[i].data);
 
   // Splice script data into appropriate part of page
-  if (ctx->script_header[0] == 0)
+  if (ctx->returning_blob || ctx->script_header[0] == 0)
     ;
   else if (buf_used(&ctx->script) == 0) {
     size_t len = strlen(ctx->script_header);
@@ -2776,6 +2779,7 @@
   cleanup *cl;
   int len;
 
+  ctx->returning_blob = 1;
   buf_reset(&ctx->outHeaders);
   buf_reset(&ctx->page);