mirror of
https://github.com/PeernetOfficial/core.git
synced 2026-07-17 02:47:51 +01:00
webapi: /file/view add parameter 'nocache' to force download from remote peer. This is useful for testing purposes.
This commit is contained in:
@@ -170,6 +170,7 @@ func apiFileView(w http.ResponseWriter, r *http.Request) {
|
||||
offset, _ := strconv.Atoi(r.Form.Get("offset"))
|
||||
limit, _ := strconv.Atoi(r.Form.Get("limit"))
|
||||
format, _ := strconv.Atoi(r.Form.Get("format"))
|
||||
localCacheDisable, _ := strconv.ParseBool(r.Form.Get("nocache"))
|
||||
|
||||
// Range header?
|
||||
var ranges []HTTPRange
|
||||
@@ -192,8 +193,10 @@ func apiFileView(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
// Is the file available in the local warehouse? In that case requesting it from the remote is unnecessary.
|
||||
if serveFileFromWarehouse(w, fileHash, uint64(offset), uint64(limit), ranges) {
|
||||
return
|
||||
if !localCacheDisable {
|
||||
if serveFileFromWarehouse(w, fileHash, uint64(offset), uint64(limit), ranges) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// try connecting via node ID or peer ID?
|
||||
|
||||
Reference in New Issue
Block a user