diff src/c/request.c @ 863:305bc0a431de

.msgs processing in FastCGI
author Adam Chlipala <adamc@hcoop.net>
date Sat, 27 Jun 2009 17:50:31 -0400
parents 86ec89baee01
children 6304f5e8fbb4
line wrap: on
line diff
--- a/src/c/request.c	Sat Jun 27 16:56:32 2009 -0400
+++ b/src/c/request.c	Sat Jun 27 17:50:31 2009 -0400
@@ -151,12 +151,16 @@
   free(r);
 }
 
+extern char *uw_url_prefix;
+
 request_result uw_request(uw_request_context rc, uw_context ctx,
                           char *method, char *path, char *query_string,
                           char *body, size_t body_len,
                           void (*on_success)(uw_context), void (*on_failure)(uw_context),
                           void *logger_data, uw_logger log_error, uw_logger log_debug,
-                          int sock) {
+                          int sock,
+                          int (*send)(int sockfd, const void *buf, size_t len),
+                          int (*close)(int fd)) {
   int retries_left = MAX_RETRIES;
   char *s;
   failure_kind fk;
@@ -201,7 +205,8 @@
     return FAILED;
   }
 
-  if (!strcmp(path, "/.msgs")) {
+  if (!strncmp(path, uw_url_prefix, strlen(uw_url_prefix))
+      && !strcmp(path + strlen(uw_url_prefix), ".msgs")) {
     char *id = uw_Basis_requestHeader(ctx, "UrWeb-Client");
     char *pass = uw_Basis_requestHeader(ctx, "UrWeb-Pass");
 
@@ -212,7 +217,7 @@
 
     if (id && pass) {
       unsigned idn = atoi(id);
-      uw_client_connect(idn, atoi(pass), sock);
+      uw_client_connect(idn, atoi(pass), sock, send, close);
       log_error(logger_data, "Processed request for messages by client %u\n\n", idn);
       return KEEP_OPEN;
     }