You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
978 B

  1. package weed_server
  2. import (
  3. "net/http"
  4. "github.com/chrislusf/seaweedfs/weed/stats"
  5. )
  6. /*
  7. If volume server is started with a separated public port, the public port will
  8. be more "secure".
  9. Public port currently only supports reads.
  10. Later writes on public port can have one of the 3
  11. security settings:
  12. 1. not secured
  13. 2. secured by white list
  14. 3. secured by JWT(Json Web Token)
  15. */
  16. func (vs *VolumeServer) privateStoreHandler(w http.ResponseWriter, r *http.Request) {
  17. switch r.Method {
  18. case "GET", "HEAD":
  19. stats.ReadRequest()
  20. vs.GetOrHeadHandler(w, r)
  21. case "DELETE":
  22. stats.DeleteRequest()
  23. vs.guard.WhiteList(vs.DeleteHandler)(w, r)
  24. case "PUT", "POST":
  25. stats.WriteRequest()
  26. vs.guard.WhiteList(vs.PostHandler)(w, r)
  27. }
  28. }
  29. func (vs *VolumeServer) publicReadOnlyHandler(w http.ResponseWriter, r *http.Request) {
  30. switch r.Method {
  31. case "GET":
  32. stats.ReadRequest()
  33. vs.GetOrHeadHandler(w, r)
  34. case "HEAD":
  35. stats.ReadRequest()
  36. vs.GetOrHeadHandler(w, r)
  37. }
  38. }