Commit 631a29e
authored
fix DoH error when using ip address as hostname (#7073)
* fix DoH error when using ip address as hostname
* lookup hostname first and try to parse as IP address only when lookup failed
* add unit test in DnsOverHttpsTest for the case that Doing DNS lookup with an IP address hostname
* use simpler ipAddress check instead of complex support functions
* add test case for some special ipv6 addresses
* use existing ipAddress check functions instead of adding a new similar function
* avoid to do dns lookup when the hostname is already an IP address
* code style update
* add test case
* use loopback address instead of localhost1 parent d88e29a commit 631a29e
File tree
2 files changed
+34
-6
lines changed- okhttp/src
- jvmMain/kotlin/okhttp3/internal/connection
- jvmTest/java/okhttp3
2 files changed
+34
-6
lines changedLines changed: 13 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| 30 | + | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
| |||
159 | 161 | | |
160 | 162 | | |
161 | 163 | | |
162 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
163 | 173 | | |
164 | | - | |
165 | | - | |
166 | | - | |
| 174 | + | |
| 175 | + | |
167 | 176 | | |
168 | 177 | | |
169 | | - | |
170 | | - | |
171 | 178 | | |
172 | 179 | | |
173 | 180 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
142 | 163 | | |
143 | 164 | | |
144 | 165 | | |
| |||
0 commit comments