platform/upstream/curl.git
11 years agoimap: Removed the custom request response function
Steve Holme [Wed, 6 Mar 2013 19:58:34 +0000 (19:58 +0000)]
imap: Removed the custom request response function

Removed imap_state_custom_resp() as imap_state_list_resp() provides the
same functionality.

11 years agoimap: Updated ftpserver.pl to be more compliant, added new commands
Jiri Hruska [Tue, 5 Mar 2013 17:03:48 +0000 (18:03 +0100)]
imap: Updated ftpserver.pl to be more compliant, added new commands

Enriched IMAP capabilities of ftpserver.pl in order to be able to
add tests for the new IMAP features.

* Added support for APPEND - Saves uploaded data to log/upload.$testno
* Added support for LIST - Returns the contents of <reply/> section in
  the current test, like e.g FETCH.
* Added support for STORE - Returns hardcoded updated flags
* Changed handling of SELECT - Returns much more information in the
  usual set of untagged responses; uses hardcoded data from an example
  in the IMAP RFC
* Changed handling of FETCH - Fixed response format

11 years agoimap: Added check for empty UID in FETCH command
Steve Holme [Wed, 6 Mar 2013 19:33:49 +0000 (19:33 +0000)]
imap: Added check for empty UID in FETCH command

As the UID has to be specified by the user for the FETCH command to work
correctly, added a check to imap_fetch(), although strictly speaking it
is protected by the call from imap_perform().

11 years agonss: fix misplaced code enabling non-blocking socket mode
Kamil Dudka [Tue, 5 Mar 2013 16:51:01 +0000 (17:51 +0100)]
nss: fix misplaced code enabling non-blocking socket mode

The option needs to be set on the SSL socket.  Setting it on the model
takes no effect.  Note that the non-blocking mode is still not enabled
for the handshake because the code is not yet ready for that.

11 years agoimap: fix compiler warning
Daniel Stenberg [Wed, 6 Mar 2013 07:28:05 +0000 (08:28 +0100)]
imap: fix compiler warning

imap.c:694:21: error: unused variable 'imapc' [-Werror=unused-variable]

11 years agoimap: Added support for list command
Steve Holme [Tue, 5 Mar 2013 22:04:03 +0000 (22:04 +0000)]
imap: Added support for list command

11 years agoimap: Added list perform and response handler functions
Steve Holme [Tue, 5 Mar 2013 21:36:25 +0000 (21:36 +0000)]
imap: Added list perform and response handler functions

11 years agoimap: Introduced IMAP_LIST state
Steve Holme [Tue, 5 Mar 2013 21:34:53 +0000 (21:34 +0000)]
imap: Introduced IMAP_LIST state

11 years agoimap: Small tidy up of imap_select() to match imap_append()
Steve Holme [Tue, 5 Mar 2013 19:59:53 +0000 (19:59 +0000)]
imap: Small tidy up of imap_select() to match imap_append()

Updated the style of imap_select() before adding the LIST command.

11 years agoimap: Moved mailbox check from the imap_do() function
Steve Holme [Tue, 5 Mar 2013 19:52:11 +0000 (19:52 +0000)]
imap: Moved mailbox check from the imap_do() function

In preparation for the addition of the LIST command, moved the mailbox
check from imap_do() to imap_select() and imap_append().

11 years agocurl_setup.h: Added S_IRDIR() macro for compilers that don't support it
Steve Holme [Tue, 5 Mar 2013 19:45:51 +0000 (19:45 +0000)]
curl_setup.h: Added S_IRDIR() macro for compilers that don't support it

Commit 26eaa8383001 introduces the use of S_ISDIR() yet some compilers,
such as MSVC don't support it, so we must define a substitute using
file flags and mask.

11 years agoAddFormData: prevent only directories from being posted
Daniel Stenberg [Mon, 4 Mar 2013 14:20:22 +0000 (15:20 +0100)]
AddFormData: prevent only directories from being posted

Commit f4cc54cb4746ae5a6d (shipped as part of the 7.29.0 release) was a
bug fix that introduced a regression in that while trying to avoid
allowing directory names, it also forbade "special" files like character
devices and more. like "/dev/null" as was used by Oliver who reported
this regression.

Reported by: Oliver Gondža
Bug: http://curl.haxx.se/mail/archive-2013-02/0040.html

11 years agodarwinssl: fix infinite loop if server disconnected abruptly
Nick Zitzmann [Mon, 4 Mar 2013 05:11:10 +0000 (22:11 -0700)]
darwinssl: fix infinite loop if server disconnected abruptly

If the server hung up the connection without sending a closure alert,
then we'd keep probing the socket for data even though it's dead. Now
we're ready for this situation.

Bug: http://curl.haxx.se/mail/lib-2013-03/0014.html
Reported by: Aki Koskinen

11 years agoimap: Added comments to imap_append()
Steve Holme [Sun, 3 Mar 2013 16:44:53 +0000 (16:44 +0000)]
imap: Added comments to imap_append()

11 years agoimap: Added required mailbox check for FETCH and APPEND commands
Jiri Hruska [Sun, 3 Mar 2013 10:37:10 +0000 (11:37 +0100)]
imap: Added required mailbox check for FETCH and APPEND commands

11 years agopingpong.c: Fix enumerated type mixed with another type
Steve Holme [Sun, 3 Mar 2013 13:55:01 +0000 (13:55 +0000)]
pingpong.c: Fix enumerated type mixed with another type

11 years agosmtp: Updated the coding style for state changes after a send operation
Steve Holme [Sun, 3 Mar 2013 13:48:22 +0000 (13:48 +0000)]
smtp: 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.

11 years agopop3: Updated the coding style for state changes after a send operation
Steve Holme [Sun, 3 Mar 2013 13:36:12 +0000 (13:36 +0000)]
pop3: 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.

11 years agoimap: Fixed typo in variable assignment
Steve Holme [Sun, 3 Mar 2013 13:13:59 +0000 (13:13 +0000)]
imap: Fixed typo in variable assignment

11 years agoimap: Fixed custom request handling in imap_done()
Jiri Hruska [Sun, 3 Mar 2013 10:33:53 +0000 (11:33 +0100)]
imap: Fixed custom request handling in imap_done()

Fixed imap_done() so that neither the FINAL states are not entered when
a custom command has been performed.

11 years agoimap: Enabled custom requests in imap_select_resp()
Jiri Hruska [Sun, 3 Mar 2013 10:27:18 +0000 (11:27 +0100)]
imap: Enabled custom requests in imap_select_resp()

Changed imap_select_resp() to invoke imap_custom() instead of
imap_fetch() after the mailbox has been selected if a custom
command has been set.

11 years agoimap: Enabled custom requests in imap_perform()
Jiri Hruska [Sun, 3 Mar 2013 10:21:29 +0000 (11:21 +0100)]
imap: Enabled custom requests in imap_perform()

Modified imap_perform() to start with the custom command instead of
SELECT when a custom command is to be performed and no mailbox has
been given.

11 years agoimap: Added custom request perform and response handler functions
Jiri Hruska [Sun, 3 Mar 2013 10:09:44 +0000 (11:09 +0100)]
imap: Added custom request perform and response handler functions

Added imap_custom(), which initiates the custom command processing,
and an associated response handler imap_state_custom_resp(), which
handles any responses by sending them to the client as body data.

All untagged responses with the same name as the first word of the
custom request string are accepted, with the exception of SELECT and
EXAMINE which have responses that cannot be easily identified. An
extra check has been provided for them so that any untagged responses
are accepted for them.

11 years agopop3: Fixed unnecessary parent structure reference
Steve Holme [Sun, 3 Mar 2013 11:10:24 +0000 (11:10 +0000)]
pop3: Fixed unnecessary parent structure reference

Updated pop3 code following recent imap changes.

11 years agoimap: Added custom request parsing
Jiri Hruska [Sun, 3 Mar 2013 09:49:37 +0000 (10:49 +0100)]
imap: Added custom request parsing

Added imap_parse_custom_request() for parsing the CURLOPT_CUSTOMREQUEST
parameter which URL decodes the value and separates the request from
any parameters - This makes it easier to filter untagged responses
by the request command.

11 years agoimap: Introduced custom request parameters
Jiri Hruska [Sun, 3 Mar 2013 09:12:27 +0000 (10:12 +0100)]
imap: Introduced custom request parameters

Added custom request parameters to the per-request structure.

11 years agoimap: Introduced IMAP_CUSTOM state
Jiri Hruska [Sun, 3 Mar 2013 09:10:01 +0000 (10:10 +0100)]
imap: Introduced IMAP_CUSTOM state

11 years agoimap: Minor code tidy up
Steve Holme [Sat, 2 Mar 2013 21:22:44 +0000 (21:22 +0000)]
imap: Minor code tidy up

Minor tidy up of code layout and comments following recent changes.

11 years agoimap: Simplified the imap_state_append_resp() function
Steve Holme [Sat, 2 Mar 2013 20:40:38 +0000 (20:40 +0000)]
imap: Simplified the imap_state_append_resp() function

Introduced the result code variable to simplify the state changes and
remove the hard returns.

11 years agoimap: Changed successful response logic in imap_state_append_resp()
Steve Holme [Sat, 2 Mar 2013 20:35:03 +0000 (20:35 +0000)]
imap: Changed successful response logic in imap_state_append_resp()

For consistency changed the logic of the imap_state_append_resp()
function to test for an unsucessful continuation response rather than a
succesful one.

11 years agoimap: Standardised imapcode condition tests
Steve Holme [Sat, 2 Mar 2013 20:29:27 +0000 (20:29 +0000)]
imap: Standardised imapcode condition tests

For consistency changed two if(constant != imapcode) tests to be
if(imapcode != constant).

11 years agoimap: Moved imap_append() to be with the other perform functions
Steve Holme [Sat, 2 Mar 2013 20:24:49 +0000 (20:24 +0000)]
imap: Moved imap_append() to be with the other perform functions

11 years agoimap: Enabled APPEND support in imap_perform()
Jiri Hruska [Fri, 1 Mar 2013 19:49:14 +0000 (20:49 +0100)]
imap: Enabled APPEND support in imap_perform()

Added logic in imap_perform() to perform an APPEND rather than SELECT
and FETCH if an upload has been specified.

11 years agoimap: Implemented APPEND final processing
Jiri Hruska [Fri, 1 Mar 2013 19:34:51 +0000 (20:34 +0100)]
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.

11 years agoimap: Added APPEND perform and response handler functions
Jiri Hruska [Fri, 1 Mar 2013 19:06:18 +0000 (20:06 +0100)]
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.

11 years agoimap: Introduced IMAP_APPEND and IMAP_APPEND_FINAL states
Jiri Hruska [Fri, 1 Mar 2013 19:04:56 +0000 (20:04 +0100)]
imap: Introduced IMAP_APPEND and IMAP_APPEND_FINAL states

11 years agoimap: Updated setting of transfer variables in imap_state_fetch_resp()
Jiri Hruska [Fri, 1 Mar 2013 18:38:27 +0000 (19:38 +0100)]
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.

11 years agoimap: Improved FETCH response parsing
Jiri Hruska [Fri, 1 Mar 2013 18:24:56 +0000 (19:24 +0100)]
imap: Improved FETCH response parsing

Added safer parsing of the untagged FETCH response line and the size of
continuation data.

11 years agoimap: Fixed accidentally lossing the result code
Steve Holme [Thu, 28 Feb 2013 23:09:28 +0000 (23:09 +0000)]
imap: Fixed accidentally lossing the result code

Accidentally lost the result code in imap_state_capability() and
imap_state_login() with commit b06a78622609.

11 years agoimap: Another minor comment addition / tidy up
Steve Holme [Thu, 28 Feb 2013 22:51:32 +0000 (22:51 +0000)]
imap: Another minor comment addition / tidy up

11 years agoimap: Updated the coding style for state changes after a send operation
Steve Holme [Thu, 28 Feb 2013 22:46:22 +0000 (22:46 +0000)]
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.

11 years agopop3 / smtp: Small comment tidy up
Steve Holme [Thu, 28 Feb 2013 22:26:46 +0000 (22:26 +0000)]
pop3 / smtp: Small comment tidy up

Small tidy up to keep some comments consistant across each of the email
protocols.

11 years agoimap: FETCH response handler cleanup before further changes
Jiri Hruska [Thu, 28 Feb 2013 20:32:10 +0000 (21:32 +0100)]
imap: FETCH response handler cleanup before further changes

Removed superfluous NULL assignment after Curl_safefree() and rewrote
some comments and logging messages.

11 years agopop3: Small tidy up of function arguments
Steve Holme [Thu, 28 Feb 2013 21:22:49 +0000 (21:22 +0000)]
pop3: Small tidy up of function arguments

11 years agoimap: Small tidy up of function arguments
Steve Holme [Thu, 28 Feb 2013 21:18:36 +0000 (21:18 +0000)]
imap: Small tidy up of function arguments

11 years agosmtp: Corrected debug message for POP3_AUTH_FINAL constant
Steve Holme [Thu, 28 Feb 2013 21:11:02 +0000 (21:11 +0000)]
smtp: Corrected debug message for POP3_AUTH_FINAL constant

Following commit ad3177da24b8 corrected the debug message in state()
from AUTH to AUTH_FINAL.

11 years agopop3: Corrected debug message for POP3_AUTH_FINAL constant
Steve Holme [Thu, 28 Feb 2013 21:10:11 +0000 (21:10 +0000)]
pop3: Corrected debug message for POP3_AUTH_FINAL constant

Following commit afad1ce753a1 corrected the debug message in state()
from AUTH to AUTH_FINAL.

11 years agoimap: Corrected debug message for IMAP_AUTHENTICATE_FINAL constant
Steve Holme [Thu, 28 Feb 2013 21:09:27 +0000 (21:09 +0000)]
imap: Corrected debug message for IMAP_AUTHENTICATE_FINAL constant

Following commit 13006f3de9ec corrected the debug message in state()
from AUTHENTICATE to AUTHENTICATE_FINAL.

11 years agoimap: Fixed error code returned for invalid FETCH response
Jiri Hruska [Thu, 28 Feb 2013 18:56:52 +0000 (19:56 +0100)]
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.

11 years agoimap: Added processing of the final FETCH responses
Jiri Hruska [Thu, 28 Feb 2013 18:42:42 +0000 (19:42 +0100)]
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.

11 years agoimap: Introduced FETCH_FINAL state for processing final fetch responses
Jiri Hruska [Thu, 28 Feb 2013 18:16:33 +0000 (19:16 +0100)]
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.

11 years agoimap: fix autobuild warning
Steve Holme [Thu, 28 Feb 2013 10:23:50 +0000 (10:23 +0000)]
imap: fix autobuild warning

Removed whitespace from imap_perform()

11 years agoimap: fix compiler warning
Steve Holme [Thu, 28 Feb 2013 07:31:41 +0000 (07:31 +0000)]
imap: fix compiler warning

error: declaration of 'imap' shadows a previous local

11 years agosmtp: Re-factored the final SMTP_AUTH constant
Steve Holme [Wed, 27 Feb 2013 21:20:55 +0000 (21:20 +0000)]
smtp: Re-factored the final SMTP_AUTH constant

Changed the final SMTP_AUTH constant to SMTP_AUTH_FINAL for consistency
with the response function.

11 years agopop3: Re-factored the final POP3_AUTH constant
Steve Holme [Wed, 27 Feb 2013 21:20:11 +0000 (21:20 +0000)]
pop3: Re-factored the final POP3_AUTH constant

Changed the final POP3_AUTH constant to POP3_AUTH_FINAL for consistency
with the response function.

11 years agoimap: Re-factored final IMAP_AUTHENTICATE constant
Steve Holme [Wed, 27 Feb 2013 21:19:48 +0000 (21:19 +0000)]
imap: Re-factored final IMAP_AUTHENTICATE constant

Changed the final IMAP_AUTHENTICATE constant to IMAP_AUTHENTICATE_FINAL
for consistency with the response function.

11 years agoimap: Updated the coding style of imap_state_servergreet_resp()
Steve Holme [Wed, 27 Feb 2013 21:00:35 +0000 (21:00 +0000)]
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.

11 years agoimap: Reversed the logic of the (un)successful tagged SELECT response
Steve Holme [Wed, 27 Feb 2013 20:53:34 +0000 (20:53 +0000)]
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.

11 years agoimap: Reversed the logic of the (un)successful tagged CAPABILITY response
Steve Holme [Wed, 27 Feb 2013 20:48:24 +0000 (20:48 +0000)]
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.

11 years agoimap: Corrected char* references with char *
Steve Holme [Wed, 27 Feb 2013 20:35:04 +0000 (20:35 +0000)]
imap: Corrected char* references with char *

Corrected char* references made in commit: 709b3506cd9b.

11 years agoimap: Added processing of more than one response when sent in same packet
Jiri Hruska [Wed, 27 Feb 2013 18:49:00 +0000 (19:49 +0100)]
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.

11 years agoimap: Added skipping of SELECT command if already in the same mailbox
Jiri Hruska [Wed, 27 Feb 2013 18:02:53 +0000 (19:02 +0100)]
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.

11 years agoimap: Introduced the mailbox variable
Jiri Hruska [Wed, 27 Feb 2013 17:31:08 +0000 (18:31 +0100)]
imap: Introduced the mailbox variable

Added the mailbox variable to the per-connection structure in
preparation for checking for an already selected mailbox.

11 years agoemail: Slight reordering of connection based variables
Steve Holme [Tue, 26 Feb 2013 23:15:16 +0000 (23:15 +0000)]
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.

11 years agoimap: Tidied up comments for connection based variables
Steve Holme [Tue, 26 Feb 2013 23:07:37 +0000 (23:07 +0000)]
imap: Tidied up comments for connection based variables

11 years agoDOCS: Added the IMAP UIDVALIDITY property to the CURLOPT_URL section
Steve Holme [Tue, 26 Feb 2013 22:22:26 +0000 (22:22 +0000)]
DOCS: Added the IMAP UIDVALIDITY property to the CURLOPT_URL section

11 years agoimap: Added verification of UIDVALIDITY mailbox attribute
Jiri Hruska [Tue, 26 Feb 2013 21:12:24 +0000 (22:12 +0100)]
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.

11 years agoimap: Added support for parsing the UIDVALIDITY property
Jiri Hruska [Tue, 26 Feb 2013 20:56:14 +0000 (21:56 +0100)]
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.

11 years agoimap: Introduced the mailbox_uidvalidity variable
Jiri Hruska [Tue, 26 Feb 2013 20:42:01 +0000 (21:42 +0100)]
imap: Introduced the mailbox_uidvalidity variable

Added the mailbox_uidvalidity variable to the per-connection structure
in preparation for checking the UIDVALIDITY mailbox attribute.

11 years agoimap: Corrected comment in imap_endofresp()
Steve Holme [Tue, 26 Feb 2013 20:40:22 +0000 (20:40 +0000)]
imap: Corrected comment in imap_endofresp()

11 years agoimap: Corrected whitespace
Steve Holme [Tue, 26 Feb 2013 20:37:08 +0000 (20:37 +0000)]
imap: Corrected whitespace

11 years agoimap: Added filtering of CAPABILITY and FETCH untagged responses
Jiri Hruska [Tue, 26 Feb 2013 18:22:42 +0000 (19:22 +0100)]
imap: Added filtering of CAPABILITY and FETCH untagged responses

Only responses that contain "CAPABILITY" and "FETCH", respectively,
will be sent to their response handler.

11 years agoimap: Added a helper function for upcoming untagged response filtering
Jiri Hruska [Tue, 26 Feb 2013 17:52:19 +0000 (18:52 +0100)]
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.

11 years agoimap: Moved CAPABILITY response handling to imap_state_capability_resp()
Jiri Hruska [Tue, 26 Feb 2013 17:10:54 +0000 (18:10 +0100)]
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.

11 years agoRemove unused variable in smtp_state_data_resp()
Linus Nielsen Feltzing [Tue, 26 Feb 2013 08:05:25 +0000 (09:05 +0100)]
Remove unused variable in smtp_state_data_resp()

11 years agoemail: Small tidy up following recent changes
Steve Holme [Mon, 25 Feb 2013 23:00:08 +0000 (23:00 +0000)]
email: Small tidy up following recent changes

11 years agosmtp: Removed bytecountp from the per-request structure
Steve Holme [Mon, 25 Feb 2013 22:28:14 +0000 (22:28 +0000)]
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.

11 years agopop3: Removed bytecountp from the per-request structure
Steve Holme [Mon, 25 Feb 2013 21:46:37 +0000 (21:46 +0000)]
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.

11 years agoimap: Removed bytecountp from the per-request structure
Jiri Hruska [Mon, 25 Feb 2013 17:40:32 +0000 (18:40 +0100)]
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.

11 years agoimap: Adjusted SELECT and FETCH function order
Jiri Hruska [Mon, 25 Feb 2013 17:06:02 +0000 (18:06 +0100)]
imap: Adjusted SELECT and FETCH function order

Moved imap_select() and imap_fetch() to be grouped with the other
perform functions.

11 years agoimap: Adjusted SELECT and FETCH state order in imap_statemach_act()
Jiri Hruska [Mon, 25 Feb 2013 16:59:05 +0000 (17:59 +0100)]
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.

11 years agoimap: Minor tidy up of comments in imap_parse_url_path()
Steve Holme [Mon, 25 Feb 2013 15:53:24 +0000 (15:53 +0000)]
imap: Minor tidy up of comments in imap_parse_url_path()

Tidy up of comments before next round of imap changes.

11 years agoimap: Fixed incorrect comparison for STARTTLS in imap_endofresp()
Steve Holme [Mon, 25 Feb 2013 09:43:23 +0000 (09:43 +0000)]
imap: Fixed incorrect comparison for STARTTLS in imap_endofresp()

Corrected the comparison type in addition to commit 1dac29fa83a9.

11 years agoDOCS: Corrected IMAP URL examples according to RFC5092
Steve Holme [Mon, 25 Feb 2013 09:36:52 +0000 (09:36 +0000)]
DOCS: Corrected IMAP URL examples according to RFC5092

URL examples that included the UID weren't technically correct although
would pass the curl parser.

11 years agodarwinssl: fix undefined $ssllib warning in runtests.pl
Nick Zitzmann [Sun, 24 Feb 2013 22:39:15 +0000 (15:39 -0700)]
darwinssl: fix undefined $ssllib warning in runtests.pl

I also added --with-darwinssl to the list of SSL options in configure.

11 years agoimap: Added check for new internal imap response code
Steve Holme [Sun, 24 Feb 2013 19:23:33 +0000 (19:23 +0000)]
imap: Added check for new internal imap response code

11 years agoimap: Changed the order of the response types in imap_endofresp()
Steve Holme [Sun, 24 Feb 2013 16:14:16 +0000 (16:14 +0000)]
imap: Changed the order of the response types in imap_endofresp()

From a maintenance point of view the code reads better to view tagged
responses, then untagged followed by continuation responses.

Additionally, this matches the order of responses in POP3.

11 years agoimap: Added stricter parsing of continuation responses
Jiri Hruska [Sun, 24 Feb 2013 13:54:25 +0000 (14:54 +0100)]
imap: Added stricter parsing of continuation responses

Enhanced the parsing to only allow continuation responses in some
states.

11 years agoimap: Simplified memcmp() in tagged response parsing
Steve Holme [Sun, 24 Feb 2013 12:45:04 +0000 (12:45 +0000)]
imap: Simplified memcmp() in tagged response parsing

11 years agoimap: Reworked the logic of untagged command responses
Jiri Hruska [Sun, 24 Feb 2013 12:27:49 +0000 (13:27 +0100)]
imap: Reworked the logic of untagged command responses

11 years agoimap: Corrected spacing of trailing brace
Steve Holme [Sun, 24 Feb 2013 12:05:15 +0000 (12:05 +0000)]
imap: Corrected spacing of trailing brace

11 years agoimap: Added stricter parsing of tagged command responses
Jiri Hruska [Sun, 24 Feb 2013 11:48:43 +0000 (12:48 +0100)]
imap: Added stricter parsing of tagged command responses

Enhanced the parsing of tagged responses which must start with "OK",
"NO" or "BAD"

11 years agoimap: Simplified command response test in imap_endofresp()
Jiri Hruska [Sun, 24 Feb 2013 11:23:06 +0000 (12:23 +0100)]
imap: Simplified command response test in imap_endofresp()

11 years agoimap: Corrected comment in imap_endofresp()
Jiri Hruska [Sun, 24 Feb 2013 11:21:53 +0000 (12:21 +0100)]
imap: Corrected comment in imap_endofresp()

11 years agoDOCS: Corrected layout of POP3 and IMAP URL examples
Steve Holme [Sun, 24 Feb 2013 00:47:38 +0000 (00:47 +0000)]
DOCS: Corrected layout of POP3 and IMAP URL examples

Corrected layout issues with the POP3 and IMAP URL examples introduced
in commit cb3ae6894fb2.

11 years agoDOCS: Updated CURLOPT_URL section following recent POP3 and IMAP changes
Steve Holme [Sat, 23 Feb 2013 23:14:12 +0000 (23:14 +0000)]
DOCS: Updated CURLOPT_URL section following recent POP3 and IMAP changes

Updated the POP3 sub-section to refer to message ID rather than mailbox.

Added an IMAP sub-section with example URLs depicting the specification
of mailbox, uid and section.

11 years agopop3: Refactored the mailbox variable as it didn't reflect it's purpose
Steve Holme [Sat, 23 Feb 2013 21:43:59 +0000 (21:43 +0000)]
pop3: Refactored the mailbox variable as it didn't reflect it's purpose

Updated the mailbox variable to correctly reflect it's purpose. The
name mailbox was a leftover from when IMAP and POP3 support was
initially added to curl.

11 years agoFEATURES: Updated following recent IMAP changes
Steve Holme [Sat, 23 Feb 2013 21:15:06 +0000 (21:15 +0000)]
FEATURES: Updated following recent IMAP changes

11 years agoimap: Added the ability to FETCH a specific UID and SECTION
Jiri Hruska [Sat, 23 Feb 2013 21:05:19 +0000 (22:05 +0100)]
imap: Added the ability to FETCH a specific UID and SECTION

Updated the FETCH command to send the UID and SECTION parsed from the
URL. By default the BODY specifier doesn't include a section, BODY[] is
now sent whereas BODY[TEXT] was previously sent. In my opinion
retrieving just the message text is rarely useful when dealing with
emails, as the headers are required for example, so that functionality
is not retained. In can however be simulated by adding SECTION=TEXT to
the URL.

Also updated test801 and test1321 due to the BODY change.

11 years agoemail: Additional tidy up of comments following recent changes
Steve Holme [Sat, 23 Feb 2013 20:02:05 +0000 (20:02 +0000)]
email: Additional tidy up of comments following recent changes