1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00

tests: verify split initial HTTP requests with CURL_SMALLREQSEND

test1294: "split request" being when the entire request isn't sent in
the first go, and the remainder is sent in the PERFORM state. A GET
request is otherwise not sending anything during PERFORM.

test1295: same kind of split but with POST

Closes #5197
This commit is contained in:
Daniel Stenberg 2020-04-07 15:10:37 +02:00
parent 0ef54abf52
commit 741cb81d09
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
3 changed files with 158 additions and 26 deletions

View File

@ -150,33 +150,32 @@ test1260 test1261 test1262 test1263 test1264 test1265 test1266 test1267 \
test1268 test1269 test1270 test1271 \
\
test1280 test1281 test1282 test1283 test1284 test1285 test1286 test1287 \
test1288 test1289 test1290 test1291 test1292 test1293 \
test1298 test1299 \
test1300 test1301 test1302 test1303 test1304 test1305 test1306 test1307 \
test1308 test1309 test1310 test1311 test1312 test1313 test1314 test1315 \
test1316 test1317 test1318 test1319 test1320 test1321 test1322 test1323 \
test1324 test1325 test1326 test1327 test1328 test1329 test1330 test1331 \
test1332 test1333 test1334 test1335 test1336 test1337 test1338 test1339 \
test1340 test1341 test1342 test1343 test1344 test1345 test1346 test1347 \
test1348 test1349 test1350 test1351 test1352 test1353 test1354 test1355 \
test1356 test1357 test1358 test1359 test1360 test1361 test1362 test1363 \
test1364 test1365 test1366 test1367 test1368 test1369 test1370 test1371 \
test1372 test1373 test1374 test1375 test1376 test1377 test1378 test1379 \
test1380 test1381 test1382 test1383 test1384 test1385 test1386 test1387 \
test1388 test1389 test1390 test1391 test1392 test1393 test1394 test1395 \
test1396 test1397 test1398 test1399 \
test1288 test1289 test1290 test1291 test1292 test1293 test1294 test1295 \
\
test1400 test1401 test1402 test1403 test1404 test1405 test1406 test1407 \
test1408 test1409 test1410 test1411 test1412 test1413 test1414 test1415 \
test1416 test1417 test1418 test1419 test1420 test1421 test1422 test1423 \
test1424 test1425 test1426 test1427 \
test1428 test1429 test1430 test1431 test1432 test1433 test1434 test1435 \
test1436 test1437 test1438 test1439 test1440 test1441 test1442 test1443 \
test1444 test1445 test1446 test1447 test1448 test1449 test1450 test1451 \
test1452 test1453 test1454 test1455 test1456 test1457 test1458 test1459 \
test1500 test1501 test1502 test1503 test1504 test1505 test1506 test1507 \
test1508 test1509 test1510 test1511 test1512 test1513 test1514 test1515 \
test1516 test1517 test1518 test1519 test1520 test1521 test1522 test1523 \
test1298 test1299 test1300 test1301 test1302 test1303 test1304 test1305 \
test1306 test1307 test1308 test1309 test1310 test1311 test1312 test1313 \
test1314 test1315 test1316 test1317 test1318 test1319 test1320 test1321 \
test1322 test1323 test1324 test1325 test1326 test1327 test1328 test1329 \
test1330 test1331 test1332 test1333 test1334 test1335 test1336 test1337 \
test1338 test1339 test1340 test1341 test1342 test1343 test1344 test1345 \
test1346 test1347 test1348 test1349 test1350 test1351 test1352 test1353 \
test1354 test1355 test1356 test1357 test1358 test1359 test1360 test1361 \
test1362 test1363 test1364 test1365 test1366 test1367 test1368 test1369 \
test1370 test1371 test1372 test1373 test1374 test1375 test1376 test1377 \
test1378 test1379 test1380 test1381 test1382 test1383 test1384 test1385 \
test1386 test1387 test1388 test1389 test1390 test1391 test1392 test1393 \
test1394 test1395 test1396 test1397 test1398 test1399 test1400 test1401 \
test1402 test1403 test1404 test1405 test1406 test1407 test1408 test1409 \
test1410 test1411 test1412 test1413 test1414 test1415 test1416 test1417 \
test1418 test1419 test1420 test1421 test1422 test1423 test1424 test1425 \
test1426 test1427 test1428 test1429 test1430 test1431 test1432 test1433 \
test1434 test1435 test1436 test1437 test1438 test1439 test1440 test1441 \
test1442 test1443 test1444 test1445 test1446 test1447 test1448 test1449 \
test1450 test1451 test1452 test1453 test1454 test1455 test1456 test1457 \
test1458 test1459 test1500 test1501 test1502 test1503 test1504 test1505 \
test1506 test1507 test1508 test1509 test1510 test1511 test1512 test1513 \
test1514 test1515 test1516 test1517 test1518 test1519 test1520 test1521 \
test1522 test1523 \
\
test1525 test1526 test1527 test1528 test1529 test1530 test1531 test1532 \
test1533 test1534 test1535 test1536 test1537 test1538 \

65
tests/data/test1294 Normal file
View File

@ -0,0 +1,65 @@
<testcase>
<info>
<keywords>
HTTP
HTTP GET
</keywords>
</info>
#
# Server-side
<reply>
<data>
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
ETag: "21025-dc7-39462498"
Accept-Ranges: bytes
Content-Length: 6
Connection: close
Content-Type: text/html
Funny-head: yesyes
-foo-
</data>
</reply>
#
# Client-side
<client>
<features>
debug
</features>
<server>
http
</server>
<name>
HTTP GET with split initial request send
</name>
<setenv>
# Oliver Twist
# make the first send cut off after this amount of data
CURL_SMALLREQSEND=128
</setenv>
<command>
http://%HOSTIP:%HTTPPORT/012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679/1294 -H "Among other public buildings in a certain town, which for many reasons it will be prudent to refrain from mentioning, and to which I will assign no fictitious name, there is one anciently common to most towns, great or small to wit, a workhouse; and in this workhouse was born; on a day and date which I need not trouble myself to repeat, inasmuch as it can be of no possible consequence to the reader, in this stage of the business at all events; the item of mortality whose name is prefixed to the head of this chapter: 511"
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
<strip>
^User-Agent:.*
</strip>
<protocol>
GET /012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679/1294 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Accept: */*
Among other public buildings in a certain town, which for many reasons it will be prudent to refrain from mentioning, and to which I will assign no fictitious name, there is one anciently common to most towns, great or small to wit, a workhouse; and in this workhouse was born; on a day and date which I need not trouble myself to repeat, inasmuch as it can be of no possible consequence to the reader, in this stage of the business at all events; the item of mortality whose name is prefixed to the head of this chapter: 511
</protocol>
</verify>
</testcase>

68
tests/data/test1295 Normal file
View File

@ -0,0 +1,68 @@
<testcase>
<info>
<keywords>
HTTP
HTTP POST
</keywords>
</info>
#
# Server-side
<reply>
<data>
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
ETag: "21025-dc7-39462498"
Accept-Ranges: bytes
Content-Length: 6
Connection: close
Content-Type: text/html
Funny-head: yesyes
-foo-
</data>
</reply>
#
# Client-side
<client>
<features>
debug
</features>
<server>
http
</server>
<name>
HTTP POST with split initial request send
</name>
<setenv>
# The Hound of the Baskervilles
#
# make the first send cut off after this amount of data
CURL_SMALLREQSEND=100
</setenv>
<command>
http://%HOSTIP:%HTTPPORT/012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679/1295 -H "012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679: 300" -d "Mr. Sherlock Holmes, who was usually very late in the mornings, save upon those not infrequent occasions when he was up all night, was seated at the breakfast table."
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
<strip>
^User-Agent:.*
</strip>
<protocol nonewline="yes">
POST /012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679/1295 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Accept: */*
012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679: 300
Content-Length: 165
Content-Type: application/x-www-form-urlencoded
Mr. Sherlock Holmes, who was usually very late in the mornings, save upon those not infrequent occasions when he was up all night, was seated at the breakfast table.
</protocol>
</verify>
</testcase>