MCPcopy Create free account
hub / github.com/nodejs/node / handleAuthResponse

Method handleAuthResponse

deps/undici/undici.js:10753–10768  ·  view source on GitHub ↗

* Handle authentication response

()

Source from the content-addressed store, hash-verified

10751 * Handle authentication response
10752 */
10753 handleAuthResponse() {
10754 if (this.buffer.length < 2) {
10755 return;
10756 }
10757 const version = this.buffer[0];
10758 const status = this.buffer[1];
10759 if (version !== 1) {
10760 throw new Socks5ProxyError(`Invalid auth sub-negotiation version: ${version}`, "UND_ERR_SOCKS5_AUTH_VERSION");
10761 }
10762 if (status !== 0) {
10763 throw new Socks5ProxyError("Authentication failed", "UND_ERR_SOCKS5_AUTH_FAILED");
10764 }
10765 this.buffer = this.buffer.subarray(2);
10766 debug("authentication successful");
10767 this.markAuthenticated();
10768 }
10769 /**
10770 * Send CONNECT command
10771 * @param {string} address - Target address (IP or domain)

Callers 1

onDataMethod · 0.45

Calls 2

debugFunction · 0.50
markAuthenticatedMethod · 0.45

Tested by

no test coverage detected