Hi guys,

any reason why the code to generate a <TITLE> is commented out
in printHTMLheader()?

I would like to trigger a 404 error if we cannot generate a page.
The following patch would enable that.

Comments?

// Dennis
Index: http.c
===================================================================
RCS file: /export/home/ntop/ntop/http.c,v
retrieving revision 2.56
diff -u -r2.56 http.c
--- http.c      2002/05/15 07:23:36     2.56
+++ http.c      2002/05/28 13:05:50
@@ -502,17 +502,14 @@
 
   sendString("<HTML>\n<HEAD>\n");
 
-  /*
   if(title != NULL) {
     if(snprintf(buf, BUF_SIZE, "<TITLE>%s</TITLE>\n", title) < 0)
     BufferTooShort();
     sendString(buf);
   }
-  */
 
   if((headerFlags & HTML_FLAG_NO_REFRESH) == 0) {
-    if(snprintf(buf, BUF_SIZE, "<META HTTP-EQUIV=REFRESH CONTENT=%d>\n",
-               myGlobals.refreshRate) < 0)
+    if(snprintf(buf, BUF_SIZE, "<META HTTP-EQUIV=REFRESH CONTENT=%d>\n", 
+myGlobals.refreshRate) < 0)
       BufferTooShort();
     sendString(buf);
   }
Index: report.c
===================================================================
RCS file: /export/home/ntop/ntop/report.c,v
retrieving revision 2.55
diff -u -r2.55 report.c
--- report.c    2002/05/28 07:50:41     2.55
+++ report.c    2002/05/28 13:05:51
@@ -1449,11 +1449,20 @@
     }
   }
 
+  /* Dennis Schoen ([EMAIL PROTECTED])
+   *
+   * send 404 if we cannot generate the requested page
+   *
+  */
   if((el == NULL) || (!found)) {
-    if(snprintf(buf, sizeof(buf),
-               "Unable to generate the page requested [%s]\n", host) < 0)
+    if(snprintf(buf, sizeof(buf), "404 Not Found", host) < 0)
       BufferTooShort();
-    printHTMLheader(buf, 0);
+    printHTMLheader(buf, HTML_FLAG_NO_REFRESH | HTML_FLAG_NO_HEADING);
+
+    if(snprintf(buf, sizeof(buf), "<B>Not found</B><BR>Unable to generate the 
+requested page") < 0)
+      BufferTooShort();
+    sendString(buf);
+
     return;
   }
 

Reply via email to