summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2012-09-21 17:02:42 +0200
committerPacien2015-12-07 22:48:24 +0100
commitf7d690f312e64372166f97472214219283999cea (patch)
tree925752b594eba0347066938b768fa5523c93e302 /src
parentc188634ef6220aa372bece624f6c29fa8aa90cd9 (diff)
downloadninja-go-local-cloud-f7d690f312e64372166f97472214219283999cea.tar.gz
Add header to disable browser caching.
Diffstat (limited to 'src')
-rw-r--r--src/ninjacloud.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/ninjacloud.go b/src/ninjacloud.go
index 984f6a9..326834c 100644
--- a/src/ninjacloud.go
+++ b/src/ninjacloud.go
@@ -290,6 +290,7 @@ func osPath(p string) string {
290//// File APIs 290//// File APIs
291 291
292func fileHandler(w http.ResponseWriter, r *http.Request) { 292func fileHandler(w http.ResponseWriter, r *http.Request) {
293 w.Header().Add("Cache-Control", "no-cache")
293 p := osPath(r.URL.Path[filePathLen:]) 294 p := osPath(r.URL.Path[filePathLen:])
294 if !isInRoot(p) { 295 if !isInRoot(p) {
295 w.WriteHeader(http.StatusForbidden) 296 w.WriteHeader(http.StatusForbidden)
@@ -454,6 +455,7 @@ func fileHandler(w http.ResponseWriter, r *http.Request) {
454//// Directory APIs 455//// Directory APIs
455 456
456func dirHandler(w http.ResponseWriter, r *http.Request) { 457func dirHandler(w http.ResponseWriter, r *http.Request) {
458 w.Header().Add("Cache-Control", "no-cache")
457 p := osPath(r.URL.Path[dirPathLen:]) 459 p := osPath(r.URL.Path[dirPathLen:])
458 if !isInRoot(p) { 460 if !isInRoot(p) {
459 w.WriteHeader(http.StatusForbidden) 461 w.WriteHeader(http.StatusForbidden)
@@ -607,6 +609,7 @@ func getDataHandler(w http.ResponseWriter, r *http.Request) {
607 609
608// Get the cloud status JSON 610// Get the cloud status JSON
609func getStatusHandler(w http.ResponseWriter, r *http.Request) { 611func getStatusHandler(w http.ResponseWriter, r *http.Request) {
612 w.Header().Add("Cache-Control", "no-cache")
610 cloudStatus := map[string]string{ 613 cloudStatus := map[string]string{
611 "name": APP_NAME, 614 "name": APP_NAME,
612 "version": APP_VERSION, 615 "version": APP_VERSION,