|
@@ -1608,7 +1608,10 @@ func (sc *serverConn) processData(f *DataFrame) error {
|
|
|
// Sender sending more than they'd declared?
|
|
// Sender sending more than they'd declared?
|
|
|
if st.declBodyBytes != -1 && st.bodyBytes+int64(len(data)) > st.declBodyBytes {
|
|
if st.declBodyBytes != -1 && st.bodyBytes+int64(len(data)) > st.declBodyBytes {
|
|
|
st.body.CloseWithError(fmt.Errorf("sender tried to send more than declared Content-Length of %d bytes", st.declBodyBytes))
|
|
st.body.CloseWithError(fmt.Errorf("sender tried to send more than declared Content-Length of %d bytes", st.declBodyBytes))
|
|
|
- return streamError(id, ErrCodeStreamClosed)
|
|
|
|
|
|
|
+ // RFC 7540, sec 8.1.2.6: A request or response is also malformed if the
|
|
|
|
|
+ // value of a content-length header field does not equal the sum of the
|
|
|
|
|
+ // DATA frame payload lengths that form the body.
|
|
|
|
|
+ return streamError(id, ErrCodeProtocol)
|
|
|
}
|
|
}
|
|
|
if f.Length > 0 {
|
|
if f.Length > 0 {
|
|
|
// Check whether the client has flow control quota.
|
|
// Check whether the client has flow control quota.
|