- Notifications
You must be signed in to change notification settings - Fork4.9k
Commita2d9f94
committed
Don't assume that "E" response to NEGOTIATE_SSL_CODE means pre-7.0 server.
These days, such a response is far more likely to signify a server-sideproblem, such as fork failure. Reporting "server does not support SSL"(in sslmode=require) could be quite misleading. But the results couldbe even worse in sslmode=prefer: if the problem was transient and thenext connection attempt succeeds, we'll have silently fallen back toprotocol version 2.0, possibly disabling features the user needs.Hence, it seems best to just eliminate the assumption that backing offto non-SSL/2.0 protocol is the way to recover from an "E" response, andinstead treat the server error the same as we would in non-SSL cases.I tested this change against a pre-7.0 server, and found that therewas a second logic bug in the "prefer" path: the test to decide whetherto make a fallback connection attempt assumed that we must have openedconn->ssl, which in fact does not happen given an "E" response. Afterfixing that, the code does indeed connect successfully to pre-7.0,as long as you didn't set sslmode=require. (If you did, you get"Unsupported frontend protocol", which isn't completely off basegiven the server certainly doesn't support SSL.)Since there seems no reason to believe that pre-7.0 servers exist anymorein the wild, back-patch to all supported branches.1 parentbb42ad1 commita2d9f94
1 file changed
+17
-25
lines changedLines changed: 17 additions & 25 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1337 | 1337 |
| |
1338 | 1338 |
| |
1339 | 1339 |
| |
1340 |
| - | |
1341 |
| - | |
1342 | 1340 |
| |
1343 | 1341 |
| |
| 1342 | + | |
| 1343 | + | |
1344 | 1344 |
| |
1345 | 1345 |
| |
1346 | 1346 |
| |
1347 | 1347 |
| |
1348 | 1348 |
| |
1349 | 1349 |
| |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
1350 | 1353 |
| |
1351 | 1354 |
| |
1352 | 1355 |
| |
| |||
1361 | 1364 |
| |
1362 | 1365 |
| |
1363 | 1366 |
| |
1364 |
| - | |
1365 |
| - | |
1366 |
| - | |
1367 |
| - | |
1368 |
| - | |
1369 |
| - | |
1370 |
| - | |
1371 |
| - | |
1372 |
| - | |
1373 |
| - | |
1374 |
| - | |
1375 |
| - | |
1376 |
| - | |
1377 |
| - | |
1378 |
| - | |
1379 |
| - | |
1380 |
| - | |
1381 |
| - | |
1382 |
| - | |
1383 |
| - | |
1384 |
| - | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
1385 | 1378 |
| |
1386 | 1379 |
| |
1387 | 1380 |
| |
| |||
1614 | 1607 |
| |
1615 | 1608 |
| |
1616 | 1609 |
| |
1617 |
| - | |
1618 |
| - | |
| 1610 | + | |
1619 | 1611 |
| |
1620 | 1612 |
| |
1621 | 1613 |
| |
|
0 commit comments
Comments
(0)