diff --git a/httpd/httpd.c b/httpd/httpd.c index f87de897..04b65281 100644 --- a/httpd/httpd.c +++ b/httpd/httpd.c @@ -777,7 +777,23 @@ void handle_post(void) dbg_string("Multipart request\n"); } - if (is_word(request_path, "cmd")) { + if (s->tstate == TSTATE_MULTIPART || is_word(request_path, "upload") || is_word(request_path, "config")) { + dbg_string("POST upload/config request\n"); + if (!authenticated) { + send_unauthorized(); + return; + } + if (!boundary[0]) { + dbg_string("Bad request, no boundary!\n"); + send_bad_request(); + return; + } + if (config_upload) + handle_config_fragment(p); + else + handle_firmware_fragment(p); + return; + } else if (is_word(request_path, "cmd")) { p += 4; if (!authenticated) { send_unauthorized(); @@ -803,22 +819,6 @@ void handle_post(void) return; run_login_body(p); return; - } else if (s->tstate == TSTATE_MULTIPART || is_word(request_path, "upload") || is_word(request_path, "config")) { - dbg_string("POST upload/config request\n"); - if (!authenticated) { - send_unauthorized(); - return; - } - if (!boundary[0]) { - dbg_string("Bad request, no boundary!\n"); - send_bad_request(); - return; - } - if (config_upload) - handle_config_fragment(p); - else - handle_firmware_fragment(p); - return; } else { send_not_found(); return;