@@ -56,6 +56,7 @@ import { resolveCommonProperties } from "vs/platform/telemetry/node/commonProper
5656import { UpdateChannel } from "vs/platform/update/electron-main/updateIpc" ;
5757import { INodeProxyService , NodeProxyChannel } from "vs/server/src/common/nodeProxy" ;
5858import { TelemetryChannel } from "vs/server/src/common/telemetry" ;
59+ import { split } from "vs/server/src/common/util" ;
5960import { ExtensionEnvironmentChannel , FileProviderChannel , NodeProxyService } from "vs/server/src/node/channel" ;
6061import { Connection , ExtensionHostConnection , ManagementConnection } from "vs/server/src/node/connection" ;
6162import { TelemetryClient } from "vs/server/src/node/insights" ;
@@ -212,8 +213,8 @@ export abstract class Server {
212213 }
213214
214215 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 } ` : "" } ` ;
217218 }
218219
219220 private isAllowedRequestPath ( path : string ) : boolean {
@@ -440,11 +441,8 @@ export abstract class Server {
440441 const cookies : { [ key : string ] : string } = { } ;
441442 if ( request . headers . cookie ) {
442443 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 ) ;
448446 } ) ;
449447 }
450448 return cookies as T ;
0 commit comments