| ) | ) | ||||
| func crmcache(w http.ResponseWriter, r *http.Request) { | func crmcache(w http.ResponseWriter, r *http.Request) { | ||||
| debugDumpHTTPRequest(r) | |||||
| //debugDumpHTTPRequest(r) | |||||
| if !checkSignatureByToken(r, IntraAPIConfig.CRMSecrete) { | if !checkSignatureByToken(r, IntraAPIConfig.CRMSecrete) { | ||||
| w.WriteHeader(http.StatusUnauthorized) | w.WriteHeader(http.StatusUnauthorized) | ||||
| fmt.Fprintf(w, "Expired or invalid link") | fmt.Fprintf(w, "Expired or invalid link") | ||||
| if err != nil { | if err != nil { | ||||
| w.WriteHeader(http.StatusNotFound) | w.WriteHeader(http.StatusNotFound) | ||||
| fmt.Fprintf(w, "reference number is not right") | fmt.Fprintf(w, "reference number is not right") | ||||
| return | |||||
| } | |||||
| if isFileExist(path) { | |||||
| http.ServeFile(w, r, path) | |||||
| return | |||||
| } | } | ||||
| w.WriteHeader(http.StatusInternalServerError) | w.WriteHeader(http.StatusInternalServerError) | ||||
| fmt.Fprintf(w, "cannot build reference cache") | fmt.Fprintf(w, "cannot build reference cache") | ||||
| } | } |