Commit 90302d3
Don't use IP literals for TLS SNI
An authority containing an IP literal (e.g. a .dns target created with
an IP address, common when callers resolve addresses themselves) was
passed to the TLS handshake as the SNI server hostname. RFC 6066 § 3
only permits DNS hostnames in SNI and NIOSSL enforces this, so such
connections failed with cannotUseIPAddressInSNI before the handshake
started. SocketAddress.sniHostname already applies this rule; the
authority-derived hostname now does too: IP literals (bare v4/v6, with
a port, or bracketed v6) yield no SNI instead of a handshake failure.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>1 parent 2ca31f0 commit 90302d3
2 files changed
Lines changed: 50 additions & 5 deletions
File tree
- Sources/GRPCNIOTransportCore/Client/Connection
- Tests/GRPCNIOTransportCoreTests/Client/Connection
Lines changed: 25 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
119 | 127 | | |
120 | 128 | | |
121 | 129 | | |
122 | 130 | | |
123 | 131 | | |
124 | 132 | | |
| 133 | + | |
125 | 134 | | |
126 | | - | |
| 135 | + | |
127 | 136 | | |
128 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
129 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
130 | 151 | | |
131 | 152 | | |
132 | 153 | | |
| |||
138 | 159 | | |
139 | 160 | | |
140 | 161 | | |
141 | | - | |
| 162 | + | |
142 | 163 | | |
143 | 164 | | |
144 | 165 | | |
| |||
Lines changed: 25 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
205 | | - | |
| 205 | + | |
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
| |||
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
242 | 266 | | |
243 | 267 | | |
244 | 268 | | |
| |||
0 commit comments