comparison src/c/driver.c @ 569:162d5308e34f

Successfully generated a page element from a signal
author Adam Chlipala <adamc@hcoop.net>
date Sat, 20 Dec 2008 16:19:26 -0500
parents 6daa59a55c43
children a93d5324f400
comparison
equal deleted inserted replaced
568:55fc747a67dc 569:162d5308e34f
191 printf("Serving URI %s....\n", path); 191 printf("Serving URI %s....\n", path);
192 192
193 uw_set_headers(ctx, headers); 193 uw_set_headers(ctx, headers);
194 194
195 while (1) { 195 while (1) {
196 uw_write(ctx, "<html>");
197
198 if (uw_db_begin(ctx)) { 196 if (uw_db_begin(ctx)) {
199 printf("Error running SQL BEGIN\n"); 197 printf("Error running SQL BEGIN\n");
200 if (retries_left) 198 if (retries_left)
201 --retries_left; 199 --retries_left;
202 else { 200 else {
209 break; 207 break;
210 } 208 }
211 } 209 }
212 210
213 uw_write_header(ctx, "HTTP/1.1 200 OK\r\n"); 211 uw_write_header(ctx, "HTTP/1.1 200 OK\r\n");
214 uw_write_header(ctx, "Content-type: text/html\r\n");
215 212
216 strcpy(path_copy, path); 213 strcpy(path_copy, path);
217 fk = uw_begin(ctx, path_copy); 214 fk = uw_begin(ctx, path_copy);
218 if (fk == SUCCESS) { 215 if (fk == SUCCESS) {
219 uw_write(ctx, "</html>");
220
221 if (uw_db_commit(ctx)) { 216 if (uw_db_commit(ctx)) {
222 fk = FATAL; 217 fk = FATAL;
223 218
224 printf("Error running SQL COMMIT\n"); 219 printf("Error running SQL COMMIT\n");
225 uw_reset(ctx); 220 uw_reset(ctx);