Skip to content

Commit b731e61

Browse files
authored
doc: replace session with connection (#233)
There were a few holdovers from when we renamed session to connection.
1 parent 8841c67 commit b731e61

File tree

3 files changed

+27
-25
lines changed

3 files changed

+27
-25
lines changed

src/client.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ impl rustls_client_config_builder {
285285
///
286286
/// If you intend to write a verifier that accepts all certificates, be aware
287287
/// that special measures are required for IP addresses. Rustls currently
288-
/// (0.20.0) doesn't support building a ClientSession with an IP address
288+
/// (0.20.0) doesn't support building a ClientConnection with an IP address
289289
/// (because it's not a valid DnsNameRef). One workaround is to detect IP
290290
/// addresses and rewrite them to `example.invalid`, and _also_ to disable
291291
/// SNI via rustls_client_config_builder_set_enable_sni (IP addresses don't
@@ -422,7 +422,7 @@ impl rustls_client_config_builder {
422422
}
423423
}
424424

425-
/// Provide the configuration a list of certificates where the session
425+
/// Provide the configuration a list of certificates where the connection
426426
/// will select the first one that is compatible with the server's signature
427427
/// verification capabilities. Clients that want to support both ECDSA and
428428
/// RSA certificates will want the ECSDA to go first in the list.
@@ -531,7 +531,7 @@ impl rustls_client_config {
531531

532532
/// Create a new rustls_connection containing a client connection and return
533533
/// it in the output parameter `out`. If this returns an error code, the
534-
/// memory pointed to by `session_out` remains unchanged. If this returns a
534+
/// memory pointed to by `conn_out` remains unchanged. If this returns a
535535
/// non-error, the memory pointed to by `conn_out` is modified to point at a
536536
/// valid rustls_connection. The caller now owns the rustls_connection and must
537537
/// call `rustls_connection_free` when done with it.

src/rustls.h

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,9 @@ typedef struct rustls_client_hello {
400400
* NOTE:
401401
* - the passed in `hello` and all its values are only available during the
402402
* callback invocations.
403-
* - the passed callback function must be implemented thread-safe, unless
404-
* there is only a single config and session where it is installed.
403+
* - the passed callback function must be safe to call multiple times concurrently
404+
* with the same userdata, unless there is only a single config and connection
405+
* where it is installed.
405406
*
406407
* EXPERIMENTAL: this feature of crustls is likely to change in the future, as
407408
* the rustls library is re-evaluating their current approach to client hello handling.
@@ -683,7 +684,7 @@ rustls_result rustls_client_config_builder_new_custom(const struct rustls_suppor
683684
*
684685
* If you intend to write a verifier that accepts all certificates, be aware
685686
* that special measures are required for IP addresses. Rustls currently
686-
* (0.20.0) doesn't support building a ClientSession with an IP address
687+
* (0.20.0) doesn't support building a ClientConnection with an IP address
687688
* (because it's not a valid DnsNameRef). One workaround is to detect IP
688689
* addresses and rewrite them to `example.invalid`, and _also_ to disable
689690
* SNI via rustls_client_config_builder_set_enable_sni (IP addresses don't
@@ -742,7 +743,7 @@ void rustls_client_config_builder_set_enable_sni(struct rustls_client_config_bui
742743
bool enable);
743744

744745
/**
745-
* Provide the configuration a list of certificates where the session
746+
* Provide the configuration a list of certificates where the connection
746747
* will select the first one that is compatible with the server's signature
747748
* verification capabilities. Clients that want to support both ECDSA and
748749
* RSA certificates will want the ECSDA to go first in the list.
@@ -787,7 +788,7 @@ void rustls_client_config_free(const struct rustls_client_config *config);
787788
/**
788789
* Create a new rustls_connection containing a client connection and return
789790
* it in the output parameter `out`. If this returns an error code, the
790-
* memory pointed to by `session_out` remains unchanged. If this returns a
791+
* memory pointed to by `conn_out` remains unchanged. If this returns a
791792
* non-error, the memory pointed to by `conn_out` is modified to point at a
792793
* valid rustls_connection. The caller now owns the rustls_connection and must
793794
* call `rustls_connection_free` when done with it.
@@ -1112,7 +1113,7 @@ rustls_result rustls_server_config_builder_set_alpn_protocols(struct rustls_serv
11121113
size_t len);
11131114

11141115
/**
1115-
* Provide the configuration a list of certificates where the session
1116+
* Provide the configuration a list of certificates where the connection
11161117
* will select the first one that is compatible with the client's signature
11171118
* verification capabilities. Servers that want to support both ECDSA and
11181119
* RSA certificates will want the ECSDA to go first in the list.
@@ -1148,8 +1149,8 @@ void rustls_server_config_free(const struct rustls_server_config *config);
11481149
/**
11491150
* Create a new rustls_connection containing a server connection, and return it
11501151
* in the output parameter `out`. If this returns an error code, the memory
1151-
* pointed to by `session_out` remains unchanged. If this returns a non-error,
1152-
* the memory pointed to by `session_out` is modified to point
1152+
* pointed to by `conn_out` remains unchanged. If this returns a non-error,
1153+
* the memory pointed to by `conn_out` is modified to point
11531154
* at a valid rustls_connection. The caller now owns the rustls_connection
11541155
* and must call `rustls_connection_free` when done with it.
11551156
*/
@@ -1161,7 +1162,7 @@ rustls_result rustls_server_connection_new(const struct rustls_server_config *co
11611162
* and the length of that hostname in `out_n`. The string is stored in UTF-8
11621163
* with no terminating NUL byte.
11631164
* Returns RUSTLS_RESULT_INSUFFICIENT_SIZE if the SNI hostname is longer than `count`.
1164-
* Returns Ok with *out_n == 0 if there is no SNI hostname available on this session
1165+
* Returns Ok with *out_n == 0 if there is no SNI hostname available on this connection
11651166
* because it hasn't been processed yet, or because the client did not send SNI.
11661167
* <https://docs.rs/rustls/0.20.0/rustls/server/struct.ServerConnection.html#method.sni_hostname>
11671168
*/
@@ -1171,8 +1172,8 @@ rustls_result rustls_server_connection_get_sni_hostname(const struct rustls_conn
11711172
size_t *out_n);
11721173

11731174
/**
1174-
* Register a callback to be invoked when a session created from this config
1175-
* is seeing a TLS ClientHello message. If `userdata` has been set with
1175+
* Register a callback to be invoked when a connection created from this config
1176+
* sees a TLS ClientHello message. If `userdata` has been set with
11761177
* rustls_connection_set_userdata, it will be passed to the callback.
11771178
* Otherwise the userdata param passed to the callback will be NULL.
11781179
*
@@ -1213,7 +1214,7 @@ rustls_result rustls_client_hello_select_certified_key(const struct rustls_clien
12131214
/**
12141215
* Register callbacks for persistence of TLS session IDs and secrets. Both
12151216
* keys and values are highly sensitive data, containing enough information
1216-
* to break the security of the sessions involved.
1217+
* to break the security of the connections involved.
12171218
*
12181219
* If `userdata` has been set with rustls_connection_set_userdata, it
12191220
* will be passed to the callbacks. Otherwise the userdata param passed to

src/server.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ impl rustls_server_config_builder {
252252
}
253253
}
254254

255-
/// Provide the configuration a list of certificates where the session
255+
/// Provide the configuration a list of certificates where the connection
256256
/// will select the first one that is compatible with the client's signature
257257
/// verification capabilities. Servers that want to support both ECDSA and
258258
/// RSA certificates will want the ECSDA to go first in the list.
@@ -329,8 +329,8 @@ impl rustls_server_config {
329329

330330
/// Create a new rustls_connection containing a server connection, and return it
331331
/// in the output parameter `out`. If this returns an error code, the memory
332-
/// pointed to by `session_out` remains unchanged. If this returns a non-error,
333-
/// the memory pointed to by `session_out` is modified to point
332+
/// pointed to by `conn_out` remains unchanged. If this returns a non-error,
333+
/// the memory pointed to by `conn_out` is modified to point
334334
/// at a valid rustls_connection. The caller now owns the rustls_connection
335335
/// and must call `rustls_connection_free` when done with it.
336336
#[no_mangle]
@@ -359,7 +359,7 @@ impl rustls_server_config {
359359
/// and the length of that hostname in `out_n`. The string is stored in UTF-8
360360
/// with no terminating NUL byte.
361361
/// Returns RUSTLS_RESULT_INSUFFICIENT_SIZE if the SNI hostname is longer than `count`.
362-
/// Returns Ok with *out_n == 0 if there is no SNI hostname available on this session
362+
/// Returns Ok with *out_n == 0 if there is no SNI hostname available on this connection
363363
/// because it hasn't been processed yet, or because the client did not send SNI.
364364
/// <https://docs.rs/rustls/0.20.0/rustls/server/struct.ServerConnection.html#method.sni_hostname>
365365
#[no_mangle]
@@ -393,7 +393,7 @@ pub extern "C" fn rustls_server_connection_get_sni_hostname(
393393
}
394394
}
395395

396-
/// Choose the server certificate to be used for a session based on certificate
396+
/// Choose the server certificate to be used for a connection based on certificate
397397
/// type. Will pick the first CertfiedKey available that is suitable for
398398
/// the SignatureSchemes supported by the client.
399399
struct ResolvesServerCertFromChoices {
@@ -462,8 +462,9 @@ pub type rustls_client_hello_userdata = *mut c_void;
462462
/// NOTE:
463463
/// - the passed in `hello` and all its values are only available during the
464464
/// callback invocations.
465-
/// - the passed callback function must be implemented thread-safe, unless
466-
/// there is only a single config and session where it is installed.
465+
/// - the passed callback function must be safe to call multiple times concurrently
466+
/// with the same userdata, unless there is only a single config and connection
467+
/// where it is installed.
467468
///
468469
/// EXPERIMENTAL: this feature of crustls is likely to change in the future, as
469470
/// the rustls library is re-evaluating their current approach to client hello handling.
@@ -542,8 +543,8 @@ unsafe impl Sync for ClientHelloResolver {}
542543
unsafe impl Send for ClientHelloResolver {}
543544

544545
impl rustls_server_config_builder {
545-
/// Register a callback to be invoked when a session created from this config
546-
/// is seeing a TLS ClientHello message. If `userdata` has been set with
546+
/// Register a callback to be invoked when a connection created from this config
547+
/// sees a TLS ClientHello message. If `userdata` has been set with
547548
/// rustls_connection_set_userdata, it will be passed to the callback.
548549
/// Otherwise the userdata param passed to the callback will be NULL.
549550
///
@@ -645,7 +646,7 @@ pub extern "C" fn rustls_client_hello_select_certified_key(
645646
impl rustls_server_config_builder {
646647
/// Register callbacks for persistence of TLS session IDs and secrets. Both
647648
/// keys and values are highly sensitive data, containing enough information
648-
/// to break the security of the sessions involved.
649+
/// to break the security of the connections involved.
649650
///
650651
/// If `userdata` has been set with rustls_connection_set_userdata, it
651652
/// will be passed to the callbacks. Otherwise the userdata param passed to

0 commit comments

Comments
 (0)