Skip to content

Commit 61b3966

Browse files
committed
More wording tweaks
1 parent 669ed2f commit 61b3966

File tree

4 files changed

+771
-54
lines changed

4 files changed

+771
-54
lines changed

docs/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3990,7 +3990,7 @@ async function https(urlStr, method, transportFactory, rootCertsPromise2, {
39903990
}
39913991
}
39923992
log("Mission accomplished. At this point, we could send the server an HTTP/2 [GOAWAY frame](https://datatracker.ietf.org/doc/html/rfc9113#name-goaway), but most servers seem not to do anything in response. We could also just unceremoniously close the underlying WebSocket/TCP connection.");
3993-
log("What we actually do is something in-between: we send a TLS close-notify Alert record, which will generally cause the server to hang up. Unencrypted, that\u2019s three bytes: 0x01 (Alert type: warning), 0x00 (warning type: close notify), 0x15 (TLS record type: Alert).");
3993+
log("What we actually do is something at the level in-between: we send a TLS close-notify Alert record, which will generally cause the server to hang up. Unencrypted, that\u2019s three bytes: 0x01 (Alert type: warning), 0x00 (warning type: close notify), 0x15 (TLS record type: Alert).");
39943994
await end();
39953995
} else {
39963996
headers["Host"] ?? (headers["Host"] = host);

index.d.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// <reference types="node" />
22

3-
import type { Socket } from 'net';
3+
import { Socket } from 'net';
44

55
export declare const allKeyUsages: readonly ["digitalSignature", "nonRepudiation", "keyEncipherment", "dataEncipherment", "keyAgreement", "keyCertSign", "cRLSign", "encipherOnly", "decipherOnly"];
66

@@ -37,6 +37,7 @@ export declare class Bytes {
3737
* * If data is a `function`, this function is called to retrieve data when required
3838
*/
3939
constructor(data?: Uint8Array | number | ((bytes: number) => Promise<Uint8Array | undefined>), indent?: number);
40+
changeIndent(indentDelta: number): void;
4041
readRemaining(): number;
4142
resizeTo(newSize: number): void;
4243
ensureReadAvailable(bytes: number): Promise<void>;
@@ -185,11 +186,11 @@ export declare function getRootCertsDatabase(): Promise<{
185186

186187
export declare function hexFromU8(u8: Uint8Array | number[], spacer?: string): string;
187188

188-
export declare function https(urlStr: string, method: string, transportFactory: typeof wsTransport | typeof tcpTransport, rootCertsPromise: ReturnType<typeof getRootCertsDatabase>, { headers, httpVersion, socketOptions, }?: HTTPSOptions): Promise<string>;
189+
export declare function https(urlStr: string, method: string, transportFactory: typeof wsTransport | typeof tcpTransport, rootCertsPromise: ReturnType<typeof getRootCertsDatabase>, { headers, protocols, socketOptions, }?: HTTPSOptions): Promise<string>;
189190

190191
export declare interface HTTPSOptions {
191192
headers?: Record<string, string>;
192-
httpVersion?: string;
193+
protocols?: string[];
193194
socketOptions?: SocketOptions | WebSocketOptions;
194195
}
195196

@@ -258,15 +259,18 @@ export declare function startTls(host: string, rootCertsDatabase: RootCertsDatab
258259
}): Promise<{
259260
readonly read: () => Promise<Uint8Array<ArrayBufferLike> | undefined>;
260261
readonly write: (data: Uint8Array) => Promise<void>;
262+
readonly end: () => Promise<void>;
261263
readonly userCert: Cert;
264+
readonly protocolFromALPN: string | undefined;
262265
}>;
263266

264-
export declare function tcpTransport(host: string, port: string | number, { close, timeout, error }: SocketOptions): Promise<{
267+
export declare function tcpTransport(host: string, port: string | number, opts: SocketOptions): Promise<{
265268
read: (bytes: number, readMode?: ReadMode) => Promise<Uint8Array<ArrayBufferLike> | undefined>;
266269
write: {
267270
(buffer: Uint8Array | string, cb?: (err?: Error) => void): boolean;
268271
(str: Uint8Array | string, encoding?: BufferEncoding, cb?: (err?: Error) => void): boolean;
269272
};
273+
end: () => Socket;
270274
stats: {
271275
read: number;
272276
written: number;
@@ -305,9 +309,10 @@ export declare class WebSocketReadQueue extends ReadQueue {
305309
moreDataMayFollow(): boolean;
306310
}
307311

308-
export declare function wsTransport(host: string, port: string | number, { close }: WebSocketOptions): Promise<{
312+
export declare function wsTransport(host: string, port: string | number, opts: WebSocketOptions): Promise<{
309313
read: (bytes: number, readMode?: ReadMode) => Promise<Uint8Array<ArrayBufferLike> | undefined>;
310314
write: (data: string | ArrayBufferLike | Blob | ArrayBufferView) => void;
315+
end: (code?: number, reason?: string) => void;
311316
stats: {
312317
read: number;
313318
written: number;

0 commit comments

Comments
 (0)