mirror of
https://github.com/curl/curl.git
synced 2024-12-09 06:30:06 +08:00
test447: test PUTting a file that grows
... and have curl trim the end when it reaches the expected total amount of bytes instead of over-sending. Reported-by: JustAnotherArchivist on github Closes #11223
This commit is contained in:
parent
1f85420a28
commit
bfa7006424
@ -319,6 +319,17 @@ static CURLcode pre_transfer(struct GlobalConfig *global,
|
||||
if(S_ISREG(fileinfo.st_mode))
|
||||
uploadfilesize = fileinfo.st_size;
|
||||
|
||||
#ifdef DEBUGBUILD
|
||||
/* allow dedicated test cases to override */
|
||||
{
|
||||
char *ev = getenv("CURL_UPLOAD_SIZE");
|
||||
if(ev) {
|
||||
int sz = atoi(ev);
|
||||
uploadfilesize = (curl_off_t)sz;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if(uploadfilesize != -1) {
|
||||
struct OperationConfig *config = per->config; /* for the macro below */
|
||||
#ifdef CURL_DISABLE_LIBCURL_OPTION
|
||||
|
@ -72,7 +72,7 @@ test417 test418 test419 test420 test421 test422 test423 test424 test425 \
|
||||
test426 \
|
||||
test430 test431 test432 test433 test434 test435 test436 \
|
||||
\
|
||||
test440 test441 test442 test443 test444 test445 test446 \
|
||||
test440 test441 test442 test443 test444 test445 test446 test447 \
|
||||
\
|
||||
test490 test491 test492 test493 test494 test495 test496 \
|
||||
\
|
||||
|
65
tests/data/test447
Normal file
65
tests/data/test447
Normal file
@ -0,0 +1,65 @@
|
||||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
HTTP
|
||||
HTTP PUT
|
||||
growing file
|
||||
</keywords>
|
||||
</info>
|
||||
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<data crlf="yes">
|
||||
HTTP/1.1 200 OK
|
||||
Date: Tue, 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 PUT with growing file
|
||||
</name>
|
||||
<setenv>
|
||||
CURL_UPLOAD_SIZE=498
|
||||
</setenv>
|
||||
<command>
|
||||
http://%HOSTIP:%HTTPPORT/%TESTNUMBER -T log/%TESTNUMBER
|
||||
</command>
|
||||
<file name="log/%TESTNUMBER">
|
||||
%repeat[100 x hello]%
|
||||
</file>
|
||||
</client>
|
||||
|
||||
#
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<protocol crlf="yes" nonewline="yes">
|
||||
PUT /%TESTNUMBER HTTP/1.1
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Content-Length: 498
|
||||
|
||||
%repeat[99 x hello]%hel
|
||||
</protocol>
|
||||
</verify>
|
||||
</testcase>
|
Loading…
Reference in New Issue
Block a user