aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-tcp-stream-raw.c
Commit message (Collapse)AuthorAgeFilesLines
* Use camel_read(). (stream_write): Use camel_write().Jeffrey Stedfast2003-07-091-118/+6
| | | | | | | | | | | | 2003-07-08 Jeffrey Stedfast <fejj@ximian.com> * camel-tcp-stream-raw.c (stream_read): Use camel_read(). (stream_write): Use camel_write(). * camel-stream-fs.c (stream_read): Use camel_read(). (stream_write): Use camel_write(). svn path=/trunk/; revision=21758
* Updated to use the new API from a fe commits ago for the NSS stream. ThisJeffrey Stedfast2003-03-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | 2003-03-03 Jeffrey Stedfast <fejj@ximian.com> * camel-tcp-stream-openssl.c (camel_tcp_stream_ssl_new): Updated to use the new API from a fe commits ago for the NSS stream. This is just to make it compile, but does not update the behaviour to act like the NSS stream. Note that people shouldn't be using OpenSSL anyway. (camel_tcp_stream_ssl_new_raw): Same. * camel-process.[c,h]: New source file containing convenience functions for process creation/termination mainly for use with Pipe filters but should be usable for anything we want. * camel-io.[c,h]: New source files implementing read/write system calls with proper error checking and cancellation (ie. StreamFs::read/write and CamelTcpStreamRaw::read/write). No sense duplicating the same code over and over. Now I can use this same code easily in other i/o code (such as Pipe filters and gpg code?). svn path=/trunk/; revision=20132
* Use g_strerror when setting an exception string (we need it to be inJeffrey Stedfast2002-11-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2002-11-11 Jeffrey Stedfast <fejj@ximian.com> * providers/local/camel-spool-summary.c (spool_summary_sync_full): Use g_strerror when setting an exception string (we need it to be in UTF-8). (spool_summary_check): Here too. * providers/local/camel-spool-store.c (construct): Use g_strerror when setting an exception string (we need it to be in UTF-8). (get_folder): Same. (scan_dir): Here too. * providers/local/camel-spool-folder.c (spool_lock): Use g_strerror when setting an exception string (we need it to be in UTF-8). * providers/local/camel-mh-summary.c (mh_summary_check): Use g_strerror when setting an exception string (we need it to be in UTF-8). * providers/local/camel-mh-store.c (delete_folder): Use g_strerror when setting an exception string (we need it to be in UTF-8). * providers/local/camel-mbox-summary.c (summary_update): Use g_strerror when setting an exception string (we need it to be in UTF-8). (mbox_summary_sync_full): Here too. (mbox_summary_sync_quick): Same. (mbox_summary_sync): Also here. (camel_mbox_summary_sync_mbox): Again here. * providers/local/camel-mbox-folder.c (mbox_lock): Use g_strerror when setting an exception string (we need it to be in UTF-8). (mbox_append_message): Same. (mbox_get_message): Here too. * providers/local/camel-maildir-summary.c (maildir_summary_load): Use g_strerror when setting an exception string (we need it to be in UTF-8). (maildir_summary_check): Same. * providers/local/camel-maildir-store.c (get_folder): Use g_strerror when setting an exception string (we need it to be in UTF-8). (delete_folder): Same. (delete_folder): Here too. * providers/local/camel-local-summary.c (local_summary_sync): Use g_strerror when setting an exception string (we need it to be in UTF-8). * providers/local/camel-local-store.c (get_folder): Use g_strerror when setting an exception string (we need it to be in UTF-8). (create_folder): Same. (xrename): Here too. (rename_folder): And here. (delete_folder): Also here. * camel-provider.c (camel_provider_init): For debugging printfs, we want to use normal strerror (we want locale charset, not UTF-8). * camel-movemail.c (camel_movemail): Use g_strerror when setting an exception string (we need it to be in UTF-8). (movemail_external): Same. (camel_movemail_copy_file): Here too. (camel_movemail_solaris): Also here. * camel-mime-utils.c (rfc2047_decode_word): For debugging printfs, we want to use normal strerror (we want locale charset, not UTF-8). (header_encode_param): Same. * camel-mime-part-utils.c (convert_buffer): For debugging printfs, we want to use normal strerror (we want locale charset, not UTF-8). * camel-lock-client.c (camel_lock_helper_init): Use g_strerror when setting an exception string (we need it to be in UTF-8). * camel-data-cache.c (camel_data_cache_remove): Use g_strerror when setting an exception string (we need it to be in UTF-8). * camel-tcp-stream-raw.c (flaky_tcp_write): For debugging printfs, we want to use normal strerror (we want locale charset, not UTF-8). (flaky_tcp_read): Same. * camel-gpg-context.c (gpg_ctx_op_step): For debugging printfs, we want to use normal strerror (we want locale charset, not UTF-8). * camel-service.c (camel_gethostbyname): Use g_strerror when setting an exception string (we need it to be in UTF-8). * camel-lock.c (camel_lock_dot): Use g_strerror when setting an exception string (we need it to be in UTF-8). (camel_lock_fcntl): Same. svn path=/trunk/; revision=18689
* simplifiedJeffrey Stedfast2002-08-291-1/+1
| | | | svn path=/trunk/; revision=17912
* Fixed `set' to hold the correct value when setting the flags.Jeffrey Stedfast2002-08-291-2/+2
| | | | | | | | | 2002-08-28 Jeffrey Stedfast <fejj@ximian.com> * camel-tcp-stream-raw.c (stream_setsockopt): Fixed `set' to hold the correct value when setting the flags. svn path=/trunk/; revision=17911
* Update the comment.Jeffrey Stedfast2002-07-311-18/+78
| | | | | | | | | | | | | | | | | | | | | | | | | 2002-07-30 Jeffrey Stedfast <fejj@ximian.com> * camel-tcp-stream.c (camel_tcp_address_new): Update the comment. * camel-tcp-stream-raw.c (socket_connect): If building with IPv6 support and the address is an IPv6 address, connect using a sockaddr_in6 otherwise use the standard IPv4 sockaddr_in structure. (stream_get_local_address): Fix to work with IPv6 addresses. (stream_get_remote_address): Same. * camel-tcp-stream-openssl.c (socket_connect): Same as above. (stream_get_local_address): Fix to work with IPv6 addresses. (stream_get_remote_address): Same. * camel-tcp-stream-ssl.c (stream_connect): If building with IPv6 support and the address is an IPv6 address, initialise the PRNetAddr accordingly. (stream_get_local_address): Fix to work with IPv6 addresses. (stream_get_remote_address): Same. svn path=/trunk/; revision=17651
* Don't bother with counting down the timeout.Jeffrey Stedfast2002-05-071-7/+2
| | | | | | | | | 2002-05-06 Jeffrey Stedfast <fejj@ximian.com> * camel-tcp-stream-raw.c (socket_connect): Don't bother with counting down the timeout. svn path=/trunk/; revision=16690
* Same fix as the tcp stream. (stream_write): Again here. Just like tcpJeffrey Stedfast2002-05-031-38/+61
| | | | | | | | | | | | | | | | 2002-05-02 Jeffrey Stedfast <fejj@ximian.com> * camel-stream-fs.c (stream_read): Same fix as the tcp stream. (stream_write): Again here. Just like tcp stream's stream_write(), also make sure to save errno before calling fcntl to restore the fd flags. * camel-tcp-stream-raw.c (stream_read): Handle EINTR errors for select(). (stream_write): Same and also preserve errno when setting the fd flags back. If w == -1, return -1. svn path=/trunk/; revision=16673
* Get rid of an unused variable.Jeffrey Stedfast2002-04-171-6/+6
| | | | | | | | | | | | | | | | | | | 2002-04-16 Jeffrey Stedfast <fejj@ximian.com> * camel-filter-driver.c (camel_filter_driver_filter_folder): Get rid of an unused variable. * providers/smtp/camel-smtp-transport.c (smtp_helo): Use camel_gethostbyaddr since gethostbyaddr is not reentrant. * camel-http-stream.c (http_connect): Updated after the rename of camel_get_host_byname. * camel-service.c (camel_gethostbyname): Renamed. (camel_gethostbyaddr): New cancellable/reentrant version of gethostbyaddr. svn path=/trunk/; revision=16484
* Remove this: it couldn't be generically used, because different subclassesDan Winship2002-03-111-6/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * camel-tcp-stream.c (camel_tcp_stream_get_socket): Remove this: it couldn't be generically used, because different subclasses returned entirely different types of data. (camel_tcp_stream_get_local_address, camel_tcp_stream_get_remote_address): Add these to replace what get_socket was being used for. (camel_tcp_address_new, camel_tcp_address_free): Utility functions for get_{local,remote}_address. * providers/smtp/camel-smtp-transport.c: Change localaddr to a CamelTcpAddress *. (connect_to_server): Call camel_tcp_stream_get_local_address to get the local IP address. (smtp_disconnect): free localaddr. (smtp_helo): Update for localaddr change. * camel-tcp-stream-raw.c (stream_get_socket): Remove (stream_get_local_address, stream_get_remote_address): Implement. * camel-tcp-stream-ssl.c (stream_get_socket): Remove (stream_get_local_address, stream_get_remote_address): Implement. * camel-tcp-stream-openssl.c (stream_get_socket): Remove (stream_get_local_address, stream_get_remote_address): Implement. svn path=/trunk/; revision=16092
* merged some changes from the 1-0 branch that apparently never got merged ↵Jeffrey Stedfast2001-12-141-2/+2
| | | | | | into HEAD svn path=/trunk/; revision=15019
* Make sure we've actually read data before checking if p[-] is '\r' or not.Jeffrey Stedfast2001-10-281-6/+57
| | | | | | | | | 2001-10-28 Jeffrey Stedfast <fejj@ximian.com> * camel-stream-buffer.c (camel_stream_buffer_read_line): Make sure we've actually read data before checking if p[-] is '\r' or not. svn path=/trunk/; revision=14288
* Same.Jeffrey Stedfast2001-10-281-8/+8
| | | | | | | | | | | | | | 2001-10-28 Jeffrey Stedfast <fejj@ximian.com> * camel-tcp-stream-raw.c (stream_write): Same. * camel-stream-fs.c (stream_write): If errno isn't EAGAIN, just exit with -1 and instead of using continue (which doesn't go to the top of the do-while thus making our logic suck), just set w to 0. Still seems to be a bug in select() if it's telling us the socket is ready for data when it really isn't but oh well. svn path=/trunk/; revision=14286
* More fixing of the license texts.Ettore Perazzoli2001-10-281-11/+11
| | | | svn path=/trunk/; revision=14216
* Check for EWOULDBLOCK too? (stream_read): Same. (stream_flush): Return 0Jeffrey Stedfast2001-10-271-1/+1
| | | | | | | | | | | | | | | | | | | 2001-10-26 Jeffrey Stedfast <fejj@ximian.com> * camel-tcp-stream-raw.c (stream_write): Check for EWOULDBLOCK too? (stream_read): Same. (stream_flush): Return 0 always, fsync() and tcp sockets don't play nice :-) * providers/imap/camel-imap-message-cache.c (camel_imap_message_cache_get): Lets try putting a camel_stream_reset() here. Logic being that the stream may have been read from since it was cached and thus our caller may try reading from it and get no data from it since it is already at the EOS. This may fix bug #12943. svn path=/trunk/; revision=14180
* Check for EWOULDBLOCK too? (stream_read): Same.Jeffrey Stedfast2001-10-271-5/+29
| | | | | | | | | | | | | | | | 2001-10-26 Jeffrey Stedfast <fejj@ximian.com> * camel-tcp-stream-raw.c (stream_write): Check for EWOULDBLOCK too? (stream_read): Same. * providers/imap/camel-imap-message-cache.c (camel_imap_message_cache_get): Lets try putting a camel_stream_reset() here. Logic being that the stream may have been read from since it was cached and thus our caller may try reading from it and get no data from it since it is already at the EOS. This may fix bug #12943. svn path=/trunk/; revision=14179
* updated the SIMULATE_FLAKY_NETWORK codeJeffrey Stedfast2001-10-251-10/+12
| | | | svn path=/trunk/; revision=13995
* Same as in the TcpStreamRaw code. (stream_write): And again here...Jeffrey Stedfast2001-10-251-27/+61
| | | | | | | | | | | | | | 2001-10-24 Jeffrey Stedfast <fejj@ximian.com> * camel-stream-fs.c (stream_read): Same as in the TcpStreamRaw code. (stream_write): And again here... * camel-tcp-stream-raw.c (stream_read): Handle the EAGAIN error case as well. (stream_write): Same here, this might fix the SMTP truncation thing? I hope? svn path=/trunk/; revision=13993
* As below.Not Zed2001-10-171-2/+7
| | | | | | | | | | | 2001-10-17 Not Zed <NotZed@Ximian.com> * camel-tcp-stream-raw.c (stream_write): As below. * camel-stream-fs.c (stream_write): If not checking cancellation, make sure we write out everything asked of us. svn path=/trunk/; revision=13717
* Likewise.Not Zed2001-09-081-4/+15
| | | | | | | | | | | | | | | 2001-09-08 Not Zed <NotZed@Ximian.com> * providers/local/camel-spool-summary.c (spool_summary_sync_full): Likewise. * providers/local/camel-mbox-summary.c (mbox_summary_sync_full): Fix the wording. * camel-tcp-stream-raw.c (stream_read): Save errno around fcntl call in cancellable read case. Also, loop while we get EINTR. This might fix some weird reconnect behaviour with pop. (stream_write): " svn path=/trunk/; revision=12700
* s/IMAPv4/IMAPJeffrey Stedfast2001-08-281-1/+1
| | | | | | | | 2001-08-27 Jeffrey Stedfast <fejj@ximian.com> * providers/imap/camel-imap-provider.c: s/IMAPv4/IMAP svn path=/trunk/; revision=12485
* Big header cleanups and nntp compile fixKjartan Maraas2001-03-301-3/+5
| | | | svn path=/trunk/; revision=9024
* Print info about the issuer of the certificate.Jeffrey Stedfast2001-03-171-0/+8
| | | | | | | | | | | | | | | | | | | | 2001-03-16 Jeffrey Stedfast <fejj@ximian.com> * camel-tcp-stream-ssl.c (ssl_bad_cert): Print info about the issuer of the certificate. * providers/smtp/camel-smtp-transport.c (smtp_connect): Use camel_tcp_stream_get_socket(). * camel-tcp-stream-openssl.c (stream_get_socket): Implemented. * camel-tcp-stream-ssl.c (stream_get_socket): Implemented. * camel-tcp-stream-raw.c (stream_get_socket): Implemented. * camel-tcp-stream.c (camel_tcp_stream_get_socket): New function. svn path=/trunk/; revision=8764
* Check for a new type of mailing list header.Jeffrey Stedfast2001-03-141-0/+1
| | | | | | | | 2001-03-14 Jeffrey Stedfast <fejj@ximian.com> * camel-mime-utils.c: Check for a new type of mailing list header. svn path=/trunk/; revision=8702
* Made cancellable. (stream_write): Same. (stream_connect): Removed checksJeffrey Stedfast2001-03-141-33/+73
| | | | | | | | | | | | | | | | | | 2001-03-13 Jeffrey Stedfast <fejj@ximian.com> * camel-tcp-stream-raw.c (stream_read): Made cancellable. (stream_write): Same. (stream_connect): Removed checks for DIVINE_INTERVENTION as the code worked fine. * camel-tcp-stream-ssl.c (stream_write): get rid of 'w' as it wasn't really needed. (set_errno): New function to set errno based on the NSPR error code. (stream_read): If an error occured, call set_errno(). (stream_write): Same. svn path=/trunk/; revision=8701
* Oops. Make this a subclass of CamelTcpStream, not CamelStream.Jeffrey Stedfast2001-03-141-4/+105
| | | | | | | | | | | | | | | | | | | | | | | | 2001-03-13 Jeffrey Stedfast <fejj@ximian.com> * camel-tcp-stream-ssl.c (camel_tcp_stream_ssl_get_type): Oops. Make this a subclass of CamelTcpStream, not CamelStream. * camel-types.h: Add the defs for CamelTcpStream and CamelTcpStreamRaw * Makefile.am: Add camel-tcp-stream and camel-tcp-stream-raw to the build. * camel-remote-store.c (remote_connect): Update to use CamelTcpStreams. * camel-tcp-stream-raw.c (stream_connect): Made cancellable by copying the currently used code in camel-remote-store.c. (stream_setsockopt): Oops, flags = fcntl (..., GET_FL); (camel_tcp_stream_raw_get_type): Oops. Make this a subclass of CamelTcpStream, not CamelStream. svn path=/trunk/; revision=8697
* fcntl(fd, F_GETFL) returns the flags as the return value, not via a passedDan Winship2001-01-171-4/+6
| | | | | | | | | | | | | | | | | | * camel-tcp-stream-raw.c (stream_getsockopt, stream_setsockopt): * camel-stream-fs.c (stream_read, stream_write): * camel-remote-store.c (socket_connect): fcntl(fd, F_GETFL) returns the flags as the return value, not via a passed in pointer. And F_SETFL looks for an int, not a long, and you have to pass it what it's expecting because it's a va_arg parameter. (Yes, the man page lies on Linux. But check the UNIX98 spec or the glibc source.) Also, fix another bug in socket_connect: if we manage to connect right away, unset O_NONBLOCK so it doesn't mess us up later. Fixes a bunch of problems with non-blocking I/O being done in the allegedly-blocking case and then returning EWOULDBLOCK. svn path=/trunk/; revision=7555
* If the close() is successful, set the fd to -1.Jeffrey Stedfast2001-01-161-11/+6
| | | | | | | | | | | | | | | | | | | | | 2001-01-15 Jeffrey Stedfast <fejj@ximian.com> * camel-stream-fs.c (stream_close): If the close() is successful, set the fd to -1. * camel-tcp-stream-raw.c: Removed the disconnect() method. (stream_close): If the close() is successful, set the sockfd to -1. * camel-tcp-stream-ssl.c: Removed the disconnect() method. (stream_close): If the close() is successful, set the sockfd to NULL. * camel-tcp-stream.c (camel_tcp_stream_disconnect): Removed, easier to just use the close() method as it did the same thing anyway. svn path=/trunk/; revision=7522
* Updated to be able to get the CAMEL_SOCKOPT_NONBLOCKING socket opt.Jeffrey Stedfast2001-01-161-0/+26
| | | | | | | | | | | 2001-01-15 Jeffrey Stedfast <fejj@ximian.com> * camel-tcp-stream-raw.c (stream_getsockopt): Updated to be able to get the CAMEL_SOCKOPT_NONBLOCKING socket opt. (stream_setsockopt): Updated to be able to set the CAMEL_SOCKOPT_NONBLOCKING socket opt. svn path=/trunk/; revision=7519
* Implemented. (stream_setsockopt): Implemented.Jeffrey Stedfast2001-01-151-0/+74
| | | | | | | | | | | | | | | | 2001-01-14 Jeffrey Stedfast <fejj@ximian.com> * camel-tcp-stream-ssl.c (stream_getsockopt): Implemented. (stream_setsockopt): Implemented. * camel-tcp-stream-raw.c (stream_getsockopt): Implemented. (stream_setsockopt): Implemented. * camel-tcp-stream.c (camel_tcp_stream_getsockopt): New method. (camel_tcp_stream_setsockopt): Another new method. I think you get the idea of what these are for so I won't explain them. svn path=/trunk/; revision=7491
* New CamelTcpStream class that implements nspr sockets and eventually willJeffrey Stedfast2001-01-141-0/+196
2001-01-14 Jeffrey Stedfast <fejj@helixcode.com> * camel-tcp-stream-ssl.[c,h]: New CamelTcpStream class that implements nspr sockets and eventually will use nss for SSL/TLS. Currently doesn't do any SSL/TLS but it should still work. It's functionally equivalent to CamelTcpStreamRaw at the moment only it uses nspr i/o. * camel-tcp-stream-raw.[c,h]: New CamelTcpStream class that implements native sockets. Should be usable but may have some bugs yet. svn path=/trunk/; revision=7489