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IAAI,CAAC,QAAL,CAAc,UAAd,CAA/D,IAA4F,IAAI,CAAC,QAAL,CAAc,OAAd,CAA5F,IAAsH,IAAI,CAAC,QAAL,CAAc,UAAd,CAAtH,IAAmJ,IAAI,CAAC,QAAL,CAAc,OAAd,CAAnJ,IAA8K,YAAY,IAAI,IAAhB,IAAwB,YAAY,CAAC,GAAb,CAAiB,IAAjB,CAA1M,EAAmO;AACjO,aAAO,2BAAP;AACD;;AACD,WAAO,KAAP;AACD,GALM,EAKJ,CALI,CAAP;AAMD,C","sourcesContent":["import { createHash, Hash } from \"crypto\"\nimport _debug from \"debug\"\nimport { createWriteStream } from \"fs\"\nimport { IncomingMessage, OutgoingHttpHeaders, RequestOptions } from \"http\"\nimport { Socket } from \"net\"\nimport { Transform } from \"stream\"\nimport { URL } from \"url\"\nimport { CancellationToken } from \"./CancellationToken\"\nimport { newError } from \"./index\"\nimport { ProgressCallbackTransform, ProgressInfo } from \"./ProgressCallbackTransform\"\n\nconst debug = _debug(\"electron-builder\")\n\nexport interface RequestHeaders extends OutgoingHttpHeaders {\n [key: string]: string\n}\n\nexport interface DownloadOptions {\n readonly headers?: OutgoingHttpHeaders | null\n readonly sha2?: string | null\n readonly sha512?: string | null\n\n readonly cancellationToken: CancellationToken\n\n // noinspection JSUnusedLocalSymbols\n onProgress?(progress: ProgressInfo): void\n}\n\nexport function createHttpError(response: IncomingMessage, description: any | null = null) {\n return new HttpError(response.statusCode || -1, `${response.statusCode} ${response.statusMessage}` + (description == null ? \"\" : (\"\\n\" + JSON.stringify(description, null, \" \"))) + \"\\nHeaders: \" + safeStringifyJson(response.headers), description)\n}\n\nconst HTTP_STATUS_CODES = new Map<number, string>([\n [429, \"Too many requests\"],\n [400, \"Bad request\"],\n [403, \"Forbidden\"],\n [404, \"Not found\"],\n [405, \"Method not allowed\"],\n [406, \"Not acceptable\"],\n [408, \"Request timeout\"],\n [413, \"Request entity too large\"],\n [500, \"Internal server error\"],\n [502, \"Bad gateway\"],\n [503, \"Service unavailable\"],\n [504, \"Gateway timeout\"],\n [505, \"HTTP version not supported\"],\n])\n\nexport class HttpError extends Error {\n constructor(readonly statusCode: number, message: string = `HTTP error: ${HTTP_STATUS_CODES.get(statusCode) || statusCode}`, readonly description: any | null = null) {\n super(message)\n\n this.name = \"HttpError\"\n }\n}\n\nexport function parseJson(result: Promise<string | null>) {\n return result.then(it => it == null || it.length === 0 ? null : JSON.parse(it))\n}\n\nexport abstract class HttpExecutor<REQUEST> {\n protected readonly maxRedirects = 10\n\n request(options: RequestOptions, cancellationToken: CancellationToken = new CancellationToken(), data?: { [name: string]: any; } | null): Promise<string | null> {\n configureRequestOptions(options)\n const encodedData = data == null ? undefined : Buffer.from(JSON.stringify(data))\n if (encodedData != null) {\n options.method = \"post\"\n options.headers![\"Content-Type\"] = \"application/json\"\n options.headers![\"Content-Length\"] = encodedData.length\n }\n return this.doApiRequest(options, cancellationToken, it => {\n (it as any).end(encodedData)\n })\n }\n\n doApiRequest(options: RequestOptions, cancellationToken: CancellationToken, requestProcessor: (request: REQUEST, reject: (error: Error) => void) => void, redirectCount: number = 0): Promise<string> {\n if (debug.enabled) {\n debug(`Request: ${safeStringifyJson(options)}`)\n }\n\n return cancellationToken.createPromise<string>((resolve, reject, onCancel) => {\n const request = this.createRequest(options, (response: any) => {\n try {\n this.handleResponse(response, options, cancellationToken, resolve, reject, redirectCount, requestProcessor)\n }\n catch (e) {\n reject(e)\n }\n })\n this.addErrorAndTimeoutHandlers(request, reject)\n this.addRedirectHandlers(request, options, reject, redirectCount, options => {\n this.doApiRequest(options, cancellationToken, requestProcessor, redirectCount)\n .then(resolve)\n .catch(reject)\n })\n requestProcessor(request, reject)\n onCancel(() => request.abort())\n })\n }\n\n // noinspection JSUnusedLocalSymbols\n protected addRedirectHandlers(request: any, options: RequestOptions, reject: (error: Error) => void, redirectCount: number, handler: (options: RequestOptions) => void) {\n // not required for NodeJS\n }\n\n addErrorAndTimeoutHandlers(request: any, reject: (error: Error) => void) {\n this.addTimeOutHandler(request, reject)\n request.on(\"error\", reject)\n request.on(\"aborted\", () => {\n reject(new Error(\"Request has been aborted by the server\"))\n })\n }\n\n private handleResponse(response: IncomingMessage,\n options: RequestOptions,\n cancellationToken: CancellationToken,\n resolve: (data?: any) => void,\n reject: (error: Error) => void,\n redirectCount: number,\n requestProcessor: (request: REQUEST, reject: (error: Error) => void) => void) {\n if (debug.enabled) {\n debug(`Response: ${response.statusCode} ${response.statusMessage}, request options: ${safeStringifyJson(options)}`)\n }\n\n // we handle any other >= 400 error on request end (read detailed message in the response body)\n if (response.statusCode === 404) {\n // error is clear, we don't need to read detailed error description\n reject(createHttpError(response, `method: ${options.method || \"GET\"} url: ${options.protocol || \"https:\"}//${options.hostname}${options.port ? `:${options.port}` : \"\"}${options.path}\n\nPlease double check that your authentication token is correct. Due to security reasons actual status maybe not reported, but 404.\n`))\n return\n }\n else if (response.statusCode === 204) {\n // on DELETE request\n resolve()\n return\n }\n\n const redirectUrl = safeGetHeader(response, \"location\")\n if (redirectUrl != null) {\n if (redirectCount > this.maxRedirects) {\n reject(this.createMaxRedirectError())\n return\n }\n\n this.doApiRequest(HttpExecutor.prepareRedirectUrlOptions(redirectUrl, options), cancellationToken, requestProcessor, redirectCount)\n .then(resolve)\n .catch(reject)\n return\n }\n\n response.setEncoding(\"utf8\")\n\n let data = \"\"\n response.on(\"data\", (chunk: string) => data += chunk)\n response.on(\"end\", () => {\n try {\n if (response.statusCode != null && response.statusCode >= 400) {\n const contentType = safeGetHeader(response, \"content-type\")\n const isJson = contentType != null && (Array.isArray(contentType) ? contentType.find(it => it.includes(\"json\")) != null : contentType.includes(\"json\"))\n reject(createHttpError(response, isJson ? JSON.parse(data) : data))\n }\n else {\n resolve(data.length === 0 ? null : data)\n }\n }\n catch (e) {\n reject(e)\n }\n })\n }\n\n // noinspection JSUnusedLocalSymbols\n abstract createRequest(options: any, callback: (response: any) => void): any\n\n async downloadToBuffer(url: URL, options: DownloadOptions): Promise<Buffer> {\n return await options.cancellationToken.createPromise<Buffer>((resolve, reject, onCancel) => {\n let result: Buffer | null = null\n const requestOptions = {\n headers: options.headers || undefined,\n // because PrivateGitHubProvider requires HttpExecutor.prepareRedirectUrlOptions logic, so, we need to redirect manually\n redirect: \"manual\",\n }\n configureRequestUrl(url, requestOptions)\n configureRequestOptions(requestOptions)\n this.doDownload(requestOptions, {\n destination: null,\n options,\n onCancel,\n callback: error => {\n if (error == null) {\n resolve(result!!)\n }\n else {\n reject(error)\n }\n },\n responseHandler: (response, callback) => {\n const contentLength = safeGetHeader(response, \"content-length\")\n let position = -1\n if (contentLength != null) {\n const size = parseInt(contentLength, 10)\n if (size > 0) {\n if (size > 5242880) {\n callback(new Error(\"Maximum allowed size is 5 MB\"))\n return\n }\n\n result = Buffer.alloc(size)\n position = 0\n }\n }\n response.on(\"data\", (chunk: Buffer) => {\n if (position !== -1) {\n chunk.copy(result!!, position)\n position += chunk.length\n }\n else if (result == null) {\n result = chunk\n }\n else {\n if (result.length > 5242880) {\n callback(new Error(\"Maximum allowed size is 5 MB\"))\n return\n }\n result = Buffer.concat([result, chunk])\n }\n })\n response.on(\"end\", () => {\n if (result != null && position !== -1 && position !== result.length) {\n callback(new Error(`Received data length ${position} is not equal to expected ${result.length}`))\n }\n else {\n callback(null)\n }\n })\n },\n }, 0)\n })\n }\n\n protected doDownload(requestOptions: any, options: DownloadCallOptions, redirectCount: number) {\n const request = this.createRequest(requestOptions, (response: IncomingMessage) => {\n if (response.statusCode! >= 400) {\n options.callback(new Error(`Cannot download \"${requestOptions.protocol || \"https:\"}//${requestOptions.hostname}${requestOptions.path}\", status ${response.statusCode}: ${response.statusMessage}`))\n return\n }\n\n // this code not relevant for Electron (redirect event instead handled)\n const redirectUrl = safeGetHeader(response, \"location\")\n if (redirectUrl != null) {\n if (redirectCount < this.maxRedirects) {\n this.doDownload(HttpExecutor.prepareRedirectUrlOptions(redirectUrl, requestOptions), options, redirectCount++)\n }\n else {\n options.callback(this.createMaxRedirectError())\n }\n return\n }\n\n if (options.responseHandler == null) {\n configurePipes(options, response)\n }\n else {\n options.responseHandler(response, options.callback)\n }\n })\n this.addErrorAndTimeoutHandlers(request, options.callback)\n this.addRedirectHandlers(request, requestOptions, options.callback, redirectCount, requestOptions => {\n this.doDownload(requestOptions, options, redirectCount++)\n })\n request.end()\n }\n\n protected createMaxRedirectError() {\n return new Error(`Too many redirects (> ${this.maxRedirects})`)\n }\n\n private addTimeOutHandler(request: any, callback: (error: Error) => void) {\n request.on(\"socket\", (socket: Socket) => {\n socket.setTimeout(60 * 1000, () => {\n request.abort()\n callback(new Error(\"Request timed out\"))\n })\n })\n }\n\n static prepareRedirectUrlOptions(redirectUrl: string, options: RequestOptions): RequestOptions {\n const newOptions = configureRequestOptionsFromUrl(redirectUrl, {...options})\n const headers = newOptions.headers\n if (headers != null && headers.authorization != null && (headers.authorization as string).startsWith(\"token\")) {\n const parsedNewUrl = new URL(redirectUrl)\n if (parsedNewUrl.hostname.endsWith(\".amazonaws.com\")) {\n delete headers.authorization\n }\n }\n return newOptions\n }\n}\n\nexport interface DownloadCallOptions {\n responseHandler: ((response: IncomingMessage, callback: (error: Error | null) => void) => void) | null\n onCancel: (callback: () => void) => void\n callback: (error: Error | null) => void\n\n options: DownloadOptions\n\n destination: string | null\n}\n\nexport function configureRequestOptionsFromUrl(url: string, options: RequestOptions) {\n const result = configureRequestOptions(options)\n configureRequestUrl(new URL(url), result)\n return result\n}\n\nexport function configureRequestUrl(url: URL, options: RequestOptions): void {\n options.protocol = url.protocol\n options.hostname = url.hostname\n if (url.port) {\n options.port = url.port\n }\n else if (options.port) {\n delete options.port\n }\n options.path = url.pathname + url.search\n}\n\nexport class DigestTransform extends Transform {\n private readonly digester: Hash\n\n private _actual: string | null = null\n\n // noinspection JSUnusedGlobalSymbols\n get actual() {\n return this._actual\n }\n\n isValidateOnEnd: boolean = true\n\n constructor(readonly expected: string, private readonly algorithm: string = \"sha512\", private readonly encoding: \"hex\" | \"base64\" | \"latin1\" = \"base64\") {\n super()\n\n this.digester = createHash(algorithm)\n }\n\n // noinspection JSUnusedGlobalSymbols\n _transform(chunk: Buffer, encoding: string, callback: any) {\n this.digester.update(chunk)\n callback(null, chunk)\n }\n\n // noinspection JSUnusedGlobalSymbols\n _flush(callback: any): void {\n this._actual = this.digester.digest(this.encoding)\n\n if (this.isValidateOnEnd) {\n try {\n this.validate()\n }\n catch (e) {\n callback(e)\n return\n }\n }\n\n callback(null)\n }\n\n validate() {\n if (this._actual == null) {\n throw newError(\"Not finished yet\", \"ERR_STREAM_NOT_FINISHED\")\n }\n\n if (this._actual !== this.expected) {\n throw newError(`${this.algorithm} checksum mismatch, expected ${this.expected}, got ${this._actual}`, \"ERR_CHECKSUM_MISMATCH\")\n }\n\n return null\n }\n}\n\nfunction checkSha2(sha2Header: string | null | undefined, sha2: string | null | undefined, callback: (error: Error | null) => void): boolean {\n if (sha2Header != null && sha2 != null && sha2Header !== sha2) {\n callback(new Error(`checksum mismatch: expected ${sha2} but got ${sha2Header} (X-Checksum-Sha2 header)`))\n return false\n }\n return true\n}\n\nexport function safeGetHeader(response: any, headerKey: string) {\n const value = response.headers[headerKey]\n if (value == null) {\n return null\n }\n else if (Array.isArray(value)) {\n // electron API\n return value.length === 0 ? null : value[value.length - 1]\n }\n else {\n return value\n }\n}\n\nfunction configurePipes(options: DownloadCallOptions, response: IncomingMessage) {\n if (!checkSha2(safeGetHeader(response, \"X-Checksum-Sha2\"), options.options.sha2, options.callback)) {\n return\n }\n\n const streams: Array<any> = []\n if (options.options.onProgress != null) {\n const contentLength = safeGetHeader(response, \"content-length\")\n if (contentLength != null) {\n streams.push(new ProgressCallbackTransform(parseInt(contentLength, 10), options.options.cancellationToken, options.options.onProgress))\n }\n }\n\n const sha512 = options.options.sha512\n if (sha512 != null) {\n streams.push(new DigestTransform(sha512, \"sha512\", sha512.length === 128 && !sha512.includes(\"+\") && !sha512.includes(\"Z\") && !sha512.includes(\"=\") ? \"hex\" : \"base64\"))\n }\n else if (options.options.sha2 != null) {\n streams.push(new DigestTransform(options.options.sha2, \"sha256\", \"hex\"))\n }\n\n const fileOut = createWriteStream(options.destination!!)\n streams.push(fileOut)\n\n let lastStream = response\n for (const stream of streams) {\n stream.on(\"error\", (error: Error) => {\n if (!options.options.cancellationToken.cancelled) {\n options.callback(error)\n }\n })\n lastStream = lastStream.pipe(stream)\n }\n\n fileOut.on(\"finish\", () => {\n (fileOut.close as any)(options.callback)\n })\n}\n\nexport function configureRequestOptions(options: RequestOptions, token?: string | null, method?: \"GET\" | \"DELETE\" | \"PUT\"): RequestOptions {\n if (method != null) {\n options.method = method\n }\n\n let headers = options.headers\n if (headers == null) {\n headers = {}\n options.headers = headers\n }\n if (token != null) {\n (headers as any).authorization = token.startsWith(\"Basic\") ? token : `token ${token}`\n }\n if (headers[\"User-Agent\"] == null) {\n headers[\"User-Agent\"] = \"electron-builder\"\n }\n\n if ((method == null || method === \"GET\") || headers[\"Cache-Control\"] == null) {\n headers[\"Cache-Control\"] = \"no-cache\"\n }\n\n // do not specify for node (in any case we use https module)\n if (options.protocol == null && (process.versions as any).electron != null) {\n options.protocol = \"https:\"\n }\n return options\n}\n\nexport function safeStringifyJson(data: any, skippedNames?: Set<string>) {\n return JSON.stringify(data, (name, value) => {\n if (name.endsWith(\"authorization\") || name.endsWith(\"Password\") || name.endsWith(\"PASSWORD\") || name.endsWith(\"Token\") || name.includes(\"password\") || name.includes(\"token\") || (skippedNames != null && skippedNames.has(name))) {\n return \"<stripped sensitive data>\"\n }\n return value\n }, 2)\n}"],"sourceRoot":""}
|