static void httpd_client_process(struct client_info *cinfo) { struct http_req hreq; int err; char httpd_inbuf[BUFF_SZ]; char httpd_outbuf[BUFF_SZ]; if (0 > (err = httpd_build_request(cinfo, &hreq, httpd_inbuf, sizeof(httpd_inbuf)))) { httpd_error("can't build request: %s", strerror(-err)); } httpd_debug("method=%s uri_target=%s uri_query=%s", hreq.method, hreq.uri.target, hreq.uri.query); if (httpd_try_respond_file(cinfo, &hreq, httpd_outbuf, sizeof(httpd_outbuf))) { /* file sent, nothing to do */ } else { httpd_header(cinfo, 404, ""); } }
static void httpd_client_process(struct client_info *cinfo) { struct http_req hreq; pid_t cgi_child; int err; if ((err = httpd_build_request(cinfo, &hreq, httpd_g_inbuf, sizeof(httpd_g_inbuf)))) { httpd_error("can't build request: %s", strerror(-err)); } httpd_debug("method=%s uri_target=%s uri_query=%s", hreq.method, hreq.uri.target, hreq.uri.query); if ((cgi_child = httpd_try_respond_script(cinfo, &hreq))) { httpd_on_cgi_child(cinfo, cgi_child); } else if (USE_REAL_CMD && (cgi_child = httpd_try_respond_cmd(cinfo, &hreq))) { httpd_on_cgi_child(cinfo, cgi_child); } else if (httpd_try_respond_file(cinfo, &hreq, httpd_g_outbuf, sizeof(httpd_g_outbuf))) { /* file sent, nothing to do */ } else { httpd_header(cinfo, 404, ""); } }