Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
GoogleCodeExporter opened this issue Nov 13, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

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
Copy link
Author

Bug in handle_request_body(), fixed.
Thanks!

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

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant