Commit 836ce8a
Itay Neeman
Add better handling for Keep-Alive connections
Python's httplib generally has bad support for Keep-Alive connections,
which is why we never used it. We didn't explicitly ask for "Connection: Close",
but it was implicit. Additionally, splunkd would always return it.
However, an issue arises when talking to a Load Balancer which issues
a Keep-Alive request to splunkd, and returns that header to us. Python
then goes into a particular path which the code didn't handle gracefully.
What this change does is two-fold:
1. Always request to close the connection via the "Connection: Close" header.
2. If we get back a "Connection: Keep-Alive" header, we properly handle
it by not immediately closing our reference to the connection and only
doing so when the response has been completed.1 parent d9249bc commit 836ce8a
1 file changed
+10
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1235 | 1235 | | |
1236 | 1236 | | |
1237 | 1237 | | |
1238 | | - | |
| 1238 | + | |
1239 | 1239 | | |
| 1240 | + | |
1240 | 1241 | | |
1241 | 1242 | | |
1242 | 1243 | | |
| |||
1262 | 1263 | | |
1263 | 1264 | | |
1264 | 1265 | | |
| 1266 | + | |
| 1267 | + | |
1265 | 1268 | | |
1266 | 1269 | | |
1267 | 1270 | | |
| |||
1332 | 1335 | | |
1333 | 1336 | | |
1334 | 1337 | | |
| 1338 | + | |
1335 | 1339 | | |
1336 | 1340 | | |
1337 | 1341 | | |
1338 | 1342 | | |
1339 | 1343 | | |
1340 | 1344 | | |
| 1345 | + | |
1341 | 1346 | | |
1342 | 1347 | | |
1343 | 1348 | | |
1344 | 1349 | | |
1345 | 1350 | | |
| 1351 | + | |
1346 | 1352 | | |
1347 | | - | |
| 1353 | + | |
| 1354 | + | |
1348 | 1355 | | |
1349 | 1356 | | |
1350 | 1357 | | |
1351 | 1358 | | |
1352 | 1359 | | |
1353 | | - | |
| 1360 | + | |
1354 | 1361 | | |
1355 | 1362 | | |
1356 | 1363 | | |
0 commit comments