comparison src/c/driver.c @ 458:8f65b0fa3b29

Avoid allocating strings for requestHeader
author Adam Chlipala <adamc@hcoop.net>
date Thu, 06 Nov 2008 10:04:03 -0500
parents 360cbc202756
children 21bb5bbba2e9
comparison
equal deleted inserted replaced
457:360cbc202756 458:8f65b0fa3b29
186 } 186 }
187 } 187 }
188 188
189 printf("Serving URI %s....\n", path); 189 printf("Serving URI %s....\n", path);
190 190
191 uw_set_headers(ctx, headers);
192
191 while (1) { 193 while (1) {
192 if (uw_db_begin(ctx)) { 194 if (uw_db_begin(ctx)) {
193 printf("Error running SQL BEGIN\n"); 195 printf("Error running SQL BEGIN\n");
194 if (retries_left) 196 if (retries_left)
195 --retries_left; 197 --retries_left;
207 uw_write(ctx, "HTTP/1.1 200 OK\r\n"); 209 uw_write(ctx, "HTTP/1.1 200 OK\r\n");
208 uw_write(ctx, "Content-type: text/html\r\n\r\n"); 210 uw_write(ctx, "Content-type: text/html\r\n\r\n");
209 uw_write(ctx, "<html>"); 211 uw_write(ctx, "<html>");
210 212
211 strcpy(path_copy, path); 213 strcpy(path_copy, path);
212 fk = uw_begin(ctx, headers, path_copy); 214 fk = uw_begin(ctx, path_copy);
213 if (fk == SUCCESS) { 215 if (fk == SUCCESS) {
214 uw_write(ctx, "</html>"); 216 uw_write(ctx, "</html>");
215 217
216 if (uw_db_commit(ctx)) { 218 if (uw_db_commit(ctx)) {
217 fk = FATAL; 219 fk = FATAL;