~ubuntu-branches/ubuntu/raring/ntop/raring-proposed

« back to all changes in this revision

Viewing changes to httpd.c

  • Committer: Package Import Robot
  • Author(s): Ludovico Cavedon
  • Date: 2012-06-27 00:24:42 UTC
  • mfrom: (1.1.7)
  • Revision ID: package-import@ubuntu.com-20120627002442-9ljq6fhjqzx9qsu6
Tags: 3:4.99.3+ndpi5517+dfsg1-1
* Imported Upstream version 4.99.3 and nDPI r5517.
* get-orig-source.sh: incude nDPI in the orig tarball.
* No longer suggest ntop-graphs and update NEWS about that.
* Update copyright for the new jqPlot library.
* Refresh patches.
* Enable hardening flags.
* Add install-jqplot.patch to install jqPlot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1108
1108
 
1109
1109
        compressFileFd = gzopen(compressedFilePath, "wb");
1110
1110
        if(0) traceEvent(CONST_TRACE_INFO, "gzopen(%s)=%p", compressedFilePath, compressFileFd);
 
1111
 
 
1112
        /* traceEvent(CONST_TRACE_ERROR, "[SSL] [%d] %s", theString[0], theString); */
1111
1113
      }
1112
1114
 
1113
1115
      if(gzwrite(compressFileFd, theString, len) == 0) {
1207
1209
 
1208
1210
void sendJSLibraries(int graph_mode) {
1209
1211
 
1210
 
  if(graph_mode) {
 
1212
  /* Damn Internet explorer... */
 
1213
  // sendString("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\">\n");
 
1214
 
 
1215
 
 
1216
  //  if(graph_mode) {
 
1217
 
 
1218
  sendString("<!--[if lt IE 9]><script language=\"javascript\" type=\"text/javascript\" src=\"/jqplot/excanvas.min.js\"></script><![endif]-->\n");
 
1219
 
1211
1220
    /* JQuery */
1212
1221
    sendString("<script type=\"text/javascript\" src=\"/jquery-1.7.min.js\"></script>\n");
1213
 
    /* Highcharts */
1214
 
    sendString("<script type=\"text/javascript\" src=\"/highcharts.js\"></script>\n");
1215
 
    sendString("<script type=\"text/javascript\" src=\"/exporting.js\"></script>\n");
1216
 
  } else {
 
1222
    /* www.jqplot.com */
 
1223
    sendString("<script type=\"text/javascript\" src=\"/jqplot/jquery.jqplot.min.js\"></script>\n");
 
1224
    sendString("<script type=\"text/javascript\" src=\"/jqplot/plugins/jqplot.pieRenderer.min.js\"></script>\n");
 
1225
    sendString("<script type=\"text/javascript\" src=\"/jqplot/plugins/jqplot.barRenderer.min.js\"></script>\n");
 
1226
    sendString("<script type=\"text/javascript\" src=\"/jqplot/plugins/jqplot.meterGaugeRenderer.min.js\"></script>\n");
 
1227
    sendString("<script type=\"text/javascript\" src=\"/jqplot/plugins/jqplot.categoryAxisRenderer.min.js\"></script>\n");
 
1228
    sendString("<script type=\"text/javascript\" src=\"/jqplot/plugins/jqplot.pointLabels.min.js\"></script>\n");
 
1229
    sendString("<link rel=\"stylesheet\" type=\"text/css\" href=\"/jqplot/jquery.jqplot.css\" />\n");
 
1230
    //  } else {
1217
1231
    sendString("<script type=\"text/javascript\" src=\"/reflection.js\"></script>\n");
1218
1232
    sendString("<script TYPE=\"text/javascript\" src=\"/functions.js\"></script>\n");
1219
1233
    sendString("<script type=\"text/javascript\" src=\"/domLib.js\"></script>\n");
1220
1234
    sendString("<script type=\"text/javascript\" src=\"/domTT.js\"></script>\n");
1221
1235
    sendString("<script type=\"text/javascript\">var domTT_styleClass = 'niceTitle';</script>\n");
1222
1236
    /* JQuery */
1223
 
    sendString("<script type=\"text/javascript\" src=\"/jquery-1.7.min.js\"></script>\n");
 
1237
    //sendString("<script type=\"text/javascript\" src=\"/jquery-1.7.min.js\"></script>\n");
1224
1238
    sendString("<link rel=\"stylesheet\" href=\"jquery-ui-1.8.16.custom.css\">\n");
1225
1239
    /* JQuery UI */
1226
1240
    sendString("<script type=\"text/javascript\" src=\"/jquery-ui-1.8.16.custom.min.js\"></script>\n");    
1227
 
  }
 
1241
    //  }
1228
1242
 
1229
1243
  sendString("<script type=\"text/javascript\" src=\"http://maps.googleapis.com/maps/api/js?sensor=false\"></script>\n");
1230
1244
}
1236
1250
 
1237
1251
  if(htmlTitle != NULL) theTitle = htmlTitle; else theTitle = title;
1238
1252
 
 
1253
  sendString("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" http://www.w3.org/TR/html4/loose.dtd\"> ");
 
1254
 
1239
1255
  if(0) sendString((myGlobals.runningPref.w3c == TRUE) ? CONST_W3C_DOCTYPE_LINE "\n" : "\n"); /* FIX */
1240
1256
  sendString("<HTML>\n<HEAD>\n");
1241
1257
  if(0) sendString((myGlobals.runningPref.w3c == TRUE) ? CONST_W3C_CHARTYPE_LINE "\n" : "\n"); /* FIX */
1257
1273
 
1258
1274
  sendString("<META HTTP-EQUIV=Pragma CONTENT=no-cache>\n");
1259
1275
  sendString("<META HTTP-EQUIV=Cache-Control CONTENT=no-cache>\n");
 
1276
 
 
1277
  /* sendString("<link rel=\"alternate\" type=\"application/rss+xml\" title=\"ntop\" href=\"/rss.xml\">"); */
 
1278
 
 
1279
  sendJSLibraries(0);
 
1280
 
1260
1281
  if((headerFlags & BITFLAG_HTML_NO_STYLESHEET) == 0) {
1261
1282
    sendString("<LINK REL=stylesheet HREF=\"/style.css\" type=\"text/css\">\n");
1262
1283
  }
1263
1284
 
1264
 
  /* sendString("<link rel=\"alternate\" type=\"application/rss+xml\" title=\"ntop\" href=\"/rss.xml\">"); */
1265
 
 
1266
 
  sendJSLibraries(0);
1267
 
 
1268
1285
  /* ******************************************************* */
1269
 
  /*there should be no need to include the style again*/
1270
 
  /*sendString("<link rel=\"stylesheet\" href=\"/style.css\" TYPE=\"text/css\">\n");*/
 
1286
 
1271
1287
  ssiMenu_Head();
1272
1288
  sendString("</head>");
1273
1289
 
1747
1763
      compressFile = 1;
1748
1764
  }
1749
1765
 
 
1766
#if 1
1750
1767
  if((headerFlags & BITFLAG_HTTP_MORE_FIELDS) == 0) {
1751
1768
    sendString("\r\n");
1752
1769
  }
 
1770
#endif
1753
1771
}
1754
1772
 
1755
1773
/* ************************* */
2404
2422
#endif
2405
2423
 
2406
2424
  if(fd != NULL) {
2407
 
    char theDate[48],
2408
 
      *buffer;
 
2425
    char theDate[48], *buffer;
2409
2426
    time_t theTime;
2410
2427
    int sz, len = strlen(pageURI), mimeType = FLAG_HTTP_TYPE_HTML;
2411
 
 
 
2428
    
2412
2429
    if(len > 4) {
2413
2430
      if(strcasecmp(&pageURI[len-4], ".gif") == 0)
2414
2431
        mimeType = FLAG_HTTP_TYPE_GIF;
2947
2964
        sendHTTPHeader(FLAG_HTTP_TYPE_HTML, 0, 1);
2948
2965
        drawHostsDistanceGraph(0);
2949
2966
        printTrailer=0;
 
2967
      } else if(strncasecmp(pageName, CONST_THROUGHPUT_METER,
 
2968
                            strlen(CONST_THROUGHPUT_METER)) == 0) {
 
2969
        sendHTTPHeader(FLAG_HTTP_TYPE_HTML, 0, 1);
 
2970
        drawThroughputMeter();
 
2971
        printTrailer=0;
2950
2972
      } else if((strncasecmp(pageName,    CONST_HOST_TRAFFIC_DISTR_HTML,
2951
2973
                             strlen(CONST_HOST_TRAFFIC_DISTR_HTML)) == 0)
2952
2974
                || (strncasecmp(pageName, CONST_HOST_FRAGMENT_DISTR_HTML, 
3447
3469
  }
3448
3470
  fclose(fd);
3449
3471
 
 
3472
  // traceEvent(CONST_TRACE_ERROR, "[SSL] %s", compressedFilePath);
 
3473
 
3450
3474
  unlink(compressedFilePath);
3451
3475
}
3452
3476