comparison src/c/urweb.c @ 693:655bcc9b77e0

_Really_ implement embedded closure GC; extend Scriptcheck to figure out when client IDs must be assigned
author Adam Chlipala <adamc@hcoop.net>
date Sat, 04 Apr 2009 14:03:39 -0400
parents b6a8425e1b1f
children 7ea0df9e56b6
comparison
equal deleted inserted replaced
692:09df0c85f306 693:655bcc9b77e0
298 298
299 cleanup *cleanup, *cleanup_front, *cleanup_back; 299 cleanup *cleanup, *cleanup_front, *cleanup_back;
300 300
301 const char *script_header, *url_prefix; 301 const char *script_header, *url_prefix;
302 302
303 int needs_push;
304
303 size_t n_deltas, used_deltas; 305 size_t n_deltas, used_deltas;
304 delta *deltas; 306 delta *deltas;
305 307
306 int timeout; 308 int timeout;
307 309
331 333
332 ctx->cleanup_front = ctx->cleanup_back = ctx->cleanup = malloc(0); 334 ctx->cleanup_front = ctx->cleanup_back = ctx->cleanup = malloc(0);
333 335
334 ctx->script_header = ""; 336 ctx->script_header = "";
335 ctx->url_prefix = "/"; 337 ctx->url_prefix = "/";
338 ctx->needs_push = 0;
336 339
337 ctx->error_message[0] = 0; 340 ctx->error_message[0] = 0;
338 341
339 ctx->source_count = 0; 342 ctx->source_count = 0;
340 343
474 477
475 return NULL; 478 return NULL;
476 } 479 }
477 480
478 void uw_login(uw_context ctx) { 481 void uw_login(uw_context ctx) {
479 if (ctx->script_header[0]) { 482 if (ctx->needs_push) {
480 char *id_s, *pass_s; 483 char *id_s, *pass_s;
481 484
482 if ((id_s = uw_Basis_requestHeader(ctx, "UrWeb-Client")) 485 if ((id_s = uw_Basis_requestHeader(ctx, "UrWeb-Client"))
483 && (pass_s = uw_Basis_requestHeader(ctx, "UrWeb-Pass"))) { 486 && (pass_s = uw_Basis_requestHeader(ctx, "UrWeb-Pass"))) {
484 unsigned id = atoi(id_s); 487 unsigned id = atoi(id_s);
574 ctx->script_header = s; 577 ctx->script_header = s;
575 } 578 }
576 579
577 void uw_set_url_prefix(uw_context ctx, const char *s) { 580 void uw_set_url_prefix(uw_context ctx, const char *s) {
578 ctx->url_prefix = s; 581 ctx->url_prefix = s;
582 }
583
584 void uw_set_needs_push(uw_context ctx, int n) {
585 ctx->needs_push = n;
579 } 586 }
580 587
581 588
582 static void buf_check_ctx(uw_context ctx, buf *b, size_t extra, const char *desc) { 589 static void buf_check_ctx(uw_context ctx, buf *b, size_t extra, const char *desc) {
583 if (b->back - b->front < extra) { 590 if (b->back - b->front < extra) {