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.

53 lines
1.1 KiB

  1. package weed_server
  2. import (
  3. "net/http"
  4. "github.com/chrislusf/seaweedfs/go/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":
  19. stats.ReadRequest()
  20. vs.GetOrHeadHandler(w, r)
  21. case "HEAD":
  22. stats.ReadRequest()
  23. vs.GetOrHeadHandler(w, r)
  24. case "DELETE":
  25. stats.DeleteRequest()
  26. vs.guard.WhiteList(vs.DeleteHandler)(w, r)
  27. case "PUT":
  28. stats.WriteRequest()
  29. vs.guard.WhiteList(vs.PostHandler)(w, r)
  30. case "POST":
  31. stats.WriteRequest()
  32. vs.guard.WhiteList(vs.PostHandler)(w, r)
  33. }
  34. }
  35. func (vs *VolumeServer) publicReadOnlyHandler(w http.ResponseWriter, r *http.Request) {
  36. switch r.Method {
  37. case "GET":
  38. stats.ReadRequest()
  39. vs.GetOrHeadHandler(w, r)
  40. case "HEAD":
  41. stats.ReadRequest()
  42. vs.GetOrHeadHandler(w, r)
  43. }
  44. }