@thangnm.nip/arouter 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/app-path-routes-manifest.json +5 -5
- package/.next/standalone/.next/build-manifest.json +2 -2
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/server/app/(dashboard)/mitm/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_global-error.html +2 -2
- package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +3 -3
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
- package/.next/standalone/.next/server/app/api/cli-tools/antigravity-mitm/alias/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/cli-tools/antigravity-mitm/console-logs/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/cli-tools/antigravity-mitm/route.js +1 -1
- package/.next/standalone/.next/server/app/api/cli-tools/antigravity-mitm/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/cli-tools/antigravity-mitm/settings/route.js +2 -2
- package/.next/standalone/.next/server/app/api/cli-tools/antigravity-mitm/settings/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/cli-tools/claude-settings/route.js +2 -2
- package/.next/standalone/.next/server/app/api/cli-tools/claude-settings/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/cli-tools/codex-settings/route.js +2 -2
- package/.next/standalone/.next/server/app/api/cli-tools/codex-settings/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/cli-tools/copilot-settings/route.js +2 -2
- package/.next/standalone/.next/server/app/api/cli-tools/copilot-settings/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/cli-tools/droid-settings/route.js +1 -1
- package/.next/standalone/.next/server/app/api/cli-tools/droid-settings/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/cli-tools/openclaw-settings/route.js +1 -1
- package/.next/standalone/.next/server/app/api/cli-tools/openclaw-settings/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/cli-tools/opencode-settings/route.js +1 -1
- package/.next/standalone/.next/server/app/api/cli-tools/opencode-settings/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/keys/[id]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/keys/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/locale/route.js +2 -2
- package/.next/standalone/.next/server/app/api/locale/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/models/alias/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/models/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/providers/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/version/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +4 -4
- package/.next/standalone/.next/server/app/index.segments/!KGRhc2hib2FyZCk/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +4 -4
- package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/mitm.html +1 -1
- package/.next/standalone/.next/server/app/mitm.rsc +5 -5
- package/.next/standalone/.next/server/app/mitm.segments/!KGRhc2hib2FyZCk/mitm/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/mitm.segments/!KGRhc2hib2FyZCk/mitm.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/mitm.segments/_full.segment.rsc +5 -5
- package/.next/standalone/.next/server/app/mitm.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/mitm.segments/_index.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/mitm.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app-paths-manifest.json +5 -5
- package/.next/standalone/.next/server/chunks/411.js +1 -1
- package/.next/standalone/.next/server/middleware.js +2 -2
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +2 -2
- package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/static/chunks/{702-90a93bbee38dba8f.js → 702-0864796c00fc702e.js} +1 -1
- package/.next/standalone/node_modules/node-forge/LICENSE +331 -0
- package/.next/standalone/node_modules/node-forge/README.md +2071 -0
- package/.next/standalone/node_modules/node-forge/dist/forge.all.min.js +2 -0
- package/.next/standalone/node_modules/node-forge/dist/forge.all.min.js.map +1 -0
- package/.next/standalone/node_modules/node-forge/dist/forge.min.js +2 -0
- package/.next/standalone/node_modules/node-forge/dist/forge.min.js.map +1 -0
- package/.next/standalone/node_modules/node-forge/dist/prime.worker.min.js +2 -0
- package/.next/standalone/node_modules/node-forge/dist/prime.worker.min.js.map +1 -0
- package/.next/standalone/node_modules/node-forge/flash/swf/SocketPool.swf +0 -0
- package/.next/standalone/node_modules/node-forge/lib/aes.js +1091 -0
- package/.next/standalone/node_modules/node-forge/lib/aesCipherSuites.js +282 -0
- package/.next/standalone/node_modules/node-forge/lib/asn1-validator.js +91 -0
- package/.next/standalone/node_modules/node-forge/lib/asn1.js +1503 -0
- package/.next/standalone/node_modules/node-forge/lib/baseN.js +186 -0
- package/.next/standalone/node_modules/node-forge/lib/cipher.js +230 -0
- package/.next/standalone/node_modules/node-forge/lib/cipherModes.js +999 -0
- package/.next/standalone/node_modules/node-forge/lib/des.js +496 -0
- package/.next/standalone/node_modules/node-forge/lib/ed25519.js +1072 -0
- package/.next/standalone/node_modules/node-forge/lib/forge.js +13 -0
- package/.next/standalone/node_modules/node-forge/lib/form.js +149 -0
- package/.next/standalone/node_modules/node-forge/lib/hmac.js +146 -0
- package/.next/standalone/node_modules/node-forge/lib/http.js +1346 -0
- package/.next/standalone/node_modules/node-forge/lib/index.all.js +16 -0
- package/.next/standalone/node_modules/node-forge/lib/index.js +33 -0
- package/.next/standalone/node_modules/node-forge/lib/jsbn.js +1264 -0
- package/.next/standalone/node_modules/node-forge/lib/kem.js +168 -0
- package/.next/standalone/node_modules/node-forge/lib/log.js +319 -0
- package/.next/standalone/node_modules/node-forge/lib/md.all.js +13 -0
- package/.next/standalone/node_modules/node-forge/lib/md.js +11 -0
- package/.next/standalone/node_modules/node-forge/lib/md5.js +289 -0
- package/.next/standalone/node_modules/node-forge/lib/mgf.js +12 -0
- package/.next/standalone/node_modules/node-forge/lib/mgf1.js +57 -0
- package/.next/standalone/node_modules/node-forge/lib/oids.js +179 -0
- package/.next/standalone/node_modules/node-forge/lib/pbe.js +1023 -0
- package/.next/standalone/node_modules/node-forge/lib/pbkdf2.js +211 -0
- package/.next/standalone/node_modules/node-forge/lib/pem.js +237 -0
- package/.next/standalone/node_modules/node-forge/lib/pkcs1.js +276 -0
- package/.next/standalone/node_modules/node-forge/lib/pkcs12.js +1078 -0
- package/.next/standalone/node_modules/node-forge/lib/pkcs7.js +1260 -0
- package/.next/standalone/node_modules/node-forge/lib/pkcs7asn1.js +410 -0
- package/.next/standalone/node_modules/node-forge/lib/pki.js +102 -0
- package/.next/standalone/node_modules/node-forge/lib/prime.js +297 -0
- package/.next/standalone/node_modules/node-forge/lib/prime.worker.js +168 -0
- package/.next/standalone/node_modules/node-forge/lib/prng.js +419 -0
- package/.next/standalone/node_modules/node-forge/lib/pss.js +241 -0
- package/.next/standalone/node_modules/node-forge/lib/random.js +191 -0
- package/.next/standalone/node_modules/node-forge/lib/rc2.js +410 -0
- package/.next/standalone/node_modules/node-forge/lib/rsa.js +1949 -0
- package/.next/standalone/node_modules/node-forge/lib/sha1.js +319 -0
- package/.next/standalone/node_modules/node-forge/lib/sha256.js +327 -0
- package/.next/standalone/node_modules/node-forge/lib/sha512.js +561 -0
- package/.next/standalone/node_modules/node-forge/lib/socket.js +287 -0
- package/.next/standalone/node_modules/node-forge/lib/ssh.js +236 -0
- package/.next/standalone/node_modules/node-forge/lib/tls.js +4282 -0
- package/.next/standalone/node_modules/node-forge/lib/tlssocket.js +249 -0
- package/.next/standalone/node_modules/node-forge/lib/util.js +2652 -0
- package/.next/standalone/node_modules/node-forge/lib/x509.js +3242 -0
- package/.next/standalone/node_modules/node-forge/lib/xhr.js +738 -0
- package/.next/standalone/node_modules/node-forge/package.json +123 -0
- package/.next/standalone/node_modules/node-machine-id/.babelrc +26 -0
- package/.next/standalone/node_modules/node-machine-id/.eslintignore +2 -0
- package/.next/standalone/node_modules/node-machine-id/.eslintrc +140 -0
- package/.next/standalone/node_modules/node-machine-id/.flowconfig +9 -0
- package/.next/standalone/node_modules/node-machine-id/LICENSE +21 -0
- package/.next/standalone/node_modules/node-machine-id/README.md +84 -0
- package/.next/standalone/node_modules/node-machine-id/dist/index.js +1 -0
- package/.next/standalone/node_modules/node-machine-id/index.js +80 -0
- package/.next/standalone/node_modules/node-machine-id/package.json +74 -0
- package/.next/standalone/node_modules/node-machine-id/tests/index.js +45 -0
- package/.next/standalone/node_modules/node-machine-id/types/index.d.ts +17 -0
- package/.next/standalone/node_modules/node-machine-id/webpack.config.babel.js +59 -0
- package/.next/standalone/package.json +1 -1
- package/.next/standalone/src/mitm/cert/generate.js +32 -0
- package/.next/standalone/src/mitm/cert/install.js +176 -0
- package/.next/standalone/src/mitm/cert/rootCA.js +173 -0
- package/.next/standalone/src/mitm/dns/dnsConfig.js +216 -0
- package/.next/standalone/src/mitm/logger.js +8 -0
- package/.next/standalone/src/mitm/manager.js +603 -0
- package/.next/standalone/src/mitm/paths.js +16 -0
- package/package.json +1 -1
- /package/.next/standalone/.next/static/{Ws7kclTEFgfHRwd7pk9Ly → DkVxg6bby4SUixuq1vdO8}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{Ws7kclTEFgfHRwd7pk9Ly → DkVxg6bby4SUixuq1vdO8}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Socket wrapping functions for TLS.
|
|
3
|
+
*
|
|
4
|
+
* @author Dave Longley
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2009-2012 Digital Bazaar, Inc.
|
|
7
|
+
*/
|
|
8
|
+
var forge = require('./forge');
|
|
9
|
+
require('./tls');
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Wraps a forge.net socket with a TLS layer.
|
|
13
|
+
*
|
|
14
|
+
* @param options:
|
|
15
|
+
* sessionId: a session ID to reuse, null for a new connection if no session
|
|
16
|
+
* cache is provided or it is empty.
|
|
17
|
+
* caStore: an array of certificates to trust.
|
|
18
|
+
* sessionCache: a session cache to use.
|
|
19
|
+
* cipherSuites: an optional array of cipher suites to use, see
|
|
20
|
+
* tls.CipherSuites.
|
|
21
|
+
* socket: the socket to wrap.
|
|
22
|
+
* virtualHost: the virtual server name to use in a TLS SNI extension.
|
|
23
|
+
* verify: a handler used to custom verify certificates in the chain.
|
|
24
|
+
* getCertificate: an optional callback used to get a certificate.
|
|
25
|
+
* getPrivateKey: an optional callback used to get a private key.
|
|
26
|
+
* getSignature: an optional callback used to get a signature.
|
|
27
|
+
* deflate: function(inBytes) if provided, will deflate TLS records using
|
|
28
|
+
* the deflate algorithm if the server supports it.
|
|
29
|
+
* inflate: function(inBytes) if provided, will inflate TLS records using
|
|
30
|
+
* the deflate algorithm if the server supports it.
|
|
31
|
+
*
|
|
32
|
+
* @return the TLS-wrapped socket.
|
|
33
|
+
*/
|
|
34
|
+
forge.tls.wrapSocket = function(options) {
|
|
35
|
+
// get raw socket
|
|
36
|
+
var socket = options.socket;
|
|
37
|
+
|
|
38
|
+
// create TLS socket
|
|
39
|
+
var tlsSocket = {
|
|
40
|
+
id: socket.id,
|
|
41
|
+
// set handlers
|
|
42
|
+
connected: socket.connected || function(e) {},
|
|
43
|
+
closed: socket.closed || function(e) {},
|
|
44
|
+
data: socket.data || function(e) {},
|
|
45
|
+
error: socket.error || function(e) {}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// create TLS connection
|
|
49
|
+
var c = forge.tls.createConnection({
|
|
50
|
+
server: false,
|
|
51
|
+
sessionId: options.sessionId || null,
|
|
52
|
+
caStore: options.caStore || [],
|
|
53
|
+
sessionCache: options.sessionCache || null,
|
|
54
|
+
cipherSuites: options.cipherSuites || null,
|
|
55
|
+
virtualHost: options.virtualHost,
|
|
56
|
+
verify: options.verify,
|
|
57
|
+
getCertificate: options.getCertificate,
|
|
58
|
+
getPrivateKey: options.getPrivateKey,
|
|
59
|
+
getSignature: options.getSignature,
|
|
60
|
+
deflate: options.deflate,
|
|
61
|
+
inflate: options.inflate,
|
|
62
|
+
connected: function(c) {
|
|
63
|
+
// first handshake complete, call handler
|
|
64
|
+
if(c.handshakes === 1) {
|
|
65
|
+
tlsSocket.connected({
|
|
66
|
+
id: socket.id,
|
|
67
|
+
type: 'connect',
|
|
68
|
+
bytesAvailable: c.data.length()
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
tlsDataReady: function(c) {
|
|
73
|
+
// send TLS data over socket
|
|
74
|
+
return socket.send(c.tlsData.getBytes());
|
|
75
|
+
},
|
|
76
|
+
dataReady: function(c) {
|
|
77
|
+
// indicate application data is ready
|
|
78
|
+
tlsSocket.data({
|
|
79
|
+
id: socket.id,
|
|
80
|
+
type: 'socketData',
|
|
81
|
+
bytesAvailable: c.data.length()
|
|
82
|
+
});
|
|
83
|
+
},
|
|
84
|
+
closed: function(c) {
|
|
85
|
+
// close socket
|
|
86
|
+
socket.close();
|
|
87
|
+
},
|
|
88
|
+
error: function(c, e) {
|
|
89
|
+
// send error, close socket
|
|
90
|
+
tlsSocket.error({
|
|
91
|
+
id: socket.id,
|
|
92
|
+
type: 'tlsError',
|
|
93
|
+
message: e.message,
|
|
94
|
+
bytesAvailable: 0,
|
|
95
|
+
error: e
|
|
96
|
+
});
|
|
97
|
+
socket.close();
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
// handle doing handshake after connecting
|
|
102
|
+
socket.connected = function(e) {
|
|
103
|
+
c.handshake(options.sessionId);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// handle closing TLS connection
|
|
107
|
+
socket.closed = function(e) {
|
|
108
|
+
if(c.open && c.handshaking) {
|
|
109
|
+
// error
|
|
110
|
+
tlsSocket.error({
|
|
111
|
+
id: socket.id,
|
|
112
|
+
type: 'ioError',
|
|
113
|
+
message: 'Connection closed during handshake.',
|
|
114
|
+
bytesAvailable: 0
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
c.close();
|
|
118
|
+
|
|
119
|
+
// call socket handler
|
|
120
|
+
tlsSocket.closed({
|
|
121
|
+
id: socket.id,
|
|
122
|
+
type: 'close',
|
|
123
|
+
bytesAvailable: 0
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
// handle error on socket
|
|
128
|
+
socket.error = function(e) {
|
|
129
|
+
// error
|
|
130
|
+
tlsSocket.error({
|
|
131
|
+
id: socket.id,
|
|
132
|
+
type: e.type,
|
|
133
|
+
message: e.message,
|
|
134
|
+
bytesAvailable: 0
|
|
135
|
+
});
|
|
136
|
+
c.close();
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
// handle receiving raw TLS data from socket
|
|
140
|
+
var _requiredBytes = 0;
|
|
141
|
+
socket.data = function(e) {
|
|
142
|
+
// drop data if connection not open
|
|
143
|
+
if(!c.open) {
|
|
144
|
+
socket.receive(e.bytesAvailable);
|
|
145
|
+
} else {
|
|
146
|
+
// only receive if there are enough bytes available to
|
|
147
|
+
// process a record
|
|
148
|
+
if(e.bytesAvailable >= _requiredBytes) {
|
|
149
|
+
var count = Math.max(e.bytesAvailable, _requiredBytes);
|
|
150
|
+
var data = socket.receive(count);
|
|
151
|
+
if(data !== null) {
|
|
152
|
+
_requiredBytes = c.process(data);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Destroys this socket.
|
|
160
|
+
*/
|
|
161
|
+
tlsSocket.destroy = function() {
|
|
162
|
+
socket.destroy();
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Sets this socket's TLS session cache. This should be called before
|
|
167
|
+
* the socket is connected or after it is closed.
|
|
168
|
+
*
|
|
169
|
+
* The cache is an object mapping session IDs to internal opaque state.
|
|
170
|
+
* An application might need to change the cache used by a particular
|
|
171
|
+
* tlsSocket between connections if it accesses multiple TLS hosts.
|
|
172
|
+
*
|
|
173
|
+
* @param cache the session cache to use.
|
|
174
|
+
*/
|
|
175
|
+
tlsSocket.setSessionCache = function(cache) {
|
|
176
|
+
c.sessionCache = tls.createSessionCache(cache);
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Connects this socket.
|
|
181
|
+
*
|
|
182
|
+
* @param options:
|
|
183
|
+
* host: the host to connect to.
|
|
184
|
+
* port: the port to connect to.
|
|
185
|
+
* policyPort: the policy port to use (if non-default), 0 to
|
|
186
|
+
* use the flash default.
|
|
187
|
+
* policyUrl: the policy file URL to use (instead of port).
|
|
188
|
+
*/
|
|
189
|
+
tlsSocket.connect = function(options) {
|
|
190
|
+
socket.connect(options);
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Closes this socket.
|
|
195
|
+
*/
|
|
196
|
+
tlsSocket.close = function() {
|
|
197
|
+
c.close();
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Determines if the socket is connected or not.
|
|
202
|
+
*
|
|
203
|
+
* @return true if connected, false if not.
|
|
204
|
+
*/
|
|
205
|
+
tlsSocket.isConnected = function() {
|
|
206
|
+
return c.isConnected && socket.isConnected();
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Writes bytes to this socket.
|
|
211
|
+
*
|
|
212
|
+
* @param bytes the bytes (as a string) to write.
|
|
213
|
+
*
|
|
214
|
+
* @return true on success, false on failure.
|
|
215
|
+
*/
|
|
216
|
+
tlsSocket.send = function(bytes) {
|
|
217
|
+
return c.prepare(bytes);
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Reads bytes from this socket (non-blocking). Fewer than the number of
|
|
222
|
+
* bytes requested may be read if enough bytes are not available.
|
|
223
|
+
*
|
|
224
|
+
* This method should be called from the data handler if there are enough
|
|
225
|
+
* bytes available. To see how many bytes are available, check the
|
|
226
|
+
* 'bytesAvailable' property on the event in the data handler or call the
|
|
227
|
+
* bytesAvailable() function on the socket. If the browser is msie, then the
|
|
228
|
+
* bytesAvailable() function should be used to avoid race conditions.
|
|
229
|
+
* Otherwise, using the property on the data handler's event may be quicker.
|
|
230
|
+
*
|
|
231
|
+
* @param count the maximum number of bytes to read.
|
|
232
|
+
*
|
|
233
|
+
* @return the bytes read (as a string) or null on error.
|
|
234
|
+
*/
|
|
235
|
+
tlsSocket.receive = function(count) {
|
|
236
|
+
return c.data.getBytes(count);
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Gets the number of bytes available for receiving on the socket.
|
|
241
|
+
*
|
|
242
|
+
* @return the number of bytes available for receiving.
|
|
243
|
+
*/
|
|
244
|
+
tlsSocket.bytesAvailable = function() {
|
|
245
|
+
return c.data.length();
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
return tlsSocket;
|
|
249
|
+
};
|