@@ -56,6 +56,7 @@ import { resolveCommonProperties } from "vs/platform/telemetry/node/commonProper
56
56
import { UpdateChannel } from "vs/platform/update/electron-main/updateIpc" ;
57
57
import { INodeProxyService , NodeProxyChannel } from "vs/server/src/common/nodeProxy" ;
58
58
import { TelemetryChannel } from "vs/server/src/common/telemetry" ;
59
+ import { split } from "vs/server/src/common/util" ;
59
60
import { ExtensionEnvironmentChannel , FileProviderChannel , NodeProxyService } from "vs/server/src/node/channel" ;
60
61
import { Connection , ExtensionHostConnection , ManagementConnection } from "vs/server/src/node/connection" ;
61
62
import { TelemetryClient } from "vs/server/src/node/insights" ;
@@ -212,8 +213,8 @@ export abstract class Server {
212
213
}
213
214
214
215
protected withBase ( request : http . IncomingMessage , path : string ) : string {
215
- const split = request . url ? request . url . split ( "?" , 2 ) : [ ] ;
216
- return `${ this . protocol } ://${ request . headers . host } ${ this . options . basePath } ${ path } ${ split . length === 2 ? `?${ split [ 1 ] } ` : "" } ` ;
216
+ const [ , query ] = request . url ? split ( request . url , "?" ) : [ ] ;
217
+ return `${ this . protocol } ://${ request . headers . host } ${ this . options . basePath } ${ path } ${ query ? `?${ query } ` : "" } ` ;
217
218
}
218
219
219
220
private isAllowedRequestPath ( path : string ) : boolean {
@@ -440,11 +441,8 @@ export abstract class Server {
440
441
const cookies : { [ key : string ] : string } = { } ;
441
442
if ( request . headers . cookie ) {
442
443
request . headers . cookie . split ( ";" ) . forEach ( ( keyValue ) => {
443
- // key=value -> { [key]: value } and key -> { [key]: "" }
444
- const index = keyValue . indexOf ( "=" ) ;
445
- const key = keyValue . substring ( 0 , index ) . trim ( ) ;
446
- const value = keyValue . substring ( index + 1 ) ;
447
- cookies [ key || value ] = decodeURI ( key ? value : "" ) ;
444
+ const [ key , value ] = split ( keyValue , "=" ) ;
445
+ cookies [ key ] = decodeURI ( value ) ;
448
446
} ) ;
449
447
}
450
448
return cookies as T ;
0 commit comments