Commit Graph

16185 Commits

Author SHA1 Message Date
Jiri Hruska f8c8c76d39 imap: Implemented APPEND final processing
The APPEND operation needs to be performed in several steps:
  1) We send "<tag> APPEND <mailbox> <flags> {<size>}\r\n"
  2) Server responds with continuation respose "+ ...\r\n"
  3) We start the transfer and send <size> bytes of data
  4) Only now we end the request command line by sending "\r\n"
  5) Server responds with "<tag> OK ...\r\n"

This commit performs steps 4 and 5, in the DONE phase, as more
processing is required after the transfer.
2013-03-02 19:34:25 +00:00
Jiri Hruska 90b7d0ea59 imap: Added APPEND perform and response handler functions
Added imap_append() function to initiate upload and imap_append_resp()
to handle the continuation response and start the transfer.
2013-03-02 19:17:18 +00:00
Jiri Hruska 1383522e3a imap: Introduced IMAP_APPEND and IMAP_APPEND_FINAL states 2013-03-02 19:06:35 +00:00
Jiri Hruska d46d107e0c imap: Updated setting of transfer variables in imap_state_fetch_resp()
Add number of bytes retrieved from the PP cache to req.bytecount and set
req.maxdownload only when starting a proper download.
2013-03-02 18:37:56 +00:00
Jiri Hruska 25884aa197 imap: Improved FETCH response parsing
Added safer parsing of the untagged FETCH response line and the size of
continuation data.
2013-03-02 18:37:54 +00:00
Steve Holme be51a46353 imap: Fixed accidentally lossing the result code
Accidentally lost the result code in imap_state_capability() and
imap_state_login() with commit b06a786226.
2013-02-28 23:09:28 +00:00
Steve Holme 48596f87a9 imap: Another minor comment addition / tidy up 2013-02-28 22:51:32 +00:00
Steve Holme b06a786226 imap: Updated the coding style for state changes after a send operation
Some state changes would be performed after a failure test that
performed a hard return, whilst others would be performed within a test
for success. Updated the code, for consistency, so all instances are
performed within a success test.
2013-02-28 22:46:22 +00:00
Steve Holme b4eb08e7fb pop3 / smtp: Small comment tidy up
Small tidy up to keep some comments consistant across each of the email
protocols.
2013-02-28 22:27:10 +00:00
Jiri Hruska 10549ee08f imap: FETCH response handler cleanup before further changes
Removed superfluous NULL assignment after Curl_safefree() and rewrote
some comments and logging messages.
2013-02-28 22:13:34 +00:00
Steve Holme d9235e74ed pop3: Small tidy up of function arguments 2013-02-28 21:22:49 +00:00
Steve Holme 6ff7197e70 imap: Small tidy up of function arguments 2013-02-28 21:18:36 +00:00
Steve Holme 0be2251394 smtp: Corrected debug message for POP3_AUTH_FINAL constant
Following commit ad3177da24 corrected the debug message in state()
from AUTH to AUTH_FINAL.
2013-02-28 21:11:02 +00:00
Steve Holme 4cef525992 pop3: Corrected debug message for POP3_AUTH_FINAL constant
Following commit afad1ce753 corrected the debug message in state()
from AUTH to AUTH_FINAL.
2013-02-28 21:10:11 +00:00
Steve Holme 11a22f3264 imap: Corrected debug message for IMAP_AUTHENTICATE_FINAL constant
Following commit 13006f3de9 corrected the debug message in state()
from AUTHENTICATE to AUTHENTICATE_FINAL.
2013-02-28 21:09:27 +00:00
Jiri Hruska 025ba6e9be imap: Fixed error code returned for invalid FETCH response
If the FETCH command does not result in an untagged response the the
UID is probably invalid. As such do not return CURLE_OK.
2013-02-28 21:00:13 +00:00
Jiri Hruska cdea86ff67 imap: Added processing of the final FETCH responses
Not processing the final FETCH responses was not optimal, not only
because the response code would be ignored but it would also leave data
unread on the socket which would prohibit connection reuse.
2013-02-28 21:00:11 +00:00
Jiri Hruska 974c663471 imap: Introduced FETCH_FINAL state for processing final fetch responses
A typical FETCH response can be broken down into four parts:

  1) "* <uid> FETCH (<what> {<size>}\r\n", using continuation syntax
  2) <size> bytes of the actual message
  3) ")\r\n", finishing the untagged response
  4) "<tag> OK ...", finishing the command

Part 1 is read in imap_fetch_resp(), part 2 is consumed in the PERFORM
phase by the transfer subsystem, parts 3 and 4 are currently ignored.
2013-02-28 21:00:10 +00:00
Steve Holme 692ef0e158 imap: fix autobuild warning
Removed whitespace from imap_perform()
2013-02-28 10:23:50 +00:00
Steve Holme 17f032c0d9 imap: fix compiler warning
error: declaration of 'imap' shadows a previous local
2013-02-28 07:31:41 +00:00
Steve Holme ad3177da24 smtp: Re-factored the final SMTP_AUTH constant
Changed the final SMTP_AUTH constant to SMTP_AUTH_FINAL for consistency
with the response function.
2013-02-27 21:20:55 +00:00
Steve Holme afad1ce753 pop3: Re-factored the final POP3_AUTH constant
Changed the final POP3_AUTH constant to POP3_AUTH_FINAL for consistency
with the response function.
2013-02-27 21:20:11 +00:00
Steve Holme 13006f3de9 imap: Re-factored final IMAP_AUTHENTICATE constant
Changed the final IMAP_AUTHENTICATE constant to IMAP_AUTHENTICATE_FINAL
for consistency with the response function.
2013-02-27 21:19:48 +00:00
Steve Holme 1d86d813c3 imap: Updated the coding style of imap_state_servergreet_resp()
Updated the coding style, in this function, to be consistant with other
response functions rather then performing a hard return on failure.
2013-02-27 21:00:35 +00:00
Steve Holme f53ed631b3 imap: Reversed the logic of the (un)successful tagged SELECT response
Reversed the logic of the unsuccessful vs successful tagged SELECT
response in imap_state_select_resp() to be more logical to read.
2013-02-27 20:53:34 +00:00
Steve Holme 5b3736b533 imap: Reversed the logic of the (un)successful tagged CAPABILITY response
Reversed the logic of the unsuccessful vs successful tagged CAPABILITY
response in imap_state_capability_resp() to be more logical to read.
2013-02-27 20:48:24 +00:00
Steve Holme cce08581ac imap: Corrected char* references with char *
Corrected char* references made in commit: 709b3506cd.
2013-02-27 20:35:04 +00:00
Jiri Hruska c368fbcb10 imap: Added processing of more than one response when sent in same packet
Added a loop to imap_statemach_act() in which Curl_pp_readresp() is
called until the cache is drained. Without this multiple responses
received in a single packet could result in a hang or delay.
2013-02-27 20:08:04 +00:00
Jiri Hruska b644c47192 imap: Added skipping of SELECT command if already in the same mailbox
Added storage and checking of the last mailbox userd to prevent
unnecessary switching.
2013-02-27 20:08:02 +00:00
Jiri Hruska d03aa16164 imap: Introduced the mailbox variable
Added the mailbox variable to the per-connection structure in
preparation for checking for an already selected mailbox.
2013-02-27 20:08:00 +00:00
Steve Holme aa44ec62aa email: Slight reordering of connection based variables
Reordered the state and ssl_done variables in order to provide more
consistency between the email protocols as well as for for an upcoming
change.
2013-02-26 23:15:16 +00:00
Steve Holme 05c03e7edd imap: Tidied up comments for connection based variables 2013-02-26 23:07:37 +00:00
Steve Holme f67bd1a344 DOCS: Added the IMAP UIDVALIDITY property to the CURLOPT_URL section 2013-02-26 22:22:26 +00:00
Jiri Hruska a8eb059203 imap: Added verification of UIDVALIDITY mailbox attribute
Added support for checking the UIDVALIDITY, and aborting the request, if
it has been specified in the URL and the server response is different.
2013-02-26 22:09:21 +00:00
Jiri Hruska 59c71c7fc7 imap: Added support for parsing the UIDVALIDITY property
Added support for parsing the UIDVALIDITY property from the SELECT
response and storing it in the per-connection structure.
2013-02-26 22:09:19 +00:00
Jiri Hruska 58efa46a5d imap: Introduced the mailbox_uidvalidity variable
Added the mailbox_uidvalidity variable to the per-connection structure
in preparation for checking the UIDVALIDITY mailbox attribute.
2013-02-26 22:09:18 +00:00
Steve Holme acd22f05dd imap: Corrected comment in imap_endofresp() 2013-02-26 20:40:22 +00:00
Steve Holme ce9a0a6d65 imap: Corrected whitespace 2013-02-26 20:37:08 +00:00
Jiri Hruska f92f341a3f imap: Added filtering of CAPABILITY and FETCH untagged responses
Only responses that contain "CAPABILITY" and "FETCH", respectively,
will be sent to their response handler.
2013-02-26 20:35:41 +00:00
Jiri Hruska 91b2184e1b imap: Added a helper function for upcoming untagged response filtering
RFC 3501 states that "the client MUST be prepared to accept any response
at all times" yet we assume anything received with "* " at the beginning
is the untagged response we want.

Introduced a helper function that checks whether the input looks like a
response to specified command, so that we may filter the ones we are
interested in according to the current state.
2013-02-26 20:23:13 +00:00
Jiri Hruska 1ffdc5058e imap: Moved CAPABILITY response handling to imap_state_capability_resp()
Introduced similar handling to the FETCH responses, where even the
untagged data responses are handled by the response handler of the
individual state.
2013-02-26 19:51:16 +00:00
Linus Nielsen Feltzing 0ffefefe7f Remove unused variable in smtp_state_data_resp() 2013-02-26 09:05:25 +01:00
Steve Holme 764b818934 email: Small tidy up following recent changes 2013-02-25 23:00:08 +00:00
Steve Holme 9d45391347 smtp: Removed bytecountp from the per-request structure
Removed this pointer to a downloaded bytes counter because it was set in
smtp_init() to point to the same variable the transfer functions keep
the count in (k->bytecount), effectively making the code in transfer.c
"*k->bytecountp = k->bytecount" a no-op.
2013-02-25 22:50:36 +00:00
Steve Holme a390454728 pop3: Removed bytecountp from the per-request structure
Removed this pointer to a downloaded bytes counter because it was set in
pop3_init() to point to the same variable the transfer functions keep
the count in (k->bytecount), effectively making the code in transfer.c
"*k->bytecountp = k->bytecount" a no-op.
2013-02-25 22:43:45 +00:00
Jiri Hruska 005ad9e60d imap: Removed bytecountp from the per-request structure
Removed this pointer to a downloaded bytes counter because it was set in
imap_init() to point to the same variable the transfer functions keep
the count in (k->bytecount), effectively making the code in transfer.c
"*k->bytecountp = k->bytecount" a no-op.
2013-02-25 22:05:20 +00:00
Jiri Hruska a360944ed6 imap: Adjusted SELECT and FETCH function order
Moved imap_select() and imap_fetch() to be grouped with the other
perform functions.
2013-02-25 21:40:32 +00:00
Jiri Hruska 6f02209cc8 imap: Adjusted SELECT and FETCH state order in imap_statemach_act()
Exchanged the position of these states in the switch statements to
match the state enum, execution and function order.
2013-02-25 21:26:40 +00:00
Steve Holme 015ceb4706 imap: Minor tidy up of comments in imap_parse_url_path()
Tidy up of comments before next round of imap changes.
2013-02-25 15:53:24 +00:00
Steve Holme e63c33d88d imap: Fixed incorrect comparison for STARTTLS in imap_endofresp()
Corrected the comparison type in addition to commit 1dac29fa83.
2013-02-25 09:43:23 +00:00