Expand description
Node https module: HTTP/1.1 over real TLS.
Server: https.createServer(options, requestListener) builds a tls server
(real rustls handshake, see tls.rs) whose per-connection hook attaches an
HTTP/1.1 request parser. As decrypted bytes arrive (tls::on_socket_data →
https::feed) we parse complete requests, build an IncomingMessage (req)
and a response object (res), and call the user’s (req, res) listener.
res.end serializes an HTTP/1.1 response and writes it back through the TLS
channel via tls::socket_write.
Client: https.request(options[, cb]) / https.get(url[, cb]) open a blocking
TLS connection on a background thread, write the request, read the full
response (the request forces Connection: close, so read-to-EOF is reliable),
parse it into an IncomingMessage, and fire cb(res) on the main thread.
The HTTP/1.1 request parser and response serializer here are minimal
reimplementations of the private logic in http.rs (parse_request,
serialize_response). They are duplicated because that logic writes to net
sockets via net::socket_write_id, whereas an https response must go through
the TLS write channel. If http::parse_request/ParsedReq/serialize_response/
ResState were made pub (and response writing were sink-agnostic), https
could delegate to them instead.
Constants§
- CLIENT_
REQUEST_ METHODS - MODULE_
METHODS httpsmodule functions routed throughstdlib::call.- RESPONSE_
METHODS - Instance method names for this module’s
@@nativetags (property reads that yield a bound method), exposed tostdlib::instance_has_method.
Functions§
- call
stdlib::callentry forhttps.<method>.- constant
https.Agent/https.globalAgent: a minimal stub. node-js opens a fresh connection per request (no pooling / keep-alive reuse), so an Agent carries no behavior beyond being a constructible/inspectable object.- create_
server - drop_
conn - Discard an https connection when its TLS socket closes (called by
tls). - feed
- Feed decrypted bytes into the https request parser. No-op for a socket that is not an https connection. Runs on the main thread.
- instance_
call - request
https.request(options[, cb])/https.get(url|options[, cb]). Returns aClientRequest(aHTTPSClientRequestemitter).getauto-sends.