This repository was archived by the owner on Mar 19, 2019. It is now read-only.
File tree 4 files changed +24
-3
lines changed
shared/Microsoft.AspNetCore.HttpSys.Sources
src/Microsoft.AspNetCore.Server.HttpSys
4 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -17,5 +17,6 @@ internal static class Constants
17
17
18
18
internal static Version V1_0 = new Version ( 1 , 0 ) ;
19
19
internal static Version V1_1 = new Version ( 1 , 1 ) ;
20
+ internal static Version V2 = new Version ( 2 , 0 ) ;
20
21
}
21
22
}
Original file line number Diff line number Diff line change @@ -434,10 +434,19 @@ internal struct HTTP_REQUEST_INFO
434
434
internal HTTP_REQUEST_AUTH_INFO * pInfo ;
435
435
}
436
436
437
+ [ Flags ]
438
+ internal enum HTTP_REQUEST_FLAGS
439
+ {
440
+ None = 0 ,
441
+ MoreEntityBodyExists = 1 ,
442
+ IPRouted = 2 ,
443
+ Http2 = 4 ,
444
+ }
445
+
437
446
[ StructLayout ( LayoutKind . Sequential ) ]
438
447
internal struct HTTP_REQUEST
439
448
{
440
- internal uint Flags ;
449
+ internal HTTP_REQUEST_FLAGS Flags ;
441
450
internal ulong ConnectionId ;
442
451
internal ulong RequestId ;
443
452
internal ulong UrlContext ;
Original file line number Diff line number Diff line change @@ -88,6 +88,8 @@ internal SslStatus SslStatus
88
88
}
89
89
}
90
90
91
+ internal bool IsHttp2 => NativeRequest ->Flags . HasFlag ( HttpApiTypes . HTTP_REQUEST_FLAGS . Http2 ) ;
92
+
91
93
internal uint Size
92
94
{
93
95
get { return ( uint ) _backingBuffer . Length - AlignmentPadding ; }
@@ -156,6 +158,10 @@ internal CookedUrl GetCookedUrl()
156
158
157
159
internal Version GetVersion ( )
158
160
{
161
+ if ( IsHttp2 )
162
+ {
163
+ return Constants . V2 ;
164
+ }
159
165
var major = NativeRequest ->Version . MajorVersion ;
160
166
var minor = NativeRequest ->Version . MinorVersion ;
161
167
if ( major == 1 && minor == 1 )
Original file line number Diff line number Diff line change 13
13
using Microsoft . AspNetCore . Http ;
14
14
using Microsoft . AspNetCore . Http . Features ;
15
15
using Microsoft . AspNetCore . Http . Features . Authentication ;
16
+ using Microsoft . AspNetCore . HttpSys . Internal ;
16
17
using Microsoft . Net . Http . Headers ;
17
18
18
19
namespace Microsoft . AspNetCore . Server . HttpSys
@@ -168,11 +169,15 @@ string IHttpRequestFeature.Protocol
168
169
if ( IsNotInitialized ( Fields . Protocol ) )
169
170
{
170
171
var protocol = Request . ProtocolVersion ;
171
- if ( protocol . Major == 1 && protocol . Minor == 1 )
172
+ if ( protocol == Constants . V2 )
173
+ {
174
+ _httpProtocolVersion = "HTTP/2" ;
175
+ }
176
+ else if ( protocol == Constants . V1_1 )
172
177
{
173
178
_httpProtocolVersion = "HTTP/1.1" ;
174
179
}
175
- else if ( protocol . Major == 1 && protocol . Minor == 0 )
180
+ else if ( protocol == Constants . V1_0 )
176
181
{
177
182
_httpProtocolVersion = "HTTP/1.0" ;
178
183
}
You can’t perform that action at this time.
0 commit comments