From: Andreas Ă–man Date: Mon, 20 Jul 2009 06:23:38 +0000 (+0000) Subject: * The embedded HTTP server now logs failed requests X-Git-Tag: 2.12~560 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8611dbcb5b7c27ccd6c355d6beaa8053fccbda7a;p=thirdparty%2Ftvheadend.git * The embedded HTTP server now logs failed requests --- diff --git a/src/http.c b/src/http.c index e7d6944f1..23eb92f9f 100644 --- a/src/http.c +++ b/src/http.c @@ -240,6 +240,9 @@ http_error(http_connection_t *hc, int error) { const char *errtxt = http_rc2str(error); + tvhlog(LOG_ERR, "HTTP", "%s: %s -- %d", + inet_ntoa(hc->hc_peer->sin_addr), hc->hc_url, error); + htsbuf_queue_flush(&hc->hc_reply); htsbuf_qprintf(&hc->hc_reply, @@ -316,12 +319,13 @@ static void http_exec(http_connection_t *hc, http_path_t *hp, char *remain) { int err; - if(http_access_verify(hc, hp->hp_accessmask)) { - http_error(hc, HTTP_STATUS_UNAUTHORIZED); - return; - } - if((err = hp->hp_callback(hc, remain, hp->hp_opaque)) != 0) + if(http_access_verify(hc, hp->hp_accessmask)) + err = HTTP_STATUS_UNAUTHORIZED; + else + err = hp->hp_callback(hc, remain, hp->hp_opaque); + + if(err) http_error(hc, err); }