MCPcopy Create free account
hub / github.com/angular/dev-infra / writeStream

Function writeStream

github-actions/browserstack/set-browserstack-env.js:6757–6826  ·  view source on GitHub ↗
(abort, body, client, request, socket, contentLength, header, expectsPayload)

Source from the content-addressed store, hash-verified

6755 clearIdleSocketValidation(socket);
6756 const abort = (error) => {
6757 if (request.aborted) {
6758 return;
6759 }
6760 if (request.completed) {
6761 if (request.upgrade || request.method === "CONNECT") {
6762 util.destroy(socket, new InformationalError("aborted"));
6763 }
6764 return;
6765 }
6766 util.errorRequest(client, request, error || new RequestAbortedError());
6767 util.destroy(body);
6768 util.destroy(socket, new InformationalError("aborted"));
6769 };
6770 try {
6771 request.onConnect(abort);
6772 } catch (err) {
6773 util.errorRequest(client, request, err);
6774 }
6775 if (request.aborted) {
6776 return false;
6777 }
6778 if (method === "HEAD") {
6779 socket[kReset] = true;
6780 }
6781 if (upgrade || method === "CONNECT") {
6782 socket[kReset] = true;
6783 }
6784 if (reset != null) {
6785 socket[kReset] = reset;
6786 }
6787 if (client[kMaxRequests] && socket[kCounter]++ >= client[kMaxRequests]) {
6788 socket[kReset] = true;
6789 }
6790 if (blocking) {
6791 socket[kBlocking] = true;
6792 }
6793 let header = `${method} ${path4} HTTP/1.1\r
6794`;
6795 if (typeof host === "string") {
6796 header += `host: ${host}\r
6797`;
6798 } else {
6799 header += client[kHostHeader];
6800 }
6801 if (upgrade) {
6802 header += `connection: upgrade\r
6803upgrade: ${upgrade}\r
6804`;
6805 } else if (client[kPipelining] && !socket[kReset]) {
6806 header += "connection: keep-alive\r\n";
6807 } else {
6808 header += "connection: close\r\n";
6809 }
6810 if (Array.isArray(headers)) {
6811 for (let n = 0; n < headers.length; n += 2) {
6812 const key = headers[n + 0];
6813 const val = headers[n + 1];
6814 if (Array.isArray(val)) {

Callers 2

writeH1Function · 0.70
writeBodyH2Function · 0.70

Calls 8

onFinishedFunction · 0.70
pipelineFunction · 0.70
abortFunction · 0.70
onMethod · 0.45
resumeMethod · 0.45
destroyMethod · 0.45
onRequestSentMethod · 0.45
addListenerMethod · 0.45

Tested by

no test coverage detected