Wait for more input while request hasn't finished (#672).
This commit is contained in:
parent
37b0917ac1
commit
88367ccf2d
|
|
@ -731,10 +731,18 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
|
||||||
|
|
||||||
var needDecode = false;
|
var needDecode = false;
|
||||||
var chFound = scan.Seek(ref _vectorSpaces, ref _vectorQuestionMarks, ref _vectorPercentages);
|
var chFound = scan.Seek(ref _vectorSpaces, ref _vectorQuestionMarks, ref _vectorPercentages);
|
||||||
if (chFound == '%')
|
if (chFound == -1)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (chFound == '%')
|
||||||
{
|
{
|
||||||
needDecode = true;
|
needDecode = true;
|
||||||
chFound = scan.Seek(ref _vectorSpaces, ref _vectorQuestionMarks);
|
chFound = scan.Seek(ref _vectorSpaces, ref _vectorQuestionMarks);
|
||||||
|
if (chFound == -1)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var pathBegin = begin;
|
var pathBegin = begin;
|
||||||
|
|
@ -851,7 +859,10 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
|
||||||
while (!scan.IsEnd)
|
while (!scan.IsEnd)
|
||||||
{
|
{
|
||||||
var beginName = scan;
|
var beginName = scan;
|
||||||
scan.Seek(ref _vectorColons, ref _vectorCRs);
|
if (scan.Seek(ref _vectorColons, ref _vectorCRs) == -1)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
var endName = scan;
|
var endName = scan;
|
||||||
|
|
||||||
chFirst = scan.Take();
|
chFirst = scan.Take();
|
||||||
|
|
@ -885,13 +896,21 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
|
||||||
{
|
{
|
||||||
var scanAhead = scan;
|
var scanAhead = scan;
|
||||||
var chAhead = scanAhead.Take();
|
var chAhead = scanAhead.Take();
|
||||||
if (chAhead == '\n')
|
if (chAhead == -1)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (chAhead == '\n')
|
||||||
{
|
{
|
||||||
chAhead = scanAhead.Take();
|
chAhead = scanAhead.Take();
|
||||||
// If the "\r\n" isn't part of "linear whitespace",
|
if (chAhead == -1)
|
||||||
// then this header has no value.
|
|
||||||
if (chAhead != ' ' && chAhead != '\t')
|
|
||||||
{
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (chAhead != ' ' && chAhead != '\t')
|
||||||
|
{
|
||||||
|
// If the "\r\n" isn't part of "linear whitespace",
|
||||||
|
// then this header has no value.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -899,6 +918,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
|
||||||
|
|
||||||
beginValue = scan;
|
beginValue = scan;
|
||||||
chSecond = scan.Take();
|
chSecond = scan.Take();
|
||||||
|
|
||||||
|
if (chSecond == -1)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
scan = beginValue;
|
scan = beginValue;
|
||||||
|
|
||||||
|
|
@ -912,10 +936,14 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
|
||||||
}
|
}
|
||||||
|
|
||||||
var endValue = scan;
|
var endValue = scan;
|
||||||
chFirst = scan.Take(); // expecting: /r
|
chFirst = scan.Take(); // expecting: \r
|
||||||
chSecond = scan.Take(); // expecting: /n
|
chSecond = scan.Take(); // expecting: \n
|
||||||
|
|
||||||
if (chSecond != '\n')
|
if (chSecond == -1)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (chSecond != '\n')
|
||||||
{
|
{
|
||||||
// "\r" was all by itself, move just after it and try again
|
// "\r" was all by itself, move just after it and try again
|
||||||
scan = endValue;
|
scan = endValue;
|
||||||
|
|
@ -924,7 +952,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
|
||||||
}
|
}
|
||||||
|
|
||||||
var chThird = scan.Peek();
|
var chThird = scan.Peek();
|
||||||
if (chThird == ' ' || chThird == '\t')
|
if (chThird == -1)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (chThird == ' ' || chThird == '\t')
|
||||||
{
|
{
|
||||||
// special case, "\r\n " or "\r\n\t".
|
// special case, "\r\n " or "\r\n\t".
|
||||||
// this is considered wrapping"linear whitespace" and is actually part of the header value
|
// this is considered wrapping"linear whitespace" and is actually part of the header value
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue