]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
* The embedded HTTP server now logs failed requests
authorAndreas Öman <andreas@lonelycoder.com>
Mon, 20 Jul 2009 06:23:38 +0000 (06:23 +0000)
committerAndreas Öman <andreas@lonelycoder.com>
Mon, 20 Jul 2009 06:23:38 +0000 (06:23 +0000)
src/http.c

index e7d6944f1f7a477b9689ac64b509cfa755b107ac..23eb92f9f671f016fef20206ef4a7c81424d88e1 100644 (file)
@@ -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);
 }