Merge pull request #1787 from scottf/stream-headers-colon-no-space

stream handle headers with no space after colon
This commit is contained in:
Ivan Kozlovic
2021-01-04 09:18:02 -07:00
committed by GitHub

View File

@@ -878,12 +878,19 @@ func getHdrVal(key string, hdr []byte) []byte {
if index < 0 { if index < 0 {
return nil return nil
} }
var value []byte var value []byte
for i := index + len(key) + 2; i > 0 && i < len(hdr); i++ { hdrLen := len(hdr)
if hdr[i] == '\r' && i < len(hdr)-1 && hdr[i+1] == '\n' { index += len(key) + 1
for hdr[index] == ' ' && index < hdrLen {
index++
}
for index < hdrLen {
if hdr[index] == '\r' && index < hdrLen-1 && hdr[index+1] == '\n' {
break break
} }
value = append(value, hdr[i]) value = append(value, hdr[index])
index++
} }
return value return value
} }
@@ -948,6 +955,7 @@ func (mset *Stream) processInboundJetStreamMsg(_ *subscription, pc *client, subj
} }
return return
} }
// Expected stream. // Expected stream.
if sname := getExpectedStream(hdr); sname != _EMPTY_ && sname != name { if sname := getExpectedStream(hdr); sname != _EMPTY_ && sname != name {
mset.mu.Unlock() mset.mu.Unlock()