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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Steve Holme [Sat, 23 Feb 2013 16:15:38 +0000 (16:15 +0000)]
pop3: Moved the per-request variables to the per-request data structure
Moved the mailbox and custom request variables from the per-connection
struct pop3_conn to the new per-request struct and fixed references
accordingly.
Steve Holme [Fri, 22 Feb 2013 23:29:33 +0000 (23:29 +0000)]
imap: Fixed memory leak when performing multiple selects
Moved the clean-up of the mailbox variable from imap_disconnect() to
imap_done() as this variable is allocated in the do phase, yet would
have only been freed only once if multiple selects where preformed
on a single connection.
Alexander Klauer [Fri, 22 Feb 2013 12:06:54 +0000 (13:06 +0100)]
libcurl documentation: clarifications and typos
* Elaborates on default values of some curl_easy_setopt() options.
* Reminds the user to cast variadic arguments to curl_easy_setopt() to
'void *' where curl internally interprets them as such.
* Clarifies the working of the CURLOPT_SEEKFUNCTION option for
curl_easy_setopt().
* Fixes typo 'forth' → 'fourth'.
* Elaborates on CURL_SOCKET_TIMEOUT.
* Adds some missing periods.
* Notes that the return value of curl_version() must not be passed to
free().
Alexander Klauer [Fri, 22 Feb 2013 12:06:53 +0000 (13:06 +0100)]
lib/url.c: Generic read/write data pointers
Always interprets the pointer passed with the CURLOPT_WRITEDATA or
CURLOPT_READDATA options of curl_easy_setopt() as a void pointer in
order to avoid problems in environments where FILE and void pointers
have non-trivial conversion.
Alexander Klauer [Fri, 22 Feb 2013 12:06:52 +0000 (13:06 +0100)]
libcurl documentation: updates HTML index
* Adds several links to documentation of library functions which were
missing.
* Marks documentation of deprecated library functions "(deprecated)".
* Removes spurious .html suffixes.
Jiri Hruska [Fri, 15 Feb 2013 15:42:49 +0000 (16:42 +0100)]
Fixed checking the socket if there is data waiting in the cache
Use Curl_pp_moredata() in Curl_pp_multi_statemach() to check if there is
more data to be received, rather than the socket state, as a task could
hang waiting for more data from the socket itself.
Jiri Hruska [Thu, 14 Feb 2013 18:36:43 +0000 (19:36 +0100)]
pingpong: Introduce Curl_pp_moredata()
A simple function to test whether the PP is not sending and there are
still more data in its receiver cache. This will be later utilized to:
1) Change Curl_pp_multi_statemach() and Curl_pp_easy_statemach() to
not test socket state and just call user's statemach_act() function
when there are more data to process, because otherwise the task would
just hang, waiting for more data from the socket.
2) Allow PP users to read multiple responses by looping as long as there
are more data available and current phase is not finished.
(Currently needed for correct processing of IMAP SELECT responses.)
The this_url pointer wasn't being initialized, so if strdup() would return
null when copying the filename in a metalink file, then hilarity would
ensue during the cleanup phase. This change was brought to you by clang,
which noticed this and raised a warning.
Nick Zitzmann [Mon, 18 Feb 2013 23:27:30 +0000 (16:27 -0700)]
docs: schannel and darwinssl documentation improvements
Schannel and darwinssl use the certificates built into the
OS to do vert verification instead of bundles. darwinssl
is thread-safe. Corrected typos in the NSS docs.
Daniel Stenberg [Mon, 18 Feb 2013 21:52:58 +0000 (22:52 +0100)]
resolver_error: remove wrong error message output
The attempt to use gai_strerror() or alternative function didn't work as
the 'sock_error' field didn't contain the proper error code. But since
this hasn't been reported and thus isn't really a big deal I decided to
just scrap the whole attempt to output the detailed resolver error and
instead remain with just stating that the resolving of the name failed.