@cryptotaxi247 / netdata-1 / commits / e73447a30

fix for http 307

Costa Tsaousis (ktsaou) committed Mar 27, 2014 at 03:57 UTC e73447a300827920590c406ffb6cd065cb2e61ed
2 files changed +17 -2
netdata.c
+9 -2
@@ -962,7 +962,7 @@ int mysendfile(struct web_client *w, char *filename)
962
963 if(errno == EBUSY || errno == EAGAIN) {
964 error("%llu: File '%s' is busy, sending 307 Moved Temporarily to force retry.", w->id, filename);
965 - sprintf(w->response_header, "Location: %s\r\n", filename);
965 + sprintf(w->response_header, "Location: " WEB_PATH_FILE "/%s\r\n", filename);
966 w->data->bytes = sprintf(w->data->buffer, "The file '%s' is currently busy. Please try again later.", filename);
967 return 307;
968 }
@@ -1246,7 +1246,11 @@ void web_client_process(struct web_client *w)
1246 struct tm tm = *gmtime(&w->data->date);
1247 strftime(date, sizeof(date), "%a, %d %b %Y %H:%M:%S %Z", &tm);
1248
1249 - size_t headerlen = strlen(w->response_header);
1249 + char custom_header[MAX_HTTP_HEADER_SIZE + 1] = "";
1250 + if(w->response_header[0])
1251 + strcpy(custom_header, w->response_header);
1252 +
1253 + size_t headerlen = 0;
1254 headerlen += sprintf(&w->response_header[headerlen],
1255 "HTTP/1.1 %d %s\r\n"
1256 "Connection: %s\r\n"
@@ -1260,6 +1264,9 @@ void web_client_process(struct web_client *w)
1264 , date
1265 );
1266
1267 + if(custom_header[0])
1268 + headerlen += sprintf(&w->response_header[headerlen], "%s", custom_header);
1269 +
1270 if(w->mode == WEB_CLIENT_MODE_NORMAL) {
1271 headerlen += sprintf(&w->response_header[headerlen],
1272 "Expires: %s\r\n"
web/all.xsl
+8
@@ -15,6 +15,13 @@
15 <script type="text/javascript" src="netdata.js"></script>
16 <script type="text/javascript">
17
18 + <!--
19 + <xsl:variable name="unique-list" select="//graph/type[not(.=following::type)]" />
20 + <xsl:for-each select="$unique-list">
21 + alert('<xsl:value-of select="." />');
22 + </xsl:for-each>
23 + -->
24 +
25 // Set a callback to run when the Google Visualization API is loaded.
26 google.setOnLoadCallback(drawCharts);
27
@@ -50,6 +57,7 @@
57 </div>
58 </div>
59 </xsl:for-each>
60 +
61 </body>
62 </html>
63 </xsl:template>