comparison src/c/http.c @ 1799:3d922a28370b

Basis.getenv
author Adam Chlipala <adam@chlipala.net>
date Thu, 02 Aug 2012 16:33:25 -0400
parents 7095e1b7240b
children 6a2cc604a322
comparison
equal deleted inserted replaced
1798:10a2cb93d175 1799:3d922a28370b
38 } 38 }
39 39
40 return NULL; 40 return NULL;
41 } 41 }
42 42
43 static char *get_env(void *data, const char *name) {
44 return getenv(name);
45 }
46
43 static void on_success(uw_context ctx) { 47 static void on_success(uw_context ctx) {
44 uw_write_header(ctx, "HTTP/1.1 200 OK\r\n"); 48 uw_write_header(ctx, "HTTP/1.1 200 OK\r\n");
45 } 49 }
46 50
47 static void on_failure(uw_context ctx) { 51 static void on_failure(uw_context ctx) {
191 *s = 0; 195 *s = 0;
192 s += 2; 196 s += 2;
193 } 197 }
194 198
195 uw_set_headers(ctx, get_header, headers); 199 uw_set_headers(ctx, get_header, headers);
200 uw_set_env(ctx, get_env, NULL);
196 201
197 printf("Serving URI %s....\n", path); 202 printf("Serving URI %s....\n", path);
198 rr = uw_request(rc, ctx, method, path, query_string, body, back - body, 203 rr = uw_request(rc, ctx, method, path, query_string, body, back - body,
199 on_success, on_failure, 204 on_success, on_failure,
200 NULL, log_error, log_debug, 205 NULL, log_error, log_debug,