summaryrefslogtreecommitdiff
path: root/libsoup/soup-message-io.c
Commit message (Collapse)AuthorAgeFilesLines
* soup-message-io: do an async close when doing non-blocking I/O [WIP]wip/async-closeDan Winship2014-11-021-6/+60
| | | | | | | | | | When using chunked encoding, SoupBodyOutputStream needs to write the final "0" chunk when it's closed, and thus may block. So we have to do an async close in the non-blocking case. (Does not currently pass "make check".) https://bugzilla.gnome.org/show_bug.cgi?id=727138
* soup-message-io: slight tweak to callback/error handlingDan Winship2014-05-021-6/+5
| | | | | | Let the callback know whether I/O completed on the message, and move the server-side "disconnect on I/O error" code from soup-message-io to soup-server.
* Fix SoupClientInputStream close on errorDan Winship2013-11-041-11/+14
| | | | | | | | | | g_input/output_stream_close() always mark their stream closed, even on error, even if their cancellable is pre-cancelled. That means we have to guarantee that soup_message_io_finished() gets called when a SoupClientInputStream is closed, even if an error occurs while closing. https://bugzilla.gnome.org/show_bug.cgi?id=711260
* Fix 'return with no value' warningFabiano Fidêncio2013-10-221-1/+1
|
* soup-message-io: fix early SoupClientInputStream close caseDan Winship2013-10-191-1/+1
| | | | | | | | When closing the stream early, we should be skipping the read state ahead to FINISHING, rather than BODY_DONE, so that got_body doesn't get emitted (thus causing the connection to mark itself reusable). https://bugzilla.gnome.org/show_bug.cgi?id=710494
* Fix soup_client_input_stream_close to not blockDan Winship2013-09-291-0/+10
| | | | | | | | | | Closing a SoupClientInputStream for a message that hadn't been completely read was trying to read to the end of the message first. Fix it to just cancel the read instead. Also fix a few tests that were implicitly assuming the old behavior. https://bugzilla.gnome.org/show_bug.cgi?id=695652
* Fix asynchronicity of soup_session_queue_message() on plain SoupSessionDan Winship2013-09-281-39/+49
| | | | | | | | | Messages sent via soup_session_queue_message() on a plain SoupSession accidentally ended up using blocking I/O. Fix this (and also make switching between sync and async ops during a streaming operation work better). https://bugzilla.gnome.org/show_bug.cgi?id=707711
* soup-session: Fix a crash when destroying a NULL unpause sourcePhilip Withnall2013-07-051-2/+1
| | | | Closes: https://bugzilla.gnome.org/show_bug.cgi?id=703461
* soup-message-io: fix crash when doing unpause+cancelDan Winship2012-12-111-1/+4
| | | | | | | | soup_message_io_stop() was unreffing unpause_source (if it was set), but it didn't actually own a ref on it, so this would crash. Fortunately this would only happen if you unpaused a message and then immediately cancelled it, which isn't very common. Fixes a sporadic chunk-test crash though.
* SoupRequest: Return better GErrors on parsing failuresDan Winship2012-12-101-1/+1
| | | | | In cases where the SoupMessage API would return SOUP_STATUS_MALFORMED, return a clearer GError in the SoupRequest API.
* SoupConnection: track reusability internallyDan Winship2012-11-021-2/+0
| | | | | Rather than relying on soup-message-io to tell us when a connection can be reused, track it directly within SoupConnection.
* Added SoupContentProcessor support to SoupMessage, SoupContentDecoder & ↵Sergio Villar Senin2012-11-021-32/+62
| | | | | | | | | | | | | | | | | SoupContentSniffer soup-message-io uses the content processors registered for each SoupMessage to properly setup the stack of streams used to read a particular resource either downloaded from the network or read from a local cached file. Note that server-side messages do not have content processor support yet. SoupContentDecoder becomes a content processor and wraps the given base stream with a list of decoders when required. SoupContentSniffer becomes a content processor working at the SOUP_STAGE_BODY_DATA stage. https://bugzilla.gnome.org/show_bug.cgi?id=682112
* SoupBodyInputStream: make it seekableSergio Villar Senin2012-09-101-1/+1
| | | | | | | | SoupBodyInputStream implements now the GSeekable interface. It does not longer require a SoupFilterInputStream as base stream unless the encoding is SOUP_ENCODING_CHUNKED. https://bugzilla.gnome.org/show_bug.cgi?id=665884
* valgrindageDan Winship2012-08-111-2/+6
|
* soup-message-io: make disconnect-on-unfinished more implicitDan Winship2012-07-161-4/+4
| | | | | | | | Rather than disconnecting the connection from soup_message_io_stop() if the message didn't complete, do it from SoupConnection:clear_current_item(). This makes it DTRT even if the SoupMessageQueueItem loses its connection before soup_message_io_stop() gets called.
* Fix the retry-on-broken-connection codepath for SoupRequestDan Winship2012-07-131-35/+39
| | | | | | | | | The retry-if-the-server-closes-the-connection-immediately code was only getting run in the SoupMessage API codepaths. Fit it into the right place in the SoupRequest paths too, and test that from connection-test. Might fix https://bugzilla.gnome.org/show_bug.cgi?id=679527 ?
* Clean up includesDan Winship2012-07-131-5/+1
| | | | | | | | Especially, include soup.h rather than individually including a bunch of other public soup-*.h files. Remove unnecessary system includes (many are leftovers from code that has moved down into glib).
* soup-message-io: keep cancellable alive for duration of io_run_untilDan Winship2012-05-151-1/+5
| | | | | | | | | | | | | | io_run() passes io->cancellable to io_run_until(), but io may be destroyed (and cancellable unreffed) before io_run_until() returns, causing it to eventually call g_cancellable_is_cancelled() on garbage. Fix by reffing it around the io_run_until() call (though really this is just another example of "SoupMessageIOData needs to be refcounted".) Tweak misc-test to test this case. Fixes crasher in rygel test case. Based on a patch from Ray Strode. https://bugzilla.gnome.org/show_bug.cgi?id=676038
* soup-message-io: fix reference leakRay Strode2012-05-141-0/+1
| | | | | | | | | io_run_until forgets to release a reference it takes in a cancellation error path. This commit fixes that. https://bugzilla.gnome.org/show_bug.cgi?id=676038
* Add a (temporary?) fix for async authentication via SoupRequestDan Winship2012-05-081-11/+47
| | | | | | | | In order to do async authentication, we need to stop the processing of the request during the soup_request_send_async() call. So re-enable soup_session_pause_message() for that case. Possibly to be revisited. https://bugzilla.gnome.org/show_bug.cgi?id=675306
* Fix indentation on some code copied from glibDan Winship2012-05-081-24/+23
|
* Fix a few recent request API bugs, add some more testsDan Winship2012-05-031-2/+6
|
* Fix warnings/failures with messages that are cancelled from got-headersDan Winship2012-05-021-5/+19
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=674747
* Move SoupSocket stuff out of soup-message-io.cDan Winship2012-04-281-40/+25
| | | | | | Add a new SoupIOStream, which wraps the SoupFilterInputStream and GOutputStream that SoupSocket exposes. Pass that to soup-message-io rather than the SoupSocket, and update various other things for this.
* Make the new SoupSocket APIs privateDan Winship2012-04-201-0/+1
|
* SoupHTTPRequest: O brave new world!Dan Winship2012-04-171-62/+248
| | | | | | | | | | Kill SoupHTTPInputStream, and have SoupHTTPRequest return the message's body_istream directly (with a little help from SoupSession and its subclasses). SoupHTTPRequest works synchronously now as well (though it's still the case that async only works with SoupSessionAsync and sync only works with SoupSessionSync). https://bugzilla.gnome.org/show_bug.cgi?id=591739
* soup-message-io: move content sniffing out into a wrapper streamDan Winship2012-04-171-81/+27
| | | | | Add a wrapper input stream that handles content sniffing, and use that from soup-message-io.
* soup-message-io: Use GConverterInputStream for content-decodingDan Winship2012-04-171-111/+20
| | | | | | | | | | | | | | | | Decode Content-Encodings by wrapping a GConverterInputStream around the SoupBodyInputStream. Because we want to be able to fall back to passing data through undecoded in the case that decoding fails, we need to use a GConverter wrapper (SoupConverterWrapper) that implements that. The old soup-message-io code was automatically stopping decompression when it reached the end of the response body, without checking that the compressed data was actually whole at that point. Fix that. However, this breaks the previous hack used for the zlib-to-raw fallback, since the raw data won't have a checksum at the end. So do that differently now.
* soup-message-io: use gio streams rather than SoupSocketDan Winship2012-04-171-553/+367
| | | | | | | | | | | Use the socket's input/output streams for the base I/O, and add new SoupBodyInputStream and SoupBodyOutputStream that can be created from them to handle the body of a single message (including handling chunked encoding/decoding). Update chunk-test, which was assuming that the chunk_allocator callback would never be called if the message had a 0-length body; that's no longer true.
* soup-message-io: prevent a possible out-of-bounds memory accessDan Winship2012-02-221-2/+2
|
* soup-message-io: make soup_message_io_unpause() obey use-thread-contextDan Winship2012-01-171-2/+10
|
* SoupContentDecoder: add support for deflate Content-EncodingSergio Villar Senin2011-11-141-0/+34
| | | | | | | Claim that we support both gzip and deflate content encodings. Added support to handle data compressed with deflate with and without zlib headers. https://bugzilla.gnome.org/show_bug.cgi?id=661682
* Fix SoupMessage https status information to be set more reliablyDan Winship2011-10-201-21/+0
| | | | | | | | In particular, make sure it gets set when a connection fails, so that soup_message_get_https_status() on the message will tell you *why* it failed. Also, update tests/get to display the tls-certificate-errors
* Use GTlsDatabase, add new SoupSession properties for itDan Winship2011-09-291-1/+0
| | | | | | | | | | Now that we have GTlsFileDatabase, we can use that to validate certificates when the caller sets SoupSession:ssl-ca-file, rather than doing it the slow hacky way we had been. Also, add two new properties, SoupSession:tlsdb, to set an arbitrary GTlsDatabase on the session, and SoupSession:use-system-ca-file, to tell it to use the default GTlsDatabase.
* SoupSession: set the connection to IDLE on unqueuing SoupMessagesSergio Villar Senin2011-09-291-2/+0
| | | | | | | | | Connection should be set to IDLE state only after being 100% sure that is not going to be reused by the current owner. Also, fix a bug in SoupSessionSync revealed by this change. https://bugzilla.gnome.org/show_bug.cgi?id=651146
* soup-message-io: fix setting of SoupMessage TLS propertiesDan Winship2011-09-191-24/+19
| | | | | | | | | Now that the TLS handshake occurs during connection, the socket properties are set before we get to soup-message-io (and never change), so copy them to the message right away rather than waiting for a property notification. https://bugzilla.gnome.org/show_bug.cgi?id=611496
* Add SOUP_MESSAGE_CAN_REBUILD, for regeneratable streamed request bodiesDan Winship2011-08-161-2/+4
| | | | | | | | | | | | | | Long ago, soup_message_body_set_accumulate() was made into a no-op on request bodies, because otherwise there would be no body available to send if the request was restarted. Add a SOUP_MESSAGE_CAN_REBUILD flag, that indicates that the caller takes responsibility for handling this, and properly discard chunks if that is set. Also update chunk-test to test this, and (finally!) remove the FIXME there, since we are now testing the !accumulate codepath again properly. https://bugzilla.gnome.org/show_bug.cgi?id=656650
* Revert "soup-message-io: clear connection from queue items when IDLE status ↵Dan Winship2011-07-041-4/+1
| | | | | | | | is set" This broke tests/proxy-test. This reverts commit c56c66aa2625bc95f54f8a1972e13503f454a51a.
* soup-message-io.c: Fix integer overflow on 32bitJens Georg2011-06-291-1/+1
| | | | | | Fixes a bug serving large files, eg, in Rygel. https://bugzilla.gnome.org/show_bug.cgi?id=638468
* soup-message-io: clear connection from queue items when IDLE status is setSergio Villar Senin2011-06-081-1/+4
| | | | | | | | Do not reuse the SoupConnection we used for the first time when a SoupMessage gets redirected as it could have been assigned to a different SoupMessage meanwhile. https://bugzilla.gnome.org/show_bug.cgi?id=651146
* soup_session_cancel_message: fix up, especially in sync sessionsDan Winship2011-01-101-3/+6
| | | | | | | | | | | | | Cancelling a message from another thread had some race conditions that could sometimes cause crashes. Fix things up a bit by using GCancellable to interrupt the I/O, rather than calling soup_message_io_finished() directly. Also added a test for this case to tests/misc-test, although unfortunately due to the raciness of the bug, it only failed sporadically even before the fix (but seems to fail never now). https://bugzilla.gnome.org/show_bug.cgi?id=637741
* soup-message-io: don't watch for SoupSocket::disconnectDan Winship2011-01-101-23/+1
| | | | | | | | | The IO code was explicitly handling the SoupSocket::disconnect signal, but this is actually redundant; if the socket gets disconnected we'll get either an error (if writing) or an eof (if reading), and the code will do the right thing with that. Watching ::disconnected too just results in processing the same error twice and having to be extra careful to do it idempotently.
* Remove SoupCoding, SoupCodingGZip, use GZlibDecompressorDan Winship2010-12-101-5/+49
| | | | | also add a new test to coding-test for handling content that doesn't decode correctly
* Set SoupMessage:tls-certificate from SoupSocket:tls-certificate soonerDan Winship2010-12-071-19/+27
| | | | | Use the new GTlsConnection:peer-certificate semantics to guarantee we set the certificate on the message as soon as it's been accepted.
* Add SoupMessage:tls-certificate and SoupMessage:tls-errorsDan Winship2010-12-071-11/+18
| | | | | These provide more information about the certificate on the other end of a TLS connection.
* SoupSocket: port to GSocketConnection/GTlsConnectionDan Winship2010-12-071-1/+1
| | | | and remove libsoup's built-in TLS support, which is no longer needed
* soup-message-io: fix retry-after-unexpected-connection-closeDan Winship2010-11-101-1/+1
| | | | | | | | | | | | | | | When sending a request on a previously-used connection, we have to deal with the possibility of the server deciding to time out the connection right as we start sending data (which sounds like a crazy race condition, but is in fact pretty much standard behavior). This got broken in the connection/session reorg earlier in the year. Fix it. Also, add a test to misc-test for this. Based on patch from Sergio Villar. https://bugzilla.gnome.org/show_bug.cgi?id=631525
* soup-message-io: deal with stupid servers that do chunked encoding wrongDan Winship2010-11-091-1/+19
| | | | | | | Some servers fail to send the final 0-length chunk when allegedly doing chunked encoding. Browsers cope. Now we do too. https://bugzilla.gnome.org/show_bug.cgi?id=629160
* soup-message-io: fix wrong-Content-Length logicDan Winship2010-07-311-3/+18
| | | | | | | | | | | | Previously we just ignored Content-Length if the server specified "Connection: close", which does the right thing if the specified Content-Length is too large, but fails if the Content-Length is correct but the server "forgets" to close the connection. Fix this so that we always stop reading once we get to the expected Content-Length, but we also cope with the connection closing before that point. https://bugzilla.gnome.org/show_bug.cgi?id=611481
* SoupSession: tweak cancellation againDan Winship2010-06-091-1/+1
| | | | | | | After the too-many-redirects merge, redirect-test was leaking a queue item, because cancelling a message at the point it does resulted in the completion_cb never running. Fix soup_session_cancel_message() (again) to not have this problem.