not check content-type

master
dingjun 4 years ago
parent 934f6fed2a
commit 4eaa46ff45

@ -3,7 +3,6 @@ package main
import ( import (
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"strings"
"github.com/fangdingjun/go-log" "github.com/fangdingjun/go-log"
"github.com/miekg/dns" "github.com/miekg/dns"
@ -12,12 +11,14 @@ import (
const dnsMsgType = "application/dns-message" const dnsMsgType = "application/dns-message"
func (srv *server) handleHTTPReq(w http.ResponseWriter, r *http.Request) { func (srv *server) handleHTTPReq(w http.ResponseWriter, r *http.Request) {
/*
ctype := r.Header.Get("content-type") ctype := r.Header.Get("content-type")
if !strings.HasPrefix(ctype, dnsMsgType) { if !strings.HasPrefix(ctype, dnsMsgType) {
log.Errorf("request type %s, require %s", ctype, dnsMsgType) log.Errorf("request type %s, require %s", ctype, dnsMsgType)
http.Error(w, "dns message is required", http.StatusBadRequest) http.Error(w, "dns message is required", http.StatusBadRequest)
return return
} }
*/
if r.ContentLength < 10 { if r.ContentLength < 10 {
log.Errorf("message is too small, %v", r.ContentLength) log.Errorf("message is too small, %v", r.ContentLength)

Loading…
Cancel
Save