mirror of
https://github.com/curl/curl.git
synced 2026-07-23 16:47:15 +03:00
imap: fix custom FETCH commands to handle literal responses
Custom IMAP commands using -X (e.g. 'FETCH 123 BODY[1]') were only
returning the first line of responses containing literals, instead of
the full multi-line body data.
The issue was that custom commands route through imap_perform_list()
and imap_state_listsearch_resp(), which didn't detect or handle IMAP
literal syntax {size}.
This commit adds literal detection to imap_state_listsearch_resp():
- Detects literal syntax {size} in untagged responses
- Writes the response header line containing the literal marker
- Handles any literal body data already in the pingpong buffer
- Sets up transfer layer to read remaining literal data from socket
- Configures maxdownload and transfer size to include header + body
- Initializes pp->overflow to 0 when no buffered data present
- Modifies imap_done() to transition to FETCH_FINAL for custom
commands that set up downloads
Test 841 and 3206 verify.
Fixes #18847
Reported-by: BohwaZ
Bug: https://github.com/curl/curl/issues/18847
Closes #19246
This commit is contained in:
parent
25aee8648a
commit
e64c28e243
4 changed files with 352 additions and 7 deletions
|
|
@ -279,7 +279,7 @@ test3032 test3033 test3034 test3035 \
|
|||
\
|
||||
test3100 test3101 test3102 test3103 test3104 test3105 \
|
||||
\
|
||||
test3200 test3201 test3202 test3203 test3204 test3205 test3207 test3208 \
|
||||
test3200 test3201 test3202 test3203 test3204 test3205 test3206 test3207 test3208 \
|
||||
test3209 test3210 test3211 test3212 test3213 test3214 test3215 \
|
||||
test4000 test4001
|
||||
|
||||
|
|
|
|||
248
tests/data/test3206
Normal file
248
tests/data/test3206
Normal file
|
|
@ -0,0 +1,248 @@
|
|||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
IMAP
|
||||
Clear Text
|
||||
FETCH
|
||||
CUSTOMREQUEST
|
||||
</keywords>
|
||||
</info>
|
||||
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<data>
|
||||
Line 001: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 002: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 003: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 004: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 005: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 006: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 007: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 008: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 009: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 010: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 011: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 012: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 013: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 014: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 015: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 016: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 017: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 018: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 019: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 020: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 021: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 022: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 023: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 024: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 025: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 026: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 027: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 028: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 029: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 030: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 031: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 032: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 033: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 034: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 035: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 036: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 037: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 038: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 039: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 040: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 041: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 042: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 043: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 044: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 045: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 046: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 047: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 048: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 049: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 050: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 051: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 052: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 053: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 054: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 055: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 056: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 057: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 058: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 059: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 060: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 061: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 062: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 063: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 064: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 065: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 066: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 067: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 068: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 069: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 070: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 071: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 072: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 073: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 074: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 075: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 076: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 077: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 078: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 079: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 080: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 081: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 082: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 083: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 084: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 085: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 086: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 087: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 088: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 089: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 090: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 091: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 092: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 093: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 094: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 095: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 096: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 097: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 098: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 099: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 100: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
|
||||
</data>
|
||||
<datacheck>
|
||||
* 456 FETCH (BODY[TEXT] {7101}
|
||||
Line 001: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 002: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 003: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 004: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 005: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 006: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 007: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 008: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 009: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 010: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 011: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 012: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 013: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 014: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 015: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 016: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 017: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 018: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 019: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 020: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 021: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 022: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 023: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 024: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 025: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 026: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 027: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 028: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 029: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 030: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 031: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 032: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 033: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 034: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 035: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 036: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 037: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 038: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 039: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 040: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 041: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 042: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 043: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 044: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 045: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 046: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 047: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 048: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 049: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 050: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 051: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 052: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 053: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 054: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 055: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 056: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 057: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 058: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 059: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 060: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 061: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 062: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 063: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 064: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 065: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 066: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 067: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 068: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 069: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 070: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 071: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 072: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 073: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 074: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 075: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 076: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 077: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 078: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 079: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 080: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 081: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 082: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 083: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 084: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 085: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 086: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 087: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 088: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 089: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 090: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 091: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 092: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 093: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 094: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 095: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 096: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 097: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 098: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 099: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
Line 100: Testing large IMAP literal with custom FETCH. XXXXXXXXXXXXX
|
||||
|
||||
</datacheck>
|
||||
</reply>
|
||||
|
||||
#
|
||||
# Client-side
|
||||
<client>
|
||||
<server>
|
||||
imap
|
||||
</server>
|
||||
<name>
|
||||
IMAP custom FETCH with larger literal response (~7KB)
|
||||
</name>
|
||||
<command>
|
||||
imap://%HOSTIP:%IMAPPORT/%TESTNUMBER/ -u user:secret -X 'FETCH 456 BODY[TEXT]'
|
||||
</command>
|
||||
</client>
|
||||
|
||||
#
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<protocol>
|
||||
A001 CAPABILITY
|
||||
A002 LOGIN user secret
|
||||
A003 SELECT %TESTNUMBER
|
||||
A004 FETCH 456 BODY[TEXT]
|
||||
A005 LOGOUT
|
||||
</protocol>
|
||||
</verify>
|
||||
</testcase>
|
||||
|
|
@ -20,6 +20,11 @@ body
|
|||
</data>
|
||||
<datacheck>
|
||||
* 123 FETCH (BODY[1] {70}
|
||||
body
|
||||
|
||||
+ Curl did not used to like this line
|
||||
--
|
||||
yours sincerely
|
||||
</datacheck>
|
||||
</reply>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue