Mercurial > urweb
comparison src/c/driver.c @ 400:e756d3a47726
Fix a nasty driver bug, involving memory restarts and marked-up request strings
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Tue, 21 Oct 2008 13:54:48 -0400 |
parents | b91480c9a729 |
children | cc71fb7e5e54 |
comparison
equal
deleted
inserted
replaced
399:2d64457eedb1 | 400:e756d3a47726 |
---|---|
114 | 114 |
115 back += r; | 115 back += r; |
116 *back = 0; | 116 *back = 0; |
117 | 117 |
118 if (s = strstr(buf, "\r\n\r\n")) { | 118 if (s = strstr(buf, "\r\n\r\n")) { |
119 char *cmd, *path, *inputs; | 119 char *cmd, *path, path_copy[uw_bufsize+1], *inputs; |
120 | 120 |
121 *s = 0; | 121 *s = 0; |
122 | 122 |
123 printf("Read: %s\n", buf); | 123 printf("Read: %s\n", buf); |
124 | 124 |
173 | 173 |
174 uw_write(ctx, "HTTP/1.1 200 OK\r\n"); | 174 uw_write(ctx, "HTTP/1.1 200 OK\r\n"); |
175 uw_write(ctx, "Content-type: text/html\r\n\r\n"); | 175 uw_write(ctx, "Content-type: text/html\r\n\r\n"); |
176 uw_write(ctx, "<html>"); | 176 uw_write(ctx, "<html>"); |
177 | 177 |
178 fk = uw_begin(ctx, path); | 178 strcpy(path_copy, path); |
179 fk = uw_begin(ctx, path_copy); | |
179 if (fk == SUCCESS) { | 180 if (fk == SUCCESS) { |
180 uw_write(ctx, "</html>"); | 181 uw_write(ctx, "</html>"); |
181 break; | 182 break; |
182 } else if (fk == BOUNDED_RETRY) { | 183 } else if (fk == BOUNDED_RETRY) { |
183 if (retries_left) { | 184 if (retries_left) { |