MCPcopy Create free account
hub / github.com/celzero/midway / getHandler

Method getHandler

midway/dns.go:87–103  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

85}
86
87func (s *dohstub) getHandler(w http.ResponseWriter, r *http.Request) {
88 b64, ok := r.URL.Query()["dns"]
89 if !ok {
90 http.Error(w, "query missing", http.StatusBadRequest)
91 return
92 }
93 if len(b64) < 1 {
94 http.Error(w, "query empty", http.StatusBadRequest)
95 return
96 }
97 b, err := base64.RawURLEncoding.DecodeString(b64[0])
98 if err != nil {
99 http.Error(w, err.Error(), http.StatusBadRequest)
100 return
101 }
102 s.upstreamDNS(b, w, r)
103}
104
105func (s *dohstub) postHandler(w http.ResponseWriter, r *http.Request) {
106 b, err := ioutil.ReadAll(r.Body)

Callers 1

DohHandlerMethod · 0.95

Calls 1

upstreamDNSMethod · 0.95

Tested by

no test coverage detected