summaryrefslogtreecommitdiff
path: root/libsoup/soup-message-client-io.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove SoupSessionAsyncPatrick Griffis2020-09-191-1/+1
|
* Delete SoupSessionSyncPatrick Griffis2020-09-191-6/+4
|
* Make more APIs privatePatrick Griffis2020-09-191-0/+1
|
* SoupMessage: seal access to private membersClaudio Saavedra2019-07-101-8/+3
| | | | | | Remove the GET_PRIVATE macro and add private getters and setters for all private members that are accessed internally. This cleans all deprecation warnings generated from using the GET_PRIVATE macro.
* Add soup-socket-private.hDan Winship2014-05-021-1/+1
| | | | | SoupSocket-related stuff made up more than half of soup-misc-private.h. Split it out into its own header.
* Fix asynchronicity of soup_session_queue_message() on plain SoupSessionDan Winship2013-09-281-1/+1
| | | | | | | | | 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
* More IPv6 scope ID fixesDan Winship2013-08-191-1/+1
| | | | | | | Don't include the scope ID in the "Host" header. Make SoupURI correctly parse both correct and incorrect scope IDs, and add checks for that in tests/uri-parsing.
* Rename all remaining "SoupMessage *req"s to "msg"Dan Winship2012-12-171-30/+30
| | | | | | | | | | | | Originally (ie, 12 years ago last week) the HTTP message type in soup was called SoupRequest, and most SoupRequest variables were called "req". Shortly after, SoupRequest was renamed to SoupMessage, but none of the existing "req"s were renamed, and in fact, new ones kept getting added. Eventually, "msg" became the standard name for a SoupMessage variable, but a handful of "req"s have managed to survive to this day. With the increasing integration of the modern-day SoupRequest, this has gone from "inconsistent" to "confusing", so fix all the remaining stray "SoupMessage *req"s.
* SoupRequest: Return better GErrors on parsing failuresDan Winship2012-12-101-3/+14
| | | | | In cases where the SoupMessage API would return SOUP_STATUS_MALFORMED, return a clearer GError in the SoupRequest API.
* soup-message-client-io: add a Host header to HTTP/1.0 messages tooDan Winship2012-11-171-14/+11
| | | | per recommendation of the httpbis spec
* SoupSession: clean up message response when queueingDan Winship2012-08-251-1/+0
| | | | | | | To handle messages that get reused, we were calling soup_message_cleanup_response() from soup_message_send_request(). But it's better to do it sooner than that, like in soup_session_append_queue_item().
* Clean up includesDan Winship2012-07-131-6/+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).
* Move SoupSocket stuff out of soup-message-io.cDan Winship2012-04-281-1/+14
| | | | | | 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.
* soup-message-client-io: ASCIIfy unicode hostnames for Host headerDan Winship2011-02-151-0/+2
| | | | | | | | We were resolving unicode hostnames correctly, but then putting them in the Host header as UTF-8 rather than using the ASCII-encoded version. Fix that. https://bugzilla.gnome.org/show_bug.cgi?id=642075
* soup-message-io: fix wrong-Content-Length logicDan Winship2010-07-311-12/+0
| | | | | | | | | | | | 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
* soup-message-io: use SoupMessageQueueItems and add SoupMessageCompletionFnDan Winship2010-06-091-7/+11
| | | | | | 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-6/+9
| | | | | | | | | 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().
* Don't send URI fragment when requesting via proxyDan Winship2009-12-181-0/+7
| | | | and add a test for it
* Mirror Mozilla behavior for when to follow Content-LengthBenjamin Otte2009-08-041-0/+12
| | | | | | | | | Mozilla only honors content length on messages that use keep-alive to work around servers that send broken Content-Length headers. This patch mirrors that behavior. An example for such a page is http://sourceforge.net/apps/wordpress/sourceforge
* Add "Content-Length: 0" to requests with a Content-Type but no bodyDan Winship2009-06-061-1/+2
| | | | | | Some servers get annoyed if a POST/PUT declares a Content-Type but contains no body, so make sure to send a 0-length body (which is different) instead.
* Bug 576760 – soup_message_headers_get_content_type returns bad headersDan Winship2009-04-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | * libsoup/soup-message-headers.c (soup_message_headers_get_one) (soup_message_headers_get_list): New replacements for soup_message_headers_get(), indicating explicitly whether the caller expects the header to be a list or not; for non-list-type headers, if there's more than one, the second one should be ignored rather than concatenated to the first. (soup_message_headers_get): deprecate this. * libsoup/*.c: * tests/*.c: Update to use soup_message_headers_get_one() or _get_list() as appropriate. * tests/header-parsing.c (do_content_type_tests): Add some tests of Content-Type parsing/setting, including making sure that duplicate Content-Type headers are ignored. * docs/reference/libsoup-2.4-sections.txt: update svn path=/trunk/; revision=1258
* Bug 572153 – SoupServer doesn't support SOUP_ENCODING_EOFDan Winship2009-02-191-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* don't add a Host header to the message if the caller already added one.Dan Winship2008-07-261-6/+8
| | | | | | | | | | | | | | * libsoup/soup-message-client-io.c (get_request_headers): don't add a Host header to the message if the caller already added one. #539803, Marc Maurer. * libsoup/soup-logger.c (print_request): likewise * tests/misc-test.c: new test file for small miscellaneous test cases. (do_host_test): test Host-header overriding svn path=/trunk/; revision=1146
* add a new signal "wrote-body-data" to address the problem thatDan Winship2008-04-041-1/+2
| | | | | | | | | | | | | | | | | | | | | | * 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
* de-constify msg->reason_phrase; it's no more const than any other structDan Winship2008-03-291-2/+2
| | | | | | | | | | | | | | | | * libsoup/soup-message.h (SoupMessage): de-constify msg->reason_phrase; it's no more const than any other struct field. * libsoup/soup-message.c (finalize) (soup_message_cleanup_response, soup_message_set_status) (soup_message_set_status_full): don't need to cast reason_phase to non-const when freeing it now * libsoup/soup-message-client-io.c (parse_response_headers): Likewise, remove reason-phrase non-const casts svn path=/trunk/; revision=1118
* Fix Host header syntax when the host is an IPv6 address literal. NoticedDan Winship2008-03-141-3/+11
| | | | | | | | * libsoup/soup-message-client-io.c (get_request_headers): Fix Host header syntax when the host is an IPv6 address literal. Noticed while poking at #522519. svn path=/trunk/; revision=1109
* Add an iterator type for SoupMessageHeaders.Dan Winship2008-02-091-8/+5
| | | | | | | | | | | | | | | | | | | | | | | * libsoup/soup-message-headers.c (SoupMessageHeadersIter) (soup_message_headers_iter_init, soup_message_headers_iter_next): Add an iterator type for SoupMessageHeaders. * libsoup/soup-message-client-io.c (get_request_headers): * libsoup/soup-message-server-io.c (get_response_headers): Use SoupMessageHeadersIter. * libsoup/soup-logger.c (print_request, print_response): Use SoupMessageHeadersIter. And take advantage of the simplification to fix the kludge where 'direction' was stored as a field in SoupLoggerPrivate rather than being an argument to soup_logger_print. * tests/get.c (get_url): * tests/header-parsing.c (check_headers): * tests/simple-httpd.c (server_callback): Use SoupMessageHeadersIter svn path=/trunk/; revision=1079
* Merge libsoup-2.4 branch to trunkDan Winship2008-01-151-54/+31
| | | | | | * Merge libsoup-2.4 branch to trunk svn path=/trunk/; revision=1041
* Patch from Andrew W. Nosenko:Dan Winship2006-11-201-0/+2
| | | | | | | | | | | | | | | | | * libsoup/soup-message-client-io.c (parse_response_headers): Avoid memory leak when parse_response_headers() is called on a message that has a 'reason_phrase' already for some reason. * libsoup/soup-gnutls.c (soup_gnutls_free): Avoid memory leak: hostname was not freed. (soup_ssl_wrap_iochannel): Avoid memory leak: SoupGNUTLSChannel 'chan' was not freed in case of initialization error. Avoid double close of the "real" (plain, non-ssl) channel FD. * libsoup/soup-socket.c (soup_socket_start_proxy_ssl): Avoid memory leak: the "real" (plain, non-ssl) GIOChannel was never "finally" unreffed (one more *_ref() than *_unref()) in case of ssl-wrapping.
* initialize encoding to SOUP_TRANSFER_CONTENT_LENGTH rather thanDan Winship2006-07-211-48/+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
* replace locale-ish strcasecmps with g_ascii_strcasecmpDan Winship2006-04-021-1/+1
| | | | | | | | | | | | * libsoup/soup-auth-digest.c: * libsoup/soup-auth.c: * libsoup/soup-message-client-io.c: * libsoup/soup-message-server-io.c: * libsoup/soup-message.c: * libsoup/soup-method.c: * libsoup/soup-server-auth.c: * tests/get.c: replace locale-ish strcasecmps with g_ascii_strcasecmp
* Fix a connection leak reported by Tambet.Dan Winship2005-08-161-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-4/+6
| | | | | | | | | | | | * 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/fix lots of gtk-doc commentsDan Winship2004-08-261-0/+11
| | | | | | | | | | | | | | | * 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...
* if we receive an HTTP/1.0 response to an HTTP/1.1 request, downgrade theDan Winship2003-12-101-0/+3
| | | | | | | | | | | | | | | | | | | * libsoup/soup-message-client-io.c (parse_response_headers): if we receive an HTTP/1.0 response to an HTTP/1.1 request, downgrade the message's http_version so the keep-alive handling is correct. Fixes a problem noticed almost simultaneously by Rodrigo and Joe. * libsoup/soup-message.c (soup_message_restarted, etc): Add a "restarted" signal as suggested by Joe. * libsoup/soup-message-io.c (soup_message_io_finished): emit either "restarted" or "finished" as appropriate * libsoup/soup-session.c (soup_session_queue_message): Connect to "restarted" and run the queue if a message gets restarted * libsoup/soup-status.h: Remove a stray comma that gtk-doc doesn't like.
* Move RESPONSE_BLOCK_SIZE #define here from soup-private.hDan Winship2003-09-221-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libsoup/soup-message-io.c: Move RESPONSE_BLOCK_SIZE #define here from soup-private.h * libsoup/soup-misc.c (soup_load_config, etc): Remove all this. (soup_set_security_policy, soup_get_security_policy): Remove, since the GNUTLS backend doesn't actually implement it. (soup_set_ssl_ca_dir, soup_get_ssl_ca_dir): Likewise * libsoup/soup-misc.h: sync to soup-misc.c. Don't #include extra stuff. * libsoup/soup-types.h (SOUP_MAKE_TYPE): Move this here from soup-private.h * libsoup/soup-ssl.h: Merge soup_ssl_get_iochannel and soup_ssl_get_server_iochannel into a single function that takes a SoupSSLType. * libsoup/soup-gnutls.c: Remove soup_get_ssl_ca_dir() reference. (soup_ssl_get_iochannel): Renamed from soup_gnutls_get_iochannel. (soup_gnutls_set_security_policy): Gone * libsoup/soup-gnutls.h * libsoup/soup-ssl.c: Gone; soup-ssl.h is the #include file for soup-gnutls.c now * libsoup/soup-socket.c: Move soup_sockaddr_max #define here from soup-private.h (soup_socket_start_ssl): Update for new soup_ssl_get_iochannel prototype. * libsoup/soup-private.h: Gone * libsoup/soup-address.c: Fix #includes for soup-private.h and soup-misc.h changes * libsoup/soup-auth-digest.c: Likewise * libsoup/soup-auth.c: Likewise * libsoup/soup-connection-ntlm.c: Likewise * libsoup/soup-connection.c: Likewise * libsoup/soup-dns.c: Likewise * libsoup/soup-gnutls.c: Likewise * libsoup/soup-headers.c: Likewise * libsoup/soup-message-client-io.c: Likewise * libsoup/soup-message-handlers.c: Likewise * libsoup/soup-message-io.c: Likewise * libsoup/soup-message-server-io.c: Likewise * libsoup/soup-message.c: Likewise * libsoup/soup-server-message.c: Likewise * libsoup/soup-server.c: Likewise * libsoup/soup-session.c: Likewise * libsoup/soup-socket.c: Likewise * tests/auth-test.c: Likewise
* free the hostent.Dan Winship2003-09-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libsoup/soup-address.c (update_address_from_entry): free the hostent. * libsoup/soup-connection-ntlm.c (ntlm_authorize_pre): Don't leak the domain * libsoup/soup-gnutls.c (soup_gnutls_get_iochannel): Add some more iochannel initialization. Not sure how this worked before... * libsoup/soup-message.c (soup_message_cleanup_response): Renamed from soup_message_prepare (and a few things removed). * libsoup/soup-message-client-io.c (soup_message_send_request): s/soup_message_prepare/soup_message_cleanup_response/ * libsoup/soup-message-io.c (io_read): Replace the final "\r\n" with "\0" on the headers before passing them to the parse function. (io_read): Call soup_message_cleanup_response after returning an informational response so the data doesn't leak. * libsoup/soup-headers.c (soup_headers_parse): Update for soup-message-io.c:io_read change * libsoup/soup-server.c (soup_server_new, soup_server_new_with_host): Don't leak the SoupAddress. * libsoup/soup-session.c (class_init): Make PROP_PROXY_URI not CONSTRUCT_ONLY. (set_property): If the proxy uri changes, call soup_session_abort() and cleanup_hosts(). (request_finished, final_finished): Fix a bug when requeuing messages. * tests/libsoup.supp: valgrind suppression file for soup tests * tests/Makefile.am (EXTRA_DIST): dist it. (noinst_PROGRAMS): move the former check_PROGRAMS to noinst_PROGRAMS instead.
* Add wrote_informational and got_informational signals.Dan Winship2003-09-181-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | * libsoup/soup-message.c: Add wrote_informational and got_informational signals. * libsoup/soup-message-client-io.c (get_request_headers): Set the EXPECT_CONTINUE flag on the message if that header is set. * libsoup/soup-message-server-io.c (parse_request_headers): Likewise * libsoup/soup-message-io.c (io_write): Set read_state to HEADERS when blocking on an expect-continue. Emit wrote_informational instead of wrote_headers in the 1xx case. (io_read): Set read_state to BLOCKING, not NOT_STARTED after reading a 100 Continue response. Emit got_informational instead of got_headers in the 1xx case. * libsoup/soup-session.c (soup_session_send_message): Reorder things to deal with the fact that the message could finish right away if there is a connection available and the server is very close. * libsoup/soup-status.h: Rename SOUP_STATUS_CLASS_TRANSPORT to SOUP_STATUS_CLASS_TRANSPORT_ERROR.
* Replaces the three previous soup_connection_new* functions and usesDan Winship2003-09-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libsoup/soup-connection.c (soup_connection_new): Replaces the three previous soup_connection_new* functions and uses gobject properties to set the destination and proxy uris. (class_init): set up two more signals, authenticate and reauthenticate. (soup_connection_send_request): virtualize (send_request): Default implementation * libsoup/soup-connection-ntlm.c: New SoupConnection subclass that also handles NTLM authentication. Includes all of the NTLM code formerly in soup-auth-ntlm.c. * libsoup/soup-auth-ntlm.[ch]: Gone. * libsoup/soup-auth.c: Remove NTLM refs * libsoup/soup-session.c (class_init): Add gobject properties for proxy, max_conns, use_ntlm. Change the "authenticate" and "reauthenticate" signal prototypes to not pass a SoupAuth (so they can be used for authenticating SoupConnectionNTLM as well, which doesn't use a SoupAuth). (soup_session_new): Renamed from soup_session_new_default. (soup_session_new_with_options): Replaces soup_session_new_with_proxy and soup_session_new_full. Takes gobject properties. (run_queue): Create a new connection of type SoupConnection or SoupConnectionNTLM depending on our "use_ntlm" property. Connect to its authenticate and reauthenticate signals. (connection_authenticate, connection_reauthenticate): proxy these signals. * libsoup/soup-address.c (update_address_from_entry): Fix a crasher when failing to resolve the address. * libsoup/soup-dns.c (check_hostent): Fix some "how was this working before" bugs. * libsoup/soup-message-client-io.c (soup_message_send_request): call soup_message_prepare() to clean up the existing response state. * libsoup/soup-message-io.c (io_error): Set the read_state to DONE when processing an OK EOF. * libsoup/soup-status.h (SoupStatusClass): fix the numbering of these so that SOUP_STATUS_CLASS_SUCCESS is 2, etc. * tests/auth-test.c (authenticate, reauthenticate): Update for new prototypes. (main): Use soup_session_new. * tests/get.c (main): Likewise. * tests/simple-proxy.c (main): Likewise.
* Move a bunch of logic here from soup-context. Now the session keeps trackDan Winship2003-09-051-32/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libsoup/soup-session.c: Move a bunch of logic here from soup-context. Now the session keeps track of hosts (instead of having a global soup_hosts hash) and their connections. (soup_session_new_with_proxy, soup_session_new_full): New session constructors to specify a proxy or a proxy and connection limits (send_request): Add Authorization and Proxy-Authorization headers before sending off the request. (soup_session_queue_message, et al): Improve the way this works. There's no need to use timeouts to wait for connections to become free; we *know* when they become free. * libsoup/soup-private.h: Remove SoupHost and some other no-longer-used stuff. * libsoup/soup-misc.c (soup_set_proxy, soup_get_proxy, soup_set_connection_limit, soup_set_connection_limit): Gone. These are all per-session now. * libsoup/soup-message.c: Remove all SoupContext references (mostly replaced with SoupUri references) (cleanup_message): priv->connect_tag and priv->connection are gone now, so this was just soup_message_io_cancel(). So remove cleanup_message and replace it with that everywhere. (soup_message_disconnect): Gone. (soup_message_set_uri): Replaces soup_message_set_context. (soup_message_set_connection, soup_message_get_connection): Gone * libsoup/soup-message-server-io.c (parse_request_headers): s/soup_message_set_context/soup_message_set_uri/ * libsoup/soup-message-private.h (SoupMessagePrivate): Remove connect_tag, context, and connection. * libsoup/soup-message-client-io.c (encode_http_auth): Gone. * libsoup/soup-context.c: Gone * tests/auth-test.c (identify_auth): update for session/context changes
* Renamed from soup-error.h, with types and defines renamed accordingly.Dan Winship2003-09-031-15/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | * libsoup/soup-status.h: Renamed from soup-error.h, with types and defines renamed accordingly. * libsoup/soup-message.h (SoupMessage): Rename errorcode to status_code and errorphrase to reason_phrase. Remove errorclass. (SOUP_MESSAGE_IS_ERROR): Remove this. You can't classify redirects as being either "errors" or "not errors", so its semantics are guaranteed to be wrong sometimes. * libsoup/soup-message.c (soup_message_set_status, soup_message_set_status_full): Renamed * libsoup/soup-message-handlers.c (soup_message_add_status_code_handler, soup_message_add_status_class_handler): Rename. * libsoup/soup-session.c (soup_session_send_message): Make this return a status code rather than a status class. * libsoup/soup-message-private.h (SoupMessagePrivate): Remove some unrelated unused fields (retries, callback, user_data). * ...: Updates
* Major rewrite. There is now only a single IO state object (instead of oneDan Winship2003-08-291-29/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libsoup/soup-message-io.c: Major rewrite. There is now only a single IO state object (instead of one for reading and one for writing), and the IO code handles switching back and forth between reading and writing as appropriate (including handling the extra switches needed for "Expect: 100-continue"). (soup_message_io_client, soup_message_io_server): The new entry points. (soup_message_io_cancel): If the caller cancels the IO when we were expecting to read more data, disconnect the socket. * libsoup/soup-message.h (SoupMessageFlags): add SOUP_MESSAGE_EXPECT_CONTINUE, to indicate that the IO code should do the special expect-continue handling. * libsoup/soup-message.c: Move all the signal stuff here. Remove the "done_reading" and "done_writing" signals and replace them with a single "finished" signal. (A single signal. Say that 10 times fast!) (soup_message_got_headers, etc): Functions to emit signals. (got_headers, got_chunk, got_body): Default signal methods that call soup_message_run_handlers. (finished): Default signal method that replaces soup_message_issue_callback. ([various]): s/soup_message_issue_callback/soup_message_finished/ (soup_message_requeue): There's no soup_message_set_read_callbacks any more, so if the caller requeues while it's still reading, just cancel the read. (soup_message_add_chunk, soup_message_add_final_chunk, soup_message_pop_chunk): Moved here from soup-server-message, although we don't actually quite support using chunked encoding for requests yet. * libsoup/soup-server-message.c (soup_server_message_new): No longer takes a socket argument. (soup_server_message_add_chunk, soup_server_message_get_chunk): Moved into SoupMessage. * libsoup/soup-message-handlers.c (global_handlers): Make these POST_BODY rather than PRE_BODY, so they won't mess up the IO channel when the requeue the message. (soup_message_run_handlers): Don't need to issue the message callback from here any more. (authorize_handler): Just leave the error as 401 or 407 (see soup-error.h change) * libsoup/soup-message-client-io.c (soup_message_send_request): Replaces soup_message_write_request and soup_message_read_response. * libsoup/soup-message-server-io.c: Parallel to soup-message-client-io.c, this defines the server-side header handling. (soup_message_read_request): Its entry point. * libsoup/soup-server.c: Lots of code moved into soup-message-server-io.c. Update for other changes. * libsoup/soup-queue.c: Update for changes * libsoup/soup-socket.c (read_from_network, soup_socket_write): Don't call soup_socket_disconnect() on an error, just return SOUP_SOCKET_ERROR. Otherwise soup_socket_disconnect() could emit signals that will mess up the caller of the read/write function. * libsoup/soup-connection.c (soup_connection_disconnect): When disconnecting the socket, disconnect from its signals first to prevent bad reentrancy. * libsoup/soup-error.h: Kill off SOUP_ERROR_CANT_AUTHENTICATE and SOUP_ERROR_CANT_AUTHENTICATE_PROXY, since they don't really say anything that SOUP_ERROR_UNATHORIZED and SOUP_ERROR_PROXY_UNAUTHORIZED don't say. (And now, all of the "transport" errors actually are transport-related.) * tests/auth-test.c (main): s/CANT_AUTHENTICATE/UNAUTHORIZED/ * tests/simple-proxy.c: Complicate this a bunch. In particular, use SOUP_MESSAGE_OVERWRITE_CHUNKS and the GOT_CHUNK signal, and pass the data back to the client in chunked format.
* Higher-than-soup-message-io-level functions to do client-side IO. (CodeDan Winship2003-08-261-0/+208
* libsoup/soup-message-client-io.c (soup_message_write_request, soup_message_read_response): Higher-than-soup-message-io-level functions to do client-side IO. (Code that used to be in soup-queue.c) (get_request_header_cb): Fix a bug in the generation of the Host: header; need to include the port number if it's not the default. * libsoup/soup-message-io.c (soup_message_write, soup_message_write_simple): Take separate user_datas for the get_* callbacks and the done callbacks. * libsoup/soup-queue.c: Update to use soup_message_write_request and soup_message_read_response. * libsoup/soup-connection.c (soup_connection_new): Change the prototype to take a SoupUri and a callback. * libsoup/soup-context.c (try_create_connection, soup_context_connect_cb): Update for soup_connection_new change. * libsoup/soup-server.c (read_done_cb, issue_bad_request): Update for soup_message_write changes * libsoup/soup-uri.c (soup_uri_uses_default_port): new utility function