Mercurial > urweb
comparison src/c/cgi.c @ 1799:3d922a28370b
Basis.getenv
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Thu, 02 Aug 2012 16:33:25 -0400 |
parents | ea131de361d9 |
children | 0da75c01a993 |
comparison
equal
deleted
inserted
replaced
1798:10a2cb93d175 | 1799:3d922a28370b |
---|---|
1 #include "config.h" | 1 #include "config.h" |
2 | 2 |
3 #include <stdio.h> | 3 #include <stdio.h> |
4 #include <stdlib.h> | |
4 #include <ctype.h> | 5 #include <ctype.h> |
5 #include <string.h> | 6 #include <string.h> |
6 #include <stdlib.h> | 7 #include <stdlib.h> |
7 #include <unistd.h> | 8 #include <unistd.h> |
8 #include <stdarg.h> | 9 #include <stdarg.h> |
35 else if (!strcasecmp(saved_h, "Content-length") | 36 else if (!strcasecmp(saved_h, "Content-length") |
36 || !strcasecmp(saved_h, "Content-type")) | 37 || !strcasecmp(saved_h, "Content-type")) |
37 return getenv(uppercased + 5); | 38 return getenv(uppercased + 5); |
38 else | 39 else |
39 return NULL; | 40 return NULL; |
41 } | |
42 | |
43 static char *get_env(void *data, const char *name) { | |
44 return getenv(name); | |
40 } | 45 } |
41 | 46 |
42 static void on_success(uw_context ctx) { } | 47 static void on_success(uw_context ctx) { } |
43 | 48 |
44 static void on_failure(uw_context ctx) { | 49 static void on_failure(uw_context ctx) { |
100 exit(1); | 105 exit(1); |
101 } | 106 } |
102 | 107 |
103 uw_set_on_success(""); | 108 uw_set_on_success(""); |
104 uw_set_headers(ctx, get_header, NULL); | 109 uw_set_headers(ctx, get_header, NULL); |
110 uw_set_env(ctx, get_env, NULL); | |
105 uw_request_init(&uw_application, NULL, log_error, log_debug); | 111 uw_request_init(&uw_application, NULL, log_error, log_debug); |
106 | 112 |
107 body[body_pos] = 0; | 113 body[body_pos] = 0; |
108 rr = uw_request(rc, ctx, method, path, query_string, body, body_pos, | 114 rr = uw_request(rc, ctx, method, path, query_string, body, body_pos, |
109 on_success, on_failure, | 115 on_success, on_failure, |