mime: explicitly rewind subparts at attachment time.

Subparts may have been previously used as a top-level mime structure and
thus not rewound.

New test 695 checks the proper functioning in these particular conditions.

Reported-by: Qriist on github
Fixes #15842
Closes #15911
This commit is contained in:
Patrick Monnerat 2025-01-04 17:10:25 +01:00 committed by Daniel Stenberg
parent e602f7f119
commit 1b3f00f794
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
5 changed files with 205 additions and 2 deletions

View file

@ -101,7 +101,7 @@ test652 test653 test654 test655 test656 test658 test659 test660 test661 \
test662 test663 test664 test665 test666 test667 test668 test669 test670 \
test671 test672 test673 test674 test675 test676 test677 test678 test679 \
test680 test681 test682 test683 test684 test685 test686 test687 test688 \
test689 test690 test691 test692 test693 test694 \
test689 test690 test691 test692 test693 test694 test695 \
\
test700 test701 test702 test703 test704 test705 test706 test707 test708 \
test709 test710 test711 test712 test713 test714 test715 test716 test717 \

78
tests/data/test695 Normal file
View file

@ -0,0 +1,78 @@
<testcase>
<info>
<keywords>
MIME
</keywords>
</info>
# Server-side
<reply>
<data nocheck="yes">
HTTP/1.0 200 OK swsclose
Date: Tue, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
blablabla
</data>
</reply>
# Client-side
<client>
<features>
Mime
</features>
<server>
http
</server>
<tool>
lib%TESTNUMBER
</tool>
<name>
MIME parts reuse as a child part
</name>
<command>
http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<strippart>
s/^--------------------------[A-Za-z0-9]*/------------------------------/
s/boundary=------------------------[A-Za-z0-9]*/boundary=----------------------------/
</strippart>
<protocol>
POST /we/want/%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Accept: */*
Content-Length: 196
Content-Type: multipart/form-data; boundary=----------------------------
------------------------------
Content-Disposition: form-data; name="data"
Content-Type: text/html
<title>hello</title>
--------------------------------
POST /we/want/%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Accept: */*
Content-Length: 423
Content-Type: multipart/form-data; boundary=----------------------------
------------------------------
Content-Disposition: form-data
Content-Type: multipart/mixed; boundary=----------------------------
------------------------------
Content-Disposition: attachment; name="data"
Content-Type: text/html
<title>hello</title>
--------------------------------
--------------------------------
</protocol>
</verify>
</testcase>