diff options
author | clsr <clsr@clsr.net> | 2017-08-22 14:33:57 +0200 |
---|---|---|
committer | clsr <clsr@clsr.net> | 2017-08-22 14:33:57 +0200 |
commit | ba217ddeef9c6cd502a6f150bf59cf3ce329cc61 (patch) | |
tree | e1a6f6bbe3f6ba9dda9dd7388bedc015dc6dfa63 /server.go | |
parent | da77deba78c8a7447b4a38324d2422a5df293b26 (diff) | |
download | cnp-go-ba217ddeef9c6cd502a6f150bf59cf3ce329cc61.tar.gz cnp-go-ba217ddeef9c6cd502a6f150bf59cf3ce329cc61.zip |
Check errors before accessing possibly-nil request fieldsv0.1.1
Diffstat (limited to 'server.go')
-rw-r--r-- | server.go | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -122,7 +122,6 @@ func (srv *Server) HandleConn(conn net.Conn) { }() req, err := ParseRequest(conn) - req.Body = io.LimitReader(req.Body, req.Length()) if err != nil { if e, ok := err.(Error); ok { resp, _ := NewResponse(IntentError, nil) @@ -133,6 +132,8 @@ func (srv *Server) HandleConn(conn net.Conn) { panic(err) } + req.Body = io.LimitReader(req.Body, req.Length()) + if srv.Validate { err = req.Validate() if err != nil { |