Skip to content
Closed
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
108 changes: 78 additions & 30 deletions .github/local-actions/branch-manager/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -40596,7 +40596,7 @@ var require_client_h1 = __commonJS({
function writeH1(client, request2) {
const { method, path: path4, host, upgrade, blocking, reset: reset2 } = request2;
let { body, headers, contentLength } = request2;
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
if (util.isFormDataLike(body)) {
if (!extractBody) {
extractBody = require_body2().extractBody;
Expand Down Expand Up @@ -40804,7 +40804,7 @@ upgrade: ${upgrade}\r
socket.write(body);
socket.uncork();
request2.onBodySent(body);
if (!expectsPayload) {
if (!expectsPayload && request2.reset !== false) {
socket[kReset] = true;
}
}
Expand All @@ -40829,7 +40829,7 @@ upgrade: ${upgrade}\r
socket.uncork();
request2.onBodySent(buffer);
request2.onRequestSent();
if (!expectsPayload) {
if (!expectsPayload && request2.reset !== false) {
socket[kReset] = true;
}
client[kResume]();
Expand Down Expand Up @@ -40905,7 +40905,7 @@ upgrade: ${upgrade}\r
}
socket.cork();
if (bytesWritten === 0) {
if (!expectsPayload) {
if (!expectsPayload && request2.reset !== false) {
socket[kReset] = true;
}
if (contentLength === null) {
Expand Down Expand Up @@ -41012,7 +41012,9 @@ var require_client_h2 = __commonJS({
kOnError,
kMaxConcurrentStreams,
kHTTP2Session,
kResume
kResume,
kSize,
kHTTPContext
} = require_symbols6();
var kOpenStreams = Symbol("open streams");
var h2ExperimentalWarned = false;
Expand Down Expand Up @@ -41109,9 +41111,10 @@ var require_client_h2 = __commonJS({
version: "h2",
defaultPipelining: Infinity,
write(...args) {
writeH2(client, ...args);
return writeH2(client, ...args);
},
resume() {
resumeH2(client);
},
destroy(err, callback) {
if (closed) {
Expand All @@ -41128,6 +41131,18 @@ var require_client_h2 = __commonJS({
}
};
}
function resumeH2(client) {
const socket = client[kSocket];
if ((socket == null ? void 0 : socket.destroyed) === false) {
if (client[kSize] === 0 && client[kMaxConcurrentStreams] === 0) {
socket.unref();
client[kHTTP2Session].unref();
} else {
socket.ref();
client[kHTTP2Session].ref();
}
}
}
function onHttp2SessionError(err) {
assert(err.code !== "ERR_TLS_CERT_ALTNAME_INVALID");
this[kSocket][kError] = err;
Expand All @@ -41146,11 +41161,22 @@ var require_client_h2 = __commonJS({
util.destroy(this[kSocket], err);
}
function onHTTP2GoAway(code) {
const err = new RequestAbortedError(`HTTP/2: "GOAWAY" frame received with code ${code}`);
this[kSocket][kError] = err;
this[kClient][kOnError](err);
this.unref();
const err = this[kError] || new SocketError(`HTTP/2: "GOAWAY" frame received with code ${code}`, util.getSocketInfo(this));
const client = this[kClient];
client[kSocket] = null;
client[kHTTPContext] = null;
if (this[kHTTP2Session] != null) {
this[kHTTP2Session].destroy(err);
this[kHTTP2Session] = null;
}
util.destroy(this[kSocket], err);
const request2 = client[kQueue][client[kRunningIdx]];
client[kQueue][client[kRunningIdx]++] = null;
util.errorRequest(client, request2, err);
client[kPendingIdx] = client[kRunningIdx];
assert(client[kRunning] === 0);
client.emit("disconnect", client[kUrl], [client], err);
client[kResume]();
}
function shouldSendContentLength(method) {
return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
Expand All @@ -41162,9 +41188,6 @@ var require_client_h2 = __commonJS({
util.errorRequest(client, request2, new Error("Upgrade not supported for H2"));
return false;
}
if (request2.aborted) {
return false;
}
const headers = {};
for (let n = 0; n < reqHeaders.length; n += 2) {
const key = reqHeaders[n + 0];
Expand Down Expand Up @@ -41195,22 +41218,29 @@ var require_client_h2 = __commonJS({
util.destroy(stream, err);
}
util.destroy(body, err);
client[kQueue][client[kRunningIdx]++] = null;
client[kResume]();
};
try {
request2.onConnect(abort);
} catch (err) {
util.errorRequest(client, request2, err);
}
if (request2.aborted) {
return false;
}
if (method === "CONNECT") {
session.ref();
stream = session.request(headers, { endStream: false, signal });
if (stream.id && !stream.pending) {
request2.onUpgrade(null, null, stream);
++session[kOpenStreams];
client[kQueue][client[kRunningIdx]++] = null;
} else {
stream.once("ready", () => {
request2.onUpgrade(null, null, stream);
++session[kOpenStreams];
client[kQueue][client[kRunningIdx]++] = null;
});
}
stream.once("close", () => {
Expand Down Expand Up @@ -41280,12 +41310,14 @@ var require_client_h2 = __commonJS({
var _a2;
if (((_a2 = stream.state) == null ? void 0 : _a2.state) == null || stream.state.state < 6) {
request2.onComplete([]);
return;
}
if (session[kOpenStreams] === 0) {
session.unref();
}
abort(new InformationalError("HTTP/2: stream half-closed (remote)"));
client[kQueue][client[kRunningIdx]++] = null;
client[kPendingIdx] = client[kRunningIdx];
client[kResume]();
});
stream.once("close", () => {
session[kOpenStreams] -= 1;
Expand Down Expand Up @@ -41728,6 +41760,8 @@ var require_client2 = __commonJS({
var connectH2 = require_client_h2();
var deprecatedInterceptorWarned = false;
var kClosedResolve = Symbol("kClosedResolve");
var noop2 = () => {
};
function getPipelining(client) {
var _a2;
return client[kPipelining] ?? ((_a2 = client[kHTTPContext]) == null ? void 0 : _a2.defaultPipelining) ?? 1;
Expand Down Expand Up @@ -42012,16 +42046,14 @@ var require_client2 = __commonJS({
});
});
if (client.destroyed) {
util.destroy(socket.on("error", () => {
}), new ClientDestroyedError());
util.destroy(socket.on("error", noop2), new ClientDestroyedError());
return;
}
assert(socket);
try {
client[kHTTPContext] = socket.alpnProtocol === "h2" ? await connectH2(client, socket) : await connectH1(client, socket);
} catch (err) {
socket.destroy().on("error", () => {
});
socket.destroy().on("error", noop2);
throw err;
}
client[kConnecting] = false;
Expand Down Expand Up @@ -42344,9 +42376,9 @@ var require_pool_base2 = __commonJS({
}
async [kClose]() {
if (this[kQueue].isEmpty()) {
return Promise.all(this[kClients].map((c) => c.close()));
await Promise.all(this[kClients].map((c) => c.close()));
} else {
return new Promise((resolve) => {
await new Promise((resolve) => {
this[kClosedResolve] = resolve;
});
}
Expand All @@ -42359,7 +42391,7 @@ var require_pool_base2 = __commonJS({
}
item.handler.onError(err);
}
return Promise.all(this[kClients].map((c) => c.destroy(err)));
await Promise.all(this[kClients].map((c) => c.destroy(err)));
}
[kDispatch](opts, handler2) {
const dispatcher = this[kGetDispatcher]();
Expand Down Expand Up @@ -42757,6 +42789,8 @@ var require_proxy_agent2 = __commonJS({
function defaultFactory(origin, opts) {
return new Pool(origin, opts);
}
var noop2 = () => {
};
var ProxyAgent = class extends DispatcherBase {
constructor(opts) {
var _a2;
Expand Down Expand Up @@ -42808,8 +42842,7 @@ var require_proxy_agent2 = __commonJS({
servername: ((_a3 = this[kProxyTls]) == null ? void 0 : _a3.servername) || proxyHostname
});
if (statusCode !== 200) {
socket.on("error", () => {
}).destroy();
socket.on("error", noop2).destroy();
callback(new RequestAbortedError(`Proxy response (${statusCode}) !== 200 when HTTP Tunneling`));
}
if (opts2.protocol !== "https:") {
Expand Down Expand Up @@ -43440,6 +43473,9 @@ var require_readable2 = __commonJS({
async blob() {
return consume(this, "blob");
}
async bytes() {
return consume(this, "bytes");
}
async arrayBuffer() {
return consume(this, "arrayBuffer");
}
Expand Down Expand Up @@ -43571,6 +43607,22 @@ var require_readable2 = __commonJS({
const start = bufferLength > 2 && buffer[0] === 239 && buffer[1] === 187 && buffer[2] === 191 ? 3 : 0;
return buffer.utf8Slice(start, bufferLength);
}
function chunksConcat(chunks, length) {
if (chunks.length === 0 || length === 0) {
return new Uint8Array(0);
}
if (chunks.length === 1) {
return new Uint8Array(chunks[0]);
}
const buffer = new Uint8Array(Buffer.allocUnsafeSlow(length).buffer);
let offset = 0;
for (let i = 0; i < chunks.length; ++i) {
const chunk = chunks[i];
buffer.set(chunk, offset);
offset += chunk.length;
}
return buffer;
}
function consumeEnd(consume2) {
const { type, body, resolve, stream, length } = consume2;
try {
Expand All @@ -43579,15 +43631,11 @@ var require_readable2 = __commonJS({
} else if (type === "json") {
resolve(JSON.parse(chunksDecode(body, length)));
} else if (type === "arrayBuffer") {
const dst = new Uint8Array(length);
let pos = 0;
for (const buf of body) {
dst.set(buf, pos);
pos += buf.byteLength;
}
resolve(dst.buffer);
resolve(chunksConcat(body, length).buffer);
} else if (type === "blob") {
resolve(new Blob(body, { type: stream[kContentType] }));
} else if (type === "bytes") {
resolve(chunksConcat(body, length));
}
consumeFinish(consume2);
} catch (err) {
Expand Down
Loading
Loading