File tree Expand file tree Collapse file tree 3 files changed +9
-8
lines changed Expand file tree Collapse file tree 3 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -230,7 +230,10 @@ export function getHostAfterModification(
230
230
) ;
231
231
}
232
232
233
- export const OVERRIDABLE_REQUEST_PSEUDOHEADERS = [
233
+ // These pseudoheaders are modifable, in that they are independent from the other HTTP
234
+ // request params: you can send plain HTTP but set :scheme:https, and you can send
235
+ // to one hostname but set another hostname as the authority.
236
+ export const MODIFIABLE_PSEUDOHEADERS = [
234
237
':authority' ,
235
238
':scheme'
236
239
] as const ;
@@ -245,7 +248,7 @@ export function getH2HeadersAfterModification(
245
248
reqUrl : string ,
246
249
originalHeaders : Headers ,
247
250
replacementHeaders : Headers | undefined
248
- ) : { [ K in typeof OVERRIDABLE_REQUEST_PSEUDOHEADERS [ number ] ] : string } {
251
+ ) : { [ K in typeof MODIFIABLE_PSEUDOHEADERS [ number ] ] : string } {
249
252
const parsedUrl = url . parse ( reqUrl ) ;
250
253
251
254
return {
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ import {
74
74
getContentLengthAfterModification ,
75
75
getHostAfterModification ,
76
76
getH2HeadersAfterModification ,
77
- OVERRIDABLE_REQUEST_PSEUDOHEADERS ,
77
+ MODIFIABLE_PSEUDOHEADERS ,
78
78
buildOverriddenBody ,
79
79
getUpstreamTlsOptions ,
80
80
shouldUseStrictHttps ,
@@ -632,7 +632,7 @@ export class PassThroughHandler extends PassThroughHandlerDefinition {
632
632
validateCustomHeaders (
633
633
clientHeaders ,
634
634
modifiedReq ?. headers ,
635
- OVERRIDABLE_REQUEST_PSEUDOHEADERS // These are handled by getCorrectPseudoheaders above
635
+ MODIFIABLE_PSEUDOHEADERS // These are handled by getH2HeadersAfterModification above
636
636
) ;
637
637
638
638
reqBodyOverride = await buildOverriddenBody ( modifiedReq , headers ) ;
@@ -729,9 +729,7 @@ export class PassThroughHandler extends PassThroughHandlerDefinition {
729
729
// We drop all incoming pseudoheaders, and regenerate them (except legally modified ones)
730
730
rawHeaders = rawHeaders . filter ( ( [ key ] ) =>
731
731
! key . toString ( ) . startsWith ( ':' ) ||
732
- ( headersManuallyModified &&
733
- OVERRIDABLE_REQUEST_PSEUDOHEADERS . includes ( key . toLowerCase ( ) as any )
734
- )
732
+ MODIFIABLE_PSEUDOHEADERS . includes ( key . toLowerCase ( ) as any )
735
733
) ;
736
734
} else if ( isH2Downstream && ! shouldTryH2Upstream ) {
737
735
rawHeaders = h2HeadersToH1 ( rawHeaders ) ;
Original file line number Diff line number Diff line change @@ -461,7 +461,7 @@ nodeOnly(() => {
461
461
await cleanup ( proxiedClient , client ) ;
462
462
} ) ;
463
463
464
- it ( "should include should metadata in events for proxied HTTP/2 responses" , async function ( ) {
464
+ it ( "should include response metadata in events for proxied HTTP/2 responses" , async function ( ) {
465
465
if ( ! semver . satisfies ( process . version , H2_TLS_ON_TLS_SUPPORTED ) ) this . skip ( ) ;
466
466
467
467
let seenResponsePromise = getDeferred < CompletedResponse > ( ) ;
You can’t perform that action at this time.
0 commit comments