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

Method sendAuthRequest

deps/undici/undici.js:10731–10749  ·  view source on GitHub ↗

* Send username/password authentication request

()

Source from the content-addressed store, hash-verified

10729 * Send username/password authentication request
10730 */
10731 sendAuthRequest() {
10732 const { username, password } = this.options;
10733 if (!username || !password) {
10734 throw new InvalidArgumentError("Username and password required for authentication");
10735 }
10736 debug("sending username/password auth");
10737 const usernameBuffer = Buffer2.from(username);
10738 const passwordBuffer = Buffer2.from(password);
10739 if (usernameBuffer.length > 255 || passwordBuffer.length > 255) {
10740 throw new InvalidArgumentError("Username or password too long");
10741 }
10742 const request = Buffer2.alloc(3 + usernameBuffer.length + passwordBuffer.length);
10743 request[0] = 1;
10744 request[1] = usernameBuffer.length;
10745 usernameBuffer.copy(request, 2);
10746 request[2 + usernameBuffer.length] = passwordBuffer.length;
10747 passwordBuffer.copy(request, 3 + usernameBuffer.length);
10748 this.socket.write(request);
10749 }
10750 /**
10751 * Handle authentication response
10752 */

Callers 1

Calls 5

allocMethod · 0.80
copyMethod · 0.65
debugFunction · 0.50
fromMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected