http reverse-proxy handler, to handle unmodified requests (not to confuse with p.rproxy)
(w http.ResponseWriter, r *http.Request)
| 2770 | // http reverse-proxy handler, to handle unmodified requests |
| 2771 | // (not to confuse with p.rproxy) |
| 2772 | func (p *proxy) httpCloudHandler(w http.ResponseWriter, r *http.Request) { |
| 2773 | if !p.ClusterStartedWithRetry() { |
| 2774 | w.WriteHeader(http.StatusServiceUnavailable) |
| 2775 | return |
| 2776 | } |
| 2777 | if r.URL.Scheme == "" { |
| 2778 | p.writeErrURL(w, r) |
| 2779 | return |
| 2780 | } |
| 2781 | baseURL := r.URL.Scheme + "://" + r.URL.Host |
| 2782 | if glog.FastV(4, glog.SmoduleAIS) { |
| 2783 | glog.Infof("[HTTP CLOUD] RevProxy handler for: %s -> %s", baseURL, r.URL.Path) |
| 2784 | } |
| 2785 | if r.Method == http.MethodGet || r.Method == http.MethodHead { |
| 2786 | // bck.IsHTTP() |
| 2787 | hbo := cmn.NewHTTPObj(r.URL) |
| 2788 | q := r.URL.Query() |
| 2789 | q.Set(apc.QparamOrigURL, r.URL.String()) |
| 2790 | q.Set(apc.QparamProvider, apc.ProviderHTTP) |
| 2791 | r.URL.Path = apc.URLPathObjects.Join(hbo.Bck.Name, hbo.ObjName) |
| 2792 | r.URL.RawQuery = q.Encode() |
| 2793 | if r.Method == http.MethodGet { |
| 2794 | p.httpobjget(w, r, hbo.OrigURLBck) |
| 2795 | } else { |
| 2796 | p.httpobjhead(w, r, hbo.OrigURLBck) |
| 2797 | } |
| 2798 | return |
| 2799 | } |
| 2800 | p.writeErrf(w, r, "%q provider doesn't support %q", apc.ProviderHTTP, r.Method) |
| 2801 | } |
| 2802 | |
| 2803 | ///////////////// |
| 2804 | // METASYNC RX // |
nothing calls this directly
no test coverage detected