BasiliskEngine / mongoose

Automatically exported from code.google.com/p/mongoose
MIT License
0 stars 0 forks source link

Unknown Error caused "POST" method while using mg as a library(static linked) #9

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. compile the following file named main.cpp with mg.h and mg.c
=================BEGIN====================
//-DNO_SSL compile on VC8.0 (winXP)
#include "mongoose.h"

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>

const char normal_header[] =
    "HTTP/1.1 200 OK\n"
    "Content-Type: text/html; charset=gb2312\n"
    "Server: crazyb0y's server\n"
    "Connection: close\n\n";
const char html_header[] = "<html><title>welcome</title><body>\n";
const char html_footer[] = "</body></html>\n";
static void index(struct mg_connection *conn, const struct mg_request_info
*ri, void *user_data) {
    mg_printf(conn, normal_header);
    mg_printf(conn, html_header);
    mg_printf(conn, "<form method=\"POST\" action=\"/index\">\n");
    mg_printf(conn, "<table><tr><td>user: </td><td><input type=text
name=handle size=10 style='font-family:monospace'></td></tr>\n");
    mg_printf(conn, "<tr><td>password</td><td><input type=password name=pass
size=10 style='font-family:monospace'></td></tr></table>\n");
    mg_printf(conn, "<input type=Submit value=\"login\" name=action>\n");
    mg_printf(conn, "</form>\n");
    mg_printf(conn, html_footer);
}

int main() {
    mg_context *ctx = mg_start();
    mg_set_option(ctx, "ports", "80");
    mg_set_option(ctx, "dir_list", "no");
    mg_bind_to_uri(ctx, "/", &index, NULL);
    mg_bind_to_uri(ctx, "/index", &index, NULL);
    printf("started\n");
    system("pause");
    mg_stop(ctx);
}
=================END====================
2. open http://localhost/ with a browser (tested on firefox 3.0.5 and IE
7.0 winXP)
3. type anything and click login

What is the expected output? What do you see instead?
the original page, same as previous
##Error 577: Internal Server Error
##Error handling body data

What version of the product are you using? On what operating system?
the lastest, WinXP

Please provide any additional information below.

I traced into the library, and find it's caused in line 2999

hope you could solve this problem as quick as possible, I removed several
lines and works now.

Original issue reported on code.google.com by boblinu...@gmail.com on 18 Dec 2008 at 12:41

GoogleCodeExporter commented 8 years ago
Bug in handle_request_body(), fixed.
Thanks!

Original comment by valenok on 18 Dec 2008 at 1:26