Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 93 additions & 25 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19407,7 +19407,7 @@ function expand(str, max, isTop) {

N = [];

for (var i = x; test(i, y); i += incr) {
for (var i = x; test(i, y) && N.length < max; i += incr) {
var c;
if (isAlphaSequence) {
c = String.fromCharCode(i);
Expand Down Expand Up @@ -28461,7 +28461,6 @@ function defaultFactory (origin, opts) {

class Agent extends DispatcherBase {
constructor ({ factory = defaultFactory, maxRedirections = 0, connect, ...options } = {}) {

if (typeof factory !== 'function') {
throw new InvalidArgumentError('factory must be a function.')
}
Expand Down Expand Up @@ -29071,29 +29070,71 @@ class Parser {

const offset = llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr

if (ret === constants.ERROR.PAUSED_UPGRADE) {
this.onUpgrade(data.slice(offset))
} else if (ret === constants.ERROR.PAUSED) {
this.paused = true
socket.unshift(data.slice(offset))
} else if (ret !== constants.ERROR.OK) {
const ptr = llhttp.llhttp_get_error_reason(this.ptr)
let message = ''
/* istanbul ignore else: difficult to make a test case for */
if (ptr) {
const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0)
message =
'Response does not match the HTTP/1.1 protocol (' +
Buffer.from(llhttp.memory.buffer, ptr, len).toString() +
')'
}
throw new HTTPParserError(message, constants.ERROR[ret], data.slice(offset))
if (ret !== constants.ERROR.OK) {
const body = data.subarray(offset)

if (ret === constants.ERROR.PAUSED_UPGRADE) {
this.onUpgrade(body)
} else if (ret === constants.ERROR.PAUSED) {
this.paused = true
socket.unshift(body)
} else {
throw this.createError(ret, body)
}
}
} catch (err) {
util.destroy(socket, err)
}
}

finish () {
assert(currentParser === null)
assert(this.ptr != null)
assert(!this.paused)

const { llhttp } = this

let ret

try {
currentParser = this
ret = llhttp.llhttp_finish(this.ptr)
} finally {
currentParser = null
}

if (ret === constants.ERROR.OK) {
return null
}

if (ret === constants.ERROR.PAUSED || ret === constants.ERROR.PAUSED_UPGRADE) {
this.paused = true
return null
}

return this.createError(ret, EMPTY_BUF)
}

createError (ret, data) {
const { llhttp, contentLength, bytesRead } = this

if (contentLength && bytesRead !== parseInt(contentLength, 10)) {
return new ResponseContentLengthMismatchError()
}

const ptr = llhttp.llhttp_get_error_reason(this.ptr)
let message = ''
if (ptr) {
const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0)
message =
'Response does not match the HTTP/1.1 protocol (' +
Buffer.from(llhttp.memory.buffer, ptr, len).toString() +
')'
}

return new HTTPParserError(message, constants.ERROR[ret], data)
}

destroy () {
assert(this.ptr != null)
assert(currentParser == null)
Expand Down Expand Up @@ -29465,8 +29506,11 @@ async function connectH1 (client, socket) {
// On Mac OS, we get an ECONNRESET even if there is a full body to be forwarded
// to the user.
if (err.code === 'ECONNRESET' && parser.statusCode && !parser.shouldKeepAlive) {
// We treat all incoming data so for as a valid response.
parser.onMessageComplete()
const parserErr = parser.finish()
if (parserErr) {
this[kError] = parserErr
this[kClient][kOnError](parserErr)
}
return
}

Expand All @@ -29485,8 +29529,10 @@ async function connectH1 (client, socket) {
const parser = this[kParser]

if (parser.statusCode && !parser.shouldKeepAlive) {
// We treat all incoming data so far as a valid response.
parser.onMessageComplete()
const parserErr = parser.finish()
if (parserErr) {
util.destroy(this, parserErr)
}
return
}

Expand All @@ -29498,8 +29544,7 @@ async function connectH1 (client, socket) {

if (parser) {
if (!this[kError] && parser.statusCode && !parser.shouldKeepAlive) {
// We treat all incoming data so far as a valid response.
parser.onMessageComplete()
this[kError] = parser.finish() || this[kError]
}

this[kParser].destroy()
Expand Down Expand Up @@ -52063,6 +52108,29 @@ async function findOrDownload() {
await fs.promises.writeFile(exe, `#!/bin/bash\nexec "${tool}" "$@"`);
await fs.promises.chmod(exe, 0o777);
await fs.promises.access(exe, fs.constants.X_OK);
const steamRoot = path.dirname(tool);
const linux32Dir = path.join(steamRoot, 'linux32');
const linuxDir = path.join(steamRoot, 'linux');
try {
await fs.promises.access(linux32Dir);
try {
await fs.promises.access(linuxDir);
}
catch (error) {
if (error.code === 'ENOENT') {
await fs.promises.symlink(linux32Dir, linuxDir, 'dir');
core.debug(`Linked ${linuxDir} -> ${linux32Dir}`);
}
else {
throw error;
}
}
}
catch (error) {
if (error.code !== 'ENOENT') {
throw error;
}
}
}
await fs.promises.access(tool, fs.constants.X_OK);
core.debug(`Found ${tool} in ${toolDirectory}`);
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "setup-steamcmd",
"version": "1.4.0",
"version": "1.4.1",
"description": "A GitHub Action to setup the steamcmd command alias.",
"author": "buildalon",
"repository": {
Expand Down Expand Up @@ -38,4 +38,4 @@
"overrides": {
"@actions/http-client": "^3.0.2"
}
}
}
25 changes: 25 additions & 0 deletions src/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,31 @@ async function findOrDownload(): Promise<[string, string]> {
await fs.promises.writeFile(exe, `#!/bin/bash\nexec "${tool}" "$@"`);
await fs.promises.chmod(exe, 0o777);
await fs.promises.access(exe, fs.constants.X_OK);
// steamcmd self-updates on first launch, after which steamcmd.sh
// re-execs "${STEAMROOT}/linux/steamcmd" -- but the binary stays under
// "linux32/". Mirror linux32 -> linux next to steamcmd.sh so the
// re-exec resolves instead of failing with "Couldn't find steamcmd at
// .../linux/steamcmd".
const steamRoot = path.dirname(tool);
const linux32Dir = path.join(steamRoot, 'linux32');
const linuxDir = path.join(steamRoot, 'linux');
try {
await fs.promises.access(linux32Dir);
try {
await fs.promises.access(linuxDir);
} catch (error) {
if (error.code === 'ENOENT') {
await fs.promises.symlink(linux32Dir, linuxDir, 'dir');
core.debug(`Linked ${linuxDir} -> ${linux32Dir}`);
} else {
throw error;
}
}
} catch (error) {
if (error.code !== 'ENOENT') {
throw error;
}
}
}
await fs.promises.access(tool, fs.constants.X_OK);
core.debug(`Found ${tool} in ${toolDirectory}`);
Expand Down
Loading