$Log$
+Revision 619.27 2005/07/19 17:05:23 ajc
+* Removed the last couple of places where forms were submitted using
+ the GET method. POST is just so technologically cleaner that we should
+ use it all the time.
+* Fixed a bug in the MIME parser that was causing it to not be 8-bit
+ clean.
+
Revision 619.26 2005/07/19 14:23:04 ajc
* mime_parser.c: don't default Content-type: to text/plain, because when
an HTTP POST operation is performed, the content type is expected to
1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
* webserver.c: warning fix
+
* Any other (invalid) command causes the form to be displayed
*/
else {
-FORM: wprintf("<FORM METHOD=\"GET\" ACTION=\"/listsub\">\n"
+FORM: wprintf("<FORM METHOD=\"POST\" ACTION=\"/listsub\">\n"
"<TABLE BORDER=0>\n"
);
#include <errno.h>
#include "webcit.h"
+#include "webserver.h"
#include "mime_parser.h"
{
char *ptr;
+ char *srch = NULL;
char *part_start, *part_end = NULL;
char buf[SIZ];
char *header;
char *boundary;
char *startary;
+ size_t startary_len = 0;
char *endary;
char *next_boundary;
char *content_type;
/* Figure out where the boundaries are */
snprintf(startary, SIZ, "--%s", boundary);
snprintf(endary, SIZ, "--%s--", boundary);
+ startary_len = strlen(startary);
part_start = NULL;
do {
- next_boundary = bmstrstr(ptr, startary, strncmp);
+
+ /* next_boundary = bmstrstr(ptr, startary, memcmp); */
+ next_boundary = NULL;
+ for (srch=ptr; srch<content_end; ++srch) {
+ if (!memcmp(srch, startary, startary_len)) {
+ next_boundary = srch;
+ srch = content_end;
+ }
+ }
+
if ( (part_start != NULL) && (next_boundary != NULL) ) {
part_end = next_boundary;
--part_end;
}
if (next_boundary != NULL) {
- /* If we pass out of scope, don't attempt to read
- * past the end boundary. */
+ /* If we pass out of scope, don't attempt to
+ * read past the end boundary. */
if (!strcmp(next_boundary, endary)) {
ptr = content_end;
}
wprintf("so you don't have to keep returning here.\n");
wprintf("<br /><br />");
- wprintf("<FORM METHOD=\"GET\" ACTION=\"/goto_private\">\n");
+ wprintf("<FORM METHOD=\"POST\" ACTION=\"/goto_private\">\n");
wprintf("<table border=\"0\" cellspacing=\"5\" "
"cellpadding=\"5\" BGCOLOR=\"#EEEEEE\">\n"
wprintf("disappear from your room list. Is this what you wish ");
wprintf("to do?<br />\n");
- wprintf("<FORM METHOD=\"GET\" ACTION=\"/zap\">\n");
+ wprintf("<FORM METHOD=\"POST\" ACTION=\"/zap\">\n");
wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
wprintf(" ");
wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
{
struct urlcontent *u;
+ lprintf(9, "upload_handler() name=%s, type=%s, len=%d\n",
+ name, cbtype, length);
+
/* Form fields */
if ( (length > 0) && (strlen(cbtype) == 0) ) {
u = (struct urlcontent *) malloc(sizeof(struct urlcontent));