diff --git a/src/civetweb.c b/src/civetweb.c index 7fcde6d2..d78b504c 100644 --- a/src/civetweb.c +++ b/src/civetweb.c @@ -6320,8 +6320,8 @@ static void handle_request(struct mg_connection *conn) return; } /* 13.3. everything but GET and HEAD (e.g. POST) */ - if (!strcmp(ri->request_method, "GET") && - !strcmp(ri->request_method, "HEAD")) { + if (0!=strcmp(ri->request_method, "GET") && + 0!=strcmp(ri->request_method, "HEAD")) { send_http_error(conn, 405, NULL, "%s method not allowed", conn->request_info.request_method); return; diff --git a/test/MethodTest.xhtml b/test/MethodTest.xhtml index 3adef8b6..a6aa2738 100644 --- a/test/MethodTest.xhtml +++ b/test/MethodTest.xhtml @@ -25,10 +25,14 @@ function load() { var params = getParams(); - method = params["method"]; + var method = params["method"]; if (!method) { method = "GET"; } + var path = params["path"]; + if (!path) { + path = ""; + } var elem = document.getElementById('h1'); elem.innerHTML = "HTTP method test page"; @@ -36,7 +40,7 @@ document.getElementById("proto_http").checked = (window.location.protocol != "https:"); document.getElementById("proto_https").checked = (window.location.protocol == "https:"); document.getElementById("server").value = location.host; - document.getElementById("resource").value = "path"; + document.getElementById("resource").value = path; document.getElementById("method_get").checked = true; document.getElementById("body_none").checked = true; @@ -82,7 +86,10 @@ { var laddr = addr var lmeth = meth - var blen = "\nWith " + body.length + " bytes body data" + var blen = "" + if (body) { + blen = "\nWith " + body.length + " bytes body data" + } if (xmlhttp.readyState == 4) { @@ -133,8 +140,8 @@ TODO: Description how to use this page. *INVALID*

Body data

-*none*
-1234567890
+0 Bytes
+10 Bytes ("1234567890")

Submit