summaryrefslogtreecommitdiff
path: root/libsoup/soup-message-io.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Add SoupMessageQueueItemState, remove SoupMessageIOStatusDan Winship2010-06-091-1/+1
| | | | | | SoupMessageIOStatus was always really more about the session than the message. (SoupServer I/O didn't use it at all.) Replace it with a new SoupMessageQueueItemState, on the queue item rather than the message.
* soup-message-io: use SoupMessageQueueItems and add SoupMessageCompletionFnDan Winship2010-06-091-41/+43
| | | | | | push SoupMessageQueueItem down into soup-message-io, and end the I/O process by calling a completion callback rather than emitting the SoupMessage signals directly, which gives the session greater control.
* Misc SoupConnection API improvementsDan Winship2010-06-091-4/+3
| | | | | | | | | Use GCancellables in connect_async/connect_sync (plus updates needed for behavior changes caused by that). Make soup_connection_disconnect() always emit the signal if the connection state wasn't already DISCONNECTED, even if it wasn't yet connected before. Remove some dead code in clear_current_request. Remove some more-or-less redundant arguments in soup_message_send_request().
* soup-message-io: only retry on I/O error if the connection has been usedDan Winship2010-05-221-0/+1
| | | | | | | | An I/O failure on a previously-used connection may indicate that the server timed out the connection; an I/O error on a fresh connection should not. Fixes infinite retries in certain edge cases. Part of https://bugzilla.gnome.org/show_bug.cgi?id=615535
* New SoupMessageFlag to report whether it has dealt with a trusted certificateGustavo Noronha Silva2010-02-211-0/+11
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=610374
* Fix error propagation on SSL cert errorsDan Winship2010-02-211-13/+12
|
* Content-Encoding supportDan Winship2009-12-161-2/+41
| | | | | | | | | Adds SoupContentDecoder, which provides support for decoding "gzip" Content-Encoding. For now other types are not supported and can't be added. The SoupCoding interface is private because it will eventually be replaced with something GConverter-based. https://bugzilla.gnome.org/show_bug.cgi?id=522772
* Fix the latest round of "Connection terminated unexpectedly" errorsDan Winship2009-10-181-1/+18
| | | | | | | | | | | | | | | | | | The fix introduced in ef7fc058 for bug 578990 caught most cases where we'd write a request to an already-closed connection, but not all. Unfortunately, at some point the code path for recovering from that case got broken, so when it did happen, we'd always end up returning the error to the app rather than retrying the request. This is now fixed again. The specific recent cause of the problem was that the multiple-pending-connections fix (baa316ac/bug 594768) results in us sometimes opening more connections than we need, and so some of those connections become idle without ever having had a message sent across them. Servers tend to have different timeouts/behaviors here than with idle persistent connections, so we should time them out more aggressively. So now we close a connection after 3 seconds if it hasn't been used yet.
* Fix leaks, including a large one in SoupContentSnifferDan Winship2009-09-111-0/+1
| | | | | | Fix a handful of leaks noticed by valgrind, including a leak of the buffers being passed to SoupContentSniffer (https://bugs.webkit.org/show_bug.cgi?id=28148).
* Do not discard the request body after sending, even if !accumulateDan Winship2009-07-271-2/+4
| | | | | | | | | | | | | | | | We can't discard the request body until the message is completely finished, because it may be necessary to send it a second time due to redirect, authentication, or premature connection close. In particular, if the request body did get discarded, then when soup-message-io tried to send it the second time, it would see a non-0 content-length but no body chunks, and so would assume that the application was intending to stream the body, and so would pause it and wait for the first chunk. Since the application was not actually intending to stream the request, this would result in the message getting stuck forever. http://bugzilla.gnome.org/show_bug.cgi?id=584645
* Miscellaneous content-sniffing fixesDan Winship2009-07-101-102/+65
| | | | | | | | | | | | | | | | | | Remove the should_sniff_content flag; if there is a sniffer, we always sniff. Clean up soup-message-io a bit to require fewer special cases, and fix a few potential leaks/crashes where it wasn't dealing with IF_CANCELLED_OR_PAUSED correctly. (Although this looks like a large patch, it actually results in a much smaller diff relative to 2.26. Fix tests/sniffing-test to do chunked encoding correctly, make sure to return data in chunks that are smaller than the sniffing buffer size, and make resources/mbox larger than the sniffing buffer size so it takes multiple reads to get enough data (when using chunked encoding). Also add tests for empty response bodies (from Gustavo). http://bugzilla.gnome.org/show_bug.cgi?id=587907
* Actually test chunked encoding, and fix some hangsGustavo Noronha Silva2009-07-101-10/+8
| | | | | | | | | | | The test was not really testing chunked encoding, because of incorrect handling of the query string in the SoupURI, now it does. This has exposed a couple hangs. This change also avoids hanging on chunked encoding messages on the sniffing test by calling soup_message_body_complete(), and by sanitizing IO read state and read_length inconditionally when we reach got_body, during message IO.
* Implement content sniffingGustavo Noronha Silva2009-07-021-4/+124
| | | | | | | | | | | | | | | | The implementation is based on the draft spec on Content-Type Processing Model (draft-abarth-mime-sniff-01). It is a spinoff from the HTML5 spec. Soup now provides a SoupContentSniffer session feature, which hooks into the message I/O, and delays emissions of the got-chunk signal to be able to figure out the Content-Type of messages from the actual content received, in some cases. GIO is also used to sniff content, whenever the spec allows further sniffing. http://bugzilla.gnome.org/show_bug.cgi?id=572589
* SoupConnection/SoupSession reorg and cleanupDan Winship2009-06-061-1/+1
| | | | | | | Move CONNECT handling from SoupConnection to SoupSession so it works more like other requests. Generally clean up and simplify SoupConnection, and simplify the coordination between SoupSession and its subclasses.
* Fix a warning introduced in fix for bug 582002Dan Winship2009-05-151-2/+2
|
* Fix the header/body boundary detection logicDan Winship2009-05-091-1/+9
| | | | | | | | | The change to support LF LF in addition to CRLF CRLF broke this subtly so that if the first network read returned a packet that ended at a CR, then the following LF would be mistakenly interpreted as ending the headers. http://bugzilla.gnome.org/show_bug.cgi?id=582002
* Bug 571283 - Allow LF LF instead of CRLF CRLF as header/body separatorDan Winship2009-03-241-18/+33
| | | | | | | | | | | * libsoup/soup-message-io.c (read_metadata): Change how this works; instead of taking a boundary string, just always pass "\n" as the boundary to soup_socket_read_until(), but call it multiple times if the caller wants us to read until a blank line. (io_read): update to deal with the fact that the headers might be terminated by LF LF rather than CRLF CRLF. svn path=/trunk/; revision=1253
* Bug 572153 – SoupServer doesn't support SOUP_ENCODING_EOFDan Winship2009-02-191-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libsoup/soup-message-io.c (io_write): Various fixes to make SOUP_ENCODING_EOF work correctly when sending response bodies. (Previously, the code assumed that SoupServer responses would always be chunked or Content-Length-encoded.) * libsoup/soup-message-client-io.c (get_request_headers): when changing a request body from SOUP_ENCODING_NONE to SOUP_ENCODING_CONTENT_LENGTH, return the new encoding value to soup-message-io, not the old one. * libsoup/soup-message.c (set_property): when setting priv->server_side to TRUE, set the default encoding on the response headers to CONTENT_LENGTH. (Moved from SoupServer.) (soup_message_cleanup_response): If priv->server_side is TRUE, re-fix the response header encoding after clearing the headers. Otherwise the response headers revert to SOUP_ENCODING_EOF after sending a "100 Continue". (soup_message_is_keepalive): reorganize a little, fix a bug in the HTTP/1.0 case. * libsoup/soup-server.c (start_request): remove request encoding override from here. * tests/streaming-test.c: new test of SoupServer response streaming, testing chunked, content-length, and eof-terminated responses svn path=/trunk/; revision=1243
* Fix this; previously it would discard the entire message body afterDan Winship2009-01-291-1/+1
| | | | | | | | | | | | | | * libsoup/soup-message-body.c (soup_message_body_wrote_chunk): Fix this; previously it would discard the entire message body after writing a SOUP_MEMORY_TEMPORARY chunk. Part of WebKit bug 18343. * libsoup/soup-message-io.c (io_write): use io->write_chunk->length *before* freeing io->write_chunk. * tests/chunk-test.c (do_temporary_test): new test to make sure that TEMPORARY buffers are handled properly. svn path=/trunk/; revision=1232
* Add this to schedule a callback in a GMainContext "right away", as opposedDan Winship2008-07-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | * libsoup/soup-misc.c (soup_add_completion): Add this to schedule a callback in a GMainContext "right away", as opposed to soup_add_idle(), which uses a lower priority and therefore may not end up calling the callback for a long time if the application is busy with I/O. #536676, Benjamin Otte. * libsoup/soup-dns.c (resolver_thread, async_cancel) (soup_dns_lookup_resolve_async): * libsoup/soup-message-io.c (soup_message_io_unpause): * libsoup/soup-session-sync.c (queue_message_thread): * libsoup/soup-session-async.c (do_idle_run_queue): * libsoup/soup-socket.c (async_cancel) (soup_socket_connect_async): * tests/test-utils.c (test_server_shutdown): Use soup_add_completion() rather than soup_add_idle(). * docs/reference/libsoup-2.4-sections.txt: add soup_add_completion svn path=/trunk/; revision=1147
* change read_length, write_length, and written to goffset so we canDan Winship2008-07-261-3/+3
| | | | | | | | * libsoup/soup-message-io.c (SoupMessageIOData): change read_length, write_length, and written to goffset so we can properly handle message bodies > 4G. #539861, Peter Christensen. svn path=/trunk/; revision=1145
* If pausing a message that was waiting to unpause, cancel the unpause.Dan Winship2008-04-071-0/+5
| | | | | | | * libsoup/soup-message-io.c (soup_message_io_pause): If pausing a message that was waiting to unpause, cancel the unpause. svn path=/trunk/; revision=1128
* New, replaces SOUP_MESSAGE_OVERWRITE_CHUNKS, but can be set on either theDan Winship2008-04-051-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libsoup/soup-message-body.c (soup_message_body_set_accumulate) (soup_message_body_get_accumulate): New, replaces SOUP_MESSAGE_OVERWRITE_CHUNKS, but can be set on either the incoming or outgoing message body. (soup_message_body_get_chunk): update to still dtrt if !accumulate (soup_message_body_got_chunk, soup_message_body_wrote_chunk): New methods to handle accumulating/discarding chunks. * libsoup/soup-message-io.c (read_body_chunk): Use soup_message_body_got_chunk. (io_write): Use soup_message_body_wrote_chunk, to discard unneeded chunks after writing them. Fixes most of #522146. * libsoup/soup-message.c (soup_message_class_init): add a new flag, "server-side", to indicate whether the message is client-side or server-side, and update several methods to use it. (got_body): Update for accumulate (soup_message_set_flags): If the caller changes OVERWRITE_CHUNKS, update the corresponding accumulate flag. * libsoup/soup-message.h (SOUP_MESSAGE_OVERWRITE_CHUNKS): deprecated now * tests/chunk-test.c (do_request_test): Use soup_message_body_set_accumulate() now, and verify that the chunks are being discarded appropriately. (do_response_test): Use soup_message_body_set_accumulate() instead of OVERWRITE_CHUNKS. * tests/pull-api.c (do_fully_async_test) (do_synchronously_async_test): Use soup_message_body_set_accumulate(). svn path=/trunk/; revision=1126
* add a new signal "wrote-body-data" to address the problem thatDan Winship2008-04-041-13/+62
| | | | | | | | | | | | | | | | | | | | | | * libsoup/soup-message.c: add a new signal "wrote-body-data" to address the problem that "wrote-chunk" is not usable for progress info (especially with non-chunked encoding). #525101, suggested by Christian Kellner. * libsoup/soup-message-io.c (write_data): emit wrote-body-data as appropriate. (io_write): update so that (a) Content-Length writes can be done in multiple chunks (as long as the caller explicitly sets the Content-Length header beforehand), and (b) the body data doesn't get copied an extra time. Based on a patch from Christian. * libsoup/soup-message-client-io.c (get_request_headers): Don't update the Content-Length header if it's already set, even if it doesn't match the (current) body length. * tests/chunk-test.c: test some chunk-encoding-related behavior svn path=/trunk/; revision=1120
* if delaying the unpause to idle time, we need to keep track of the idleDan Winship2008-03-181-3/+13
| | | | | | | | | | | | * libsoup/soup-message-io.c (soup_message_io_unpause): if delaying the unpause to idle time, we need to keep track of the idle source (soup_message_io_stop): if the message is waiting to unpause itself, cancel that * libsoup/soup-server.c (soup_server_pause_message): call soup_message_io_pause(), not soup_message_io_unpause(). Duh. svn path=/trunk/; revision=1111
* New method that lets the application set a callback function to use toDan Winship2008-02-071-12/+30
| | | | | | | | | | | | | | | | | | | | | | * libsoup/soup-message.c (soup_message_set_chunk_allocator): New method that lets the application set a callback function to use to allocate SoupBuffers for reading into, so as to avoid needing extra copies. * libsoup/soup-message-body.c (soup_buffer_new_with_owner): new, to create a SoupBuffer pointing to memory owned by another object, with a GDestroyNotify to unref/free that object when the SoupBuffer is freed. (soup_buffer_get_owner): Returns the owner of a buffer created with soup_buffer_new_with_owner. (soup_buffer_free, etc): update SoupBuffer code for owned buffers. Suggested by Wouter Cloetens, #513810. * tests/simple-httpd.c (do_get): Use mmap() and soup_buffer_new_with_owner(), as a demo/test. svn path=/trunk/; revision=1075
* Merge libsoup-2.4 branch to trunkDan Winship2008-01-151-153/+123
| | | | | | * Merge libsoup-2.4 branch to trunk svn path=/trunk/; revision=1041
* fix docsDan Winship2007-11-261-2/+2
| | | | svn path=/trunk/; revision=957
* make this non-static.Dan Winship2007-11-211-4/+4
| | | | | | | | | | | * libsoup/soup-message-io.c (soup_message_io_cleanup): make this non-static. * libsoup/soup-message.c (finalize): Use soup_message_io_cleanup() rather than soup_message_io_stop(), to avoid leaks when finalizing an unfinished message. (Another part of #498509, Wouter Cloetens.) svn path=/trunk/; revision=956
* don't leak the async_contextDan Winship2007-11-211-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * libsoup/soup-message-io.c (soup_message_io_unpause): don't leak the async_context * libsoup/soup-server.c (soup_server_quit): disconnect the "new_connection" handler. (soup_server_get_async_context): Convenience method to return the server's async_context. * libsoup/soup-server-message.c: don't circularly ref the server, there's no need anyway. * libsoup/soup-session.c (soup_session_get_async_context): Convenience method to return the session's async_context. * libsoup/soup-session-async.c (queue_message): call run_queue in the session's async_context, not the main context. (send_message): don't leak the async_context * libsoup/soup-session-sync.c (queue_message_thread): don't leak the async_context * tests/context-test.c: test that SOUP_SESSION_ASYNC_CONTEXT works and doesn't leak svn path=/trunk/; revision=954
* Fix the guards around the got_chunk emission so that it doesn't get messedDan Winship2007-11-191-23/+54
| | | | | | | | | | | | | | | | | | | | | * libsoup/soup-message-io.c (read_body_chunk): Fix the guards around the got_chunk emission so that it doesn't get messed up if you pause the I/O from the got_chunk handler. (#452280, Marco Barisione). (soup_message_io_pause, soup_message_io_unpause): Update docs again; these are now allowed with client-side I/O as well. Fix unpause() to unpause asynchronously on async sockets. * libsoup/soup-session-async.c (send_message): Iterate session's async_context, not the default main context. * tests/pull-api.c: Test/sample of creating a pull-style API using SoupSessionAsync. * tests/index.txt: new file to act as DirectoryIndex for the tests. (In particular, pull-api wants this to be largeish.) svn path=/trunk/; revision=952
* remove the g_return_if_fail()s from the last patch so I don't end up breakingDan Winship2007-10-281-2/+0
| | | | | | anything that worked before... svn path=/trunk/; revision=948
* ref the socket around the processing of the message, since otherwise itDan Winship2007-10-281-4/+11
| | | | | | | | | | | | | | | | | | | | * libsoup/soup-server.c (start_request, request_finished): ref the socket around the processing of the message, since otherwise it might already be freed when request_finished runs. #459896. * libsoup/soup-message-io.c (soup_message_io_pause) (soup_message_io_unpause): Clarify the docs here; this is for server-side use only. Inspired by #452280. * docs/reference/server-howto.xml: You need to watch the "finished" signal on the message if using soup_message_io_pause() or chunked encoding, because the client might disconnect while you're paused. Clarification inspired by #471385. * tests/simple-proxy.c (client_msg_failed): Fix this to DTRT since server-howto.xml points to it as an example of what to do. svn path=/trunk/; revision=947
* Remove the calls to soup_message_io_stop() here; the corresponding callsDan Winship2006-12-051-0/+4
| | | | | | | | | | * libsoup/soup-message.c (soup_message_set_uri): Remove the calls to soup_message_io_stop() here; the corresponding calls were needed back in the SoupContext days, but they are wrong now and cause async-redirects-to-other-hosts to fail. #382251. Also clarify docs with respect to soup_session_requeue_message(). * libsoup/soup-message-io.c (soup_message_io_stop): Clarify docs
* initialize encoding to SOUP_TRANSFER_CONTENT_LENGTH rather thanDan Winship2006-07-211-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libsoup/soup-server-message.c (soup_server_message_init): initialize encoding to SOUP_TRANSFER_CONTENT_LENGTH rather than SOUP_TRANSFER_UNKNOWN, since SOUP_TRANSFER_UNKNOWN has never actually worked here, and so there was an undocumented requirement that you manually set the encoding on every response (which SoupServer itself was not doing on internal errors). Problem pointed out by Dennis Jacobfeuerborn on libsoup-list. (soup_server_message_set_encoding): reject the new SoupTransferEncoding values, for compatibility * libsoup/soup-message.h (SoupTransferEncoding): Clarify that SOUP_TRANSFER_UNKNOWN is essentially an error value, since in the public API, it always has been, due to bugs. Add some new values, currently just for internal use: SOUP_TRANSFER_NONE (for cases like HEAD which never have a body), SOUP_TRANSFER_EOF (to replace SOUP_TRANSFER_UNKNOWN), and SOUP_TRANSFER_BYTERANGES (which isn't actually implemented yet). * libsoup/soup-message.c (soup_message_get_request_encoding, soup_message_get_response_encoding): figure out the body encoding being used by the request/response, including all the tricky cases like HEAD/1xx/etc. (soup_message_is_keepalive): if the response encoding is SOUP_TRANSFER_EOF, then the message isn't keepalive. * libsoup/soup-message-client-io.c (parse_response_headers): use soup_message_get_response_encoding. * libsoup/soup-message-server-io.c (parse_request_headers): use soup_message_get_request_encoding. (get_response_headers): use both soup_server_message_get_encoding and soup_message_get_response_encoding, to properly distinguish between the wire encoding and the alleged-by-headers encoding (which differ for HEAD, etc). * libsoup/soup-message-io.c (io_error, read_body_chunk): s/SOUP_TRANSFER_UNKNOWN/SOUP_TRANSFER_EOF/. (io_body_state): if encoding is SOUP_TRANSFER_NONE, jump right to SOUP_MESSAGE_IO_STATE_FINISHING. * libsoup/soup-server.c (request_finished): Check soup_socket_is_connected() *before* soup_message_is_keepalive(), since the message will be invalid if the client unexpectedly dropped the connection. * tests/simple-httpd.c (server_callback): handle HEAD requests. Remove no-longer-necessary soup_server_message_set_encoding() call. * tests/get.c: add -d (debug) flag to print headers, and -h flag to do a HEAD rather than GET
* add a new state "FINISHING" which means "done I/O, but not yet doneDan Winship2006-05-291-24/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | * libsoup/soup-message-io.c (SoupMessageIOState): add a new state "FINISHING" which means "done I/O, but not yet done processing and cleanup" before "DONE" (which now always means "completely done"). (soup_message_io_stop): disconnect the socket if the read state is "< FINISHING", not "!= DONE". (io_error): on an EOF-that-signals-end-of-data, set state to FINISHING and run io_read(). (io_read, io_write): remove the g_return_if_fails from before. s/DONE/FINISHING/ in most places. In the FINISHING handler, stop listening for the readable/writable signal (eg, so we don't end up reading a following pipelined request), and set the state to DONE. (soup_message_io_unpause): Only reconnect the readable/writable signals if the io state isn't DONE. Guard the calls to io_read/io_write better so that it's safe to call this even after they are both DONE, since it may be easier for us to test that than for the caller to. Fixes 334469, 342640, and another bug caused by the earlier workaround to 334469. Based on patches and analysis from William Jon McCann and Armin Bauer. * tests/simple-proxy.c (main): add g_thread_init (NULL) to make this work again. (Pointed out by Alex Larsson)
* tests if IO is currently in progress on a message.Dan Winship2006-05-261-0/+16
| | | | | | | | | | * libsoup/soup-message-io.c (soup_message_io_in_progress): tests if IO is currently in progress on a message. * libsoup/soup-session-async.c (run_queue): don't process messages that are io_in_progress. #342545, fix based on analysis from Wang Xin. (In the future we may want to re-fix this by adding a REQUEUED message status separate from QUEUED.)
* g_return_if_fail if these get called after the IO is done. This isn'tDan Winship2006-04-101-0/+4
| | | | | | | | | | * libsoup/soup-message-io.c (io_write, io_read): g_return_if_fail if these get called after the IO is done. This isn't supposed to happen, but apparently does. Workaround for #334469. * libsoup/soup-auth-digest.c (qop_types, algorithm_types): NULL-terminate these so we don't crash when trying to parse an invalid value. (Flip side of the previous #328615 patch.)
* fix most signed/unsigned mismatch warningsDan Winship2006-04-021-6/+6
| | | | * libsoup/*.c: fix most signed/unsigned mismatch warnings
* add some commentsDan Winship2006-04-021-0/+27
|
* clear priv->io_data right away, to protect against this being re-enteredLIBSOUP_2_2_90_NOT_A_REAL_RELEASEDan Winship2005-11-171-4/+5
| | | | | | | * libsoup/soup-message-io.c (io_cleanup): clear priv->io_data right away, to protect against this being re-entered mid-cleanup (when we unref the connection). #321208, based on a patch from Jedy Wang.
* bump version to 2.2.90. This will not be officially released, but onceDan Winship2005-11-101-1/+5
| | | | | | | | | | | | | | | | | | | | | | | * configure.in: bump version to 2.2.90. This will not be officially released, but once these patches have gotten some testing they may be pulled up to the gnome-2-12 branch. * libsoup/soup-connection.c: * libsoup/soup-server.c: * libsoup/soup-session.c: * libsoup/soup-socket.c: add an "async-context" property, which gets passed from server to socket, and session to connection to socket, allowing async usage outside the main thread. Based on patches from Armin Bauer and Jürg Billeter. * libsoup/soup-misc.c (soup_add_io_watch, soup_add_idle, soup_add_timeout): utility routines to add watches, idles, and timeouts to non-default GMainContexts. * libsoup/soup-message-io.c (io_write): set the read state appropriately after writing a "100 Continue" response (io_read): More 100-Continue stuff. I don't think this is quite right so it will probably change again later.
* bgo #316313 / bnc #116762, and probably also bgo #318252Dan Winship2005-10-271-2/+6
| | | | | | | | | | | | | | * libsoup/soup-message-io.c (soup_message_io_stop): clear io->conn after releasing it, to make sure we can't accidentally release it twice. * libsoup/soup-connection.c (clear_current_request): Call soup_message_io_stop() on the cleared request. * libsoup/soup-connection-ntlm.c (ntlm_authorize_post): do a little dance here to make sure the session can't queue another message on the connection while we're in the process of requeuing the original one.
* Fix a connection leak reported by Tambet.Dan Winship2005-08-161-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | * libsoup/soup-connection.c (send_request): rather than tracking the message progress via signals, call soup_message_send_request_internal() and have it call soup_connection_release() when it's done. (request_restarted, request_done): gone (clear_current_request): handle disconnecting (if necessary) and updating last_used time here. (soup_connection_release): Call clear_current_request(). (dispose): Call clear_current_request() * libsoup/soup-message-client-io.c (soup_message_send_request_internal): New. Takes a SoupConnection in addition to the other args, and passes that on to soup-message-io. * libsoup/soup-message-io.c (SoupMessageIOData): add a SoupConnection field. (io_cleanup): if io->conn is set, unref it. (soup_message_io_stop): if io->conn is set, and we ended in a clean state, call soup_connection_release() on it. (soup_message_io_client): Add a SoupConnection arg, which gets reffed and stored in io->conn. * TODO: misc updates
* require glib-2.0 >= 2.4.0Dan Winship2005-04-111-18/+29
| | | | | | | | | | | | * configure.in: require glib-2.0 >= 2.4.0 * libsoup/*.c: use G_DEFINE_TYPE and g_type_class_add_private/G_TYPE_INSTANCE_GET_PRIVATE * libsoup/soup-types.h: kill SOUP_MAKE_TYPE and SOUP_MAKE_TYPE_WITH_IFACE * tests/revserver.c: use GThread. (patch from tml)
* add SOUP_SSL_ERROR_CERTIFICATE.Dan Winship2004-10-061-2/+13
| | | | | | | | | | | | | | | | | | | | * libsoup/soup-ssl.h (SoupSocketError): add SOUP_SSL_ERROR_CERTIFICATE. * libsoup/soup-gnutls.c (do_handshake): Pass the GError to verify_certificate. (verify_certificate): Set the GError appropriately rather than spewing g_warnings. * libsoup/soup-socket.c (read_from_network, soup_socket_write): If the GIOChannel operation returns an error, store it as GOBject data on the socket (as a hack so soup-message-io.c can access it without us needing to change SoupSocket's API). * libsoup/soup-message-io.c (io_error): peek at the socket's "last_error" datum and set the message's status to SSL_FAILED (with the GError's message string) rather than IO_ERROR, if appropriate. For 64414.
* add/fix lots of gtk-doc commentsDan Winship2004-08-261-0/+43
| | | | | | | | | | | | | | | * libsoup/*: add/fix lots of gtk-doc comments * libsoup/soup-misc.c (soup_str_case_hash, soup_str_case_equal): Fix bug noticed while documenting. (We were using the locale-case-insensitive functions rather than the g_ascii_ ones.) * libsoup/soup-message.h (SoupMessageFlags): remove the (never implemented) NO_PIPELINE and NO_COOKIE flags. * docs/reference/tmpl/*.sgml: Regenerate, fill in some stuff. There are still problems here with gtk-doc not recognizing many of the objects in libsoup...
* Pass gsize *, not guint *, to soup_socket_read/write, to make this work onDan Winship2004-02-201-3/+5
| | | | | | | | | * libsoup/soup-message-io.c (read_metadata, read_body_chunk, write_data): Pass gsize *, not guint *, to soup_socket_read/write, to make this work on 64-bit platforms. (Grr. C type checking sucks.) #54631 * tests/revserver.c: Likewise
* Call soup_message_io_stop so we don't get a callback on the io after it'sDan Winship2004-02-031-1/+2
| | | | | | | | | | * libsoup/soup-message-io.c (io_cleanup): Call soup_message_io_stop so we don't get a callback on the io after it's been cleaned up. * libsoup/soup-session.c (add_auth): Only remove the Authorization header if we have another one to add. (Otherwise it messes up SoupConnectionNTLM.)
* Lots of thread-safety stuff, primarly so you can disconnect a socket fromDan Winship2003-12-221-14/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libsoup/soup-socket.c: Lots of thread-safety stuff, primarly so you can disconnect a socket from one thread while doing I/O in another. * libsoup/soup-message-io.c (soup_message_io_cancel): Split into soup_message_io_stop() and io_cleanup(), to separate out the "stop reading/writing" and "free data" phases to allow thread-safe synchronous cancellation. (soup_message_io_finished): call both soup_message_io_stop() and io_cleanup() (io_error): Only set SOUP_STATUS_IO_ERROR on the message if it doesn't already have a transport error status (eg, CANCELLED). (new_iostate): Call io_cleanup() if needed. * libsoup/soup-status.h: add "SOUP_STATUS_NONE" for 0, to make it clearer that it's not a status. * libsoup/soup-message.c (finalize, restarted, finished, soup_message_set_uri): s/soup_message_io_cancel/soup_message_io_stop/ (soup_message_cleanup_response): s/0/SOUP_STATUS_NONE/ * libsoup/soup-connection.c (send_request): Remove soup_message_io_cancel call. * libsoup/soup-session-sync.c (send_message): Connect to the connection's "disconnected" signal rather than using a weak ref, since that's what we really care about, and it's possible that the connection may have an extra ref on it somewhere that would keep it from being destroyed even if it was disconnected.