@@ -290,15 +290,15 @@ private void OnOriginFormTarget(HttpMethod method, HttpVersion version, Span<byt
290
290
{
291
291
// Read raw target before mutating memory.
292
292
var previousValue = _parsedRawTarget ;
293
- if ( previousValue == null || previousValue . Length != target . Length ||
293
+ if ( DisableStringReuse || previousValue == null || previousValue . Length != target . Length ||
294
294
! StringUtilities . BytesOrdinalEqualsStringAndAscii ( previousValue , target ) )
295
295
{
296
296
// The previous string does not match what the bytes would convert to,
297
297
// so we will need to generate a new string.
298
298
RawTarget = _parsedRawTarget = target . GetAsciiStringNonNullCharacters ( ) ;
299
299
300
300
previousValue = _parsedQueryString ;
301
- if ( previousValue == null || previousValue . Length != query . Length ||
301
+ if ( DisableStringReuse || previousValue == null || previousValue . Length != query . Length ||
302
302
! StringUtilities . BytesOrdinalEqualsStringAndAscii ( previousValue , query ) )
303
303
{
304
304
// The previous string does not match what the bytes would convert to,
@@ -363,7 +363,7 @@ private void OnAuthorityFormTarget(HttpMethod method, Span<byte> target)
363
363
// Allowed characters in the 'host + port' section of authority.
364
364
// See https://tools.ietf.org/html/rfc3986#section-3.2
365
365
var previousValue = _parsedRawTarget ;
366
- if ( previousValue == null || previousValue . Length != target . Length ||
366
+ if ( DisableStringReuse || previousValue == null || previousValue . Length != target . Length ||
367
367
! StringUtilities . BytesOrdinalEqualsStringAndAscii ( previousValue , target ) )
368
368
{
369
369
// The previous string does not match what the bytes would convert to,
@@ -416,7 +416,7 @@ private void OnAbsoluteFormTarget(Span<byte> target, Span<byte> query)
416
416
// HTTP/1.1 clients will only send them in requests to proxies.
417
417
418
418
var previousValue = _parsedRawTarget ;
419
- if ( previousValue == null || previousValue . Length != target . Length ||
419
+ if ( DisableStringReuse || previousValue == null || previousValue . Length != target . Length ||
420
420
! StringUtilities . BytesOrdinalEqualsStringAndAscii ( previousValue , target ) )
421
421
{
422
422
// The previous string does not match what the bytes would convert to,
@@ -436,13 +436,17 @@ private void OnAbsoluteFormTarget(Span<byte> target, Span<byte> query)
436
436
Path = _parsedPath = uri . LocalPath ;
437
437
// don't use uri.Query because we need the unescaped version
438
438
previousValue = _parsedQueryString ;
439
- if ( previousValue == null || previousValue . Length != query . Length ||
439
+ if ( DisableStringReuse || previousValue == null || previousValue . Length != query . Length ||
440
440
! StringUtilities . BytesOrdinalEqualsStringAndAscii ( previousValue , query ) )
441
441
{
442
442
// The previous string does not match what the bytes would convert to,
443
443
// so we will need to generate a new string.
444
444
QueryString = _parsedQueryString = query . GetAsciiStringNonNullCharacters ( ) ;
445
445
}
446
+ else
447
+ {
448
+ QueryString = _parsedQueryString ;
449
+ }
446
450
}
447
451
else
448
452
{
0 commit comments