summaryrefslogtreecommitdiff
path: root/libsoup/soup-connection.h
Commit message (Collapse)AuthorAgeFilesLines
* Re-redo not-yet-used connection handlingDan Winship2009-08-221-1/+0
| | | | | | | | | | | | Previously we were taking special care to avoid closing connections that hadn't been used yet, but this is not actually necessary; run_queue() doesn't prune idle connections until after running through the entire queue once, so if the new connection is still idle at that point, it means we no longer have a message to send on it (probably because the message already got sent on another connection), and so it is legitimate to close it if needed. http://bugzilla.gnome.org/show_bug.cgi?id=592084
* Tweak SoupConnection handling a bit wrt "not yet used" connections.Dan Winship2009-08-181-1/+1
| | | | Should help to avoid the "undead" connections described in bug 592084.
* Notice closed connections soonerDan Winship2009-08-171-0/+1
| | | | | | Only works on UNIX; Windows has to wait for the GSocket port. http://bugzilla.gnome.org/show_bug.cgi?id=578990
* Implement SoupProxyURIResolver, to replace SoupProxyResolverDan Winship2009-06-061-1/+2
| | | | | | | Simplifies implementations, allows for non-http proxy resolution, and allows authentication information to be passed. http://bugzilla.gnome.org/show_bug.cgi?id=580051
* SoupConnection/SoupSession reorg and cleanupDan Winship2009-06-061-12/+16
| | | | | | | 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.
* Change the SoupURI properties to SoupAddress properties.Dan Winship2008-10-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libsoup/soup-connection.c: Change the SoupURI properties to SoupAddress properties. * libsoup/soup-address.c (soup_address_resolve_async) (soup_address_resolve_sync): Redo slightly so that multiple simultaneous attempts to resolve the same address won't cause problems. (soup_address_hash_by_name, soup_address_equal_by_name): (soup_address_hash_by_ip, soup_address_equal_by_ip): methods to hash addresses by name or IP address * libsoup/soup-message.c (soup_message_get_address): gets a SoupAddress corresponding to the message's URI * libsoup/soup-auth-manager.c (SoupAuthHost): hash hosts by soup_address_hash_by_name() rather than by URI. * libsoup/soup-session.c (soup_session_get_connection): pass addresses to soup_connection_new(), not URIs. (SoupSessionHost): hash hosts by soup_address_hash_by_ip() rather than by URI. This requires that the addresses will have already been resolved by the SoupSession subclasses before calling soup_session_get_connection(), but also means that now requests made to different virtual hosts on the same IP address can share a connection. * libsoup/soup-message-queue.c (SoupMessageQueueItem): add address-resolving state * libsoup/soup-session-sync.c (process_queue_item): resolve the message's address before getting a connection * libsoup/soup-session-async.c (run_queue, resolve_msg_addr) (resolved_msg_addr): resolve the message's address before getting a connection (request_restarted): if the message gets requeued to a different host, we'll need to re-resolve the address. * libsoup/soup-uri.c (soup_uri_copy_root, soup_uri_host_hash) (soup_uri_host_equal): No longer needed * libsoup/soup-dns.c (do_async_callback): disconnect from the cancellable before invoking the callback * tests/proxy-test.c (tests): fix the 403 example; hostnames are resolved by the session now, even when sending to a proxy, so we need to use a hostname that actually exists svn path=/trunk/; revision=1179
* Add a new property, SOUP_SESSION_IDLE_TIMEOUT, to specify a timeout afterDan Winship2008-03-181-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | * libsoup/soup-session.c (soup_session_class_init): Add a new property, SOUP_SESSION_IDLE_TIMEOUT, to specify a timeout after which idle connections should be closed. (soup_session_get_connection): pass the idle_timeout value on to the connection. * libsoup/soup-connection.c (soup_connection_class_init): Add SOUP_CONNECTION_IDLE_TIMEOUT. (start_idle_timer, stop_idle_timer): add/remove a timeout to call soup_connection_disconnect(). (socket_connect_result, soup_connection_connect_sync): start the idle timer after connection is complete (set_current_request): call stop_idle_timer() when starting a new request (clear_current_request): call start_idle_timer() when finishing a request (dispose): call stop_idle_timer() when destroying the connection #518214, based on a patch from Jorn Baayen. svn path=/trunk/; revision=1112
* Replaces SoupConnectionNTLM; now works as a SoupSession::request_startedDan Winship2008-01-151-9/+0
| | | | | | | | | | | | | * libsoup/soup-auth-manager-ntlm.c: Replaces SoupConnectionNTLM; now works as a SoupSession::request_started watcher. * libsoup/soup-connection.c: remove the no-longer-needed "authenticate" signal * libsoup/soup-session.c: Use a SoupAuthManagerNTLM if USE_NTLM is set. Remove connection-authenticate-signal references. svn path=/trunk/; revision=1043
* Merge libsoup-2.4 branch to trunkDan Winship2008-01-151-30/+13
| | | | | | * Merge libsoup-2.4 branch to trunk svn path=/trunk/; revision=1041
* add G_BEGIN_DECLS / G_END_DECLS to all installed headers so that libsoupJonathon Jongsma2007-06-011-0/+3
| | | | | | | | | 2007-05-16 Jonathon Jongsma <jjongsma@gnome.org> * libsoup/*.h: add G_BEGIN_DECLS / G_END_DECLS to all installed headers so that libsoup can be used from C++ programs. #438776 svn path=/trunk/; revision=925
* add a "timeout" property, which gets passed from server to socket, andVeerapuram Varadhan2006-02-241-0/+1
| | | | | | | | | | | * libsoup/soup-connection.c: * libsoup/soup-session.c: * libsoup/soup-socket.c: add a "timeout" property, which gets passed from server to socket, and session to connection to socket, allowing blocking non-responsive sync connections to return. Combination of "EAGAIN" && "Blocking" connection is treated as error and the connection will be terminated and the control is returned to the caller immediately.
* bump version to 2.2.90. This will not be officially released, but onceDan Winship2005-11-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | * 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.
* use G_GNUC_NULL_TERMINATED.Dan Winship2005-08-151-1/+1
| | | | | | | | | | | | * libsoup/soup-connection.h (soup_connection_new): * libsoup/soup-server.h (soup_server_new): * libsoup/soup-session-async.h (soup_session_async_new_with_options): * libsoup/soup-session-sync.h (soup_session_sync_new_with_options): * libsoup/soup-socket.h (soup_socket_new): use G_GNUC_NULL_TERMINATED. * libsoup/soup-types.h (G_GNUC_NULL_TERMINATED): steal the definition of this from glib 2.8 for use when compiling against glib 2.6.
* add/fix gtk-doc comments, make functions match prototypes, etcDan Winship2005-06-141-4/+13
| | | | | | | * libsoup/*.[ch]: add/fix gtk-doc comments, make functions match prototypes, etc * docs/reference/*: update, fix, etc
* require glib-2.0 >= 2.4.0Dan Winship2005-04-111-3/+0
| | | | | | | | | | | | * 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-1/+1
| | | | | | | | | | | | | | | * 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 the connection attempt succeeded, reserve the connection beforeDan Winship2004-07-141-0/+2
| | | | | | | | | | | | | | | | | | * libsoup/soup-session.c (connect_result): If the connection attempt succeeded, reserve the connection before releasing host_lock. Otherwise, another thread might find it in the connection pool before the caller can queue a message on it. #60693 * libsoup/soup-session-async.c (got_connection): Call soup_connection_release(), since we don't have a specific message in mind for the connection, so we need it to be considered idle. * libsoup/soup-connection.c (soup_connection_release): New function, to undo a soup_connection_reserve(). (soup_connection_send_request, soup_connection_reserve, soup_connection_authenticate, soup_connection_reauthenticate): Document these
* New. An interface for objects that want to act on every message passingDan Winship2003-12-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libsoup/soup-message-filter.c: New. An interface for objects that want to act on every message passing through a session. (Initially being used for authentication, but could also be used for cache handling, cookie management, etc.) * libsoup/soup-connection.c (class_init, etc): Add a message filter property. (send_request): If the connection has a message filter set, run it on the message before sending it. (soup_connection_connect_async, etc): When setting up a tunnel, if we get back a 407 and the session tries to requeue the message, either re-send it, or return SOUP_STATUS_TRY_AGAIN (depending on whether or not the proxy closed the connection). (soup_connection_connect_sync): Likewise (send_request, request_done): Ref/unref the connection * libsoup/soup-session.c (soup_session_get_type): Implement the SoupMessageFilter interface. (soup_session_get_connection): Use the session as the connection's message filter (soup_session_add_filter, soup_session_remove_filter): Add/remove filters from the session (setup_message): do auth handling, and call each of the session's filters' setup_message methods as well. (soup_session_send_message_via): No longer needed. (connect_result): Handle SOUP_STATUS_TRY_AGAIN. * libsoup/soup-session-async.c (run_queue): Use soup_connection_send_request, since soup_session_send_message_via is gone now. * libsoup/soup-session-sync.c (send_message): Likewise * libsoup/soup-message.c (soup_message_is_keepalive): A successful response to a CONNECT is always keepalive, even if it's HTTP/1.0 with no Connection header. * libsoup/soup-status.h: add SOUP_STATUS_TRY_AGAIN * libsoup/soup-types.h: Add SoupMessageFilter, and macros for gobject interface types. * tests/get.c (main): Add a -p flag to specify a proxy * tests/simple-proxy.c: Fix #includes
* Add gthread to glib checkDan Winship2003-12-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.in: Add gthread to glib check * libsoup/soup-session.c: Make this an abstract class. * libsoup/soup-session-async.c: A SoupSession class for asynchronous gmain-based operation; replaces the old SoupSession. * libsoup/soup-session-sync.c: A SoupSession class for synchronous blocking operation for use with threaded apps. * libsoup/soup-types.h, libsoup/soup.h: add the new session subclasses * libsoup/soup-connection.c (soup_connection_connect_sync): Don't try to unref the socket if the socket creation fails. (soup_connection_reserve): New, to explicitly mark a connection as being in use without queueing a message on it. * libsoup/soup-dns.c (check_hostent): Oof. Fix the logic of the "block" flag to not be reversed. * libsoup/soup-message.c (finished): set status to FINISHED here. (soup_message_cancel): Gone; needs to be done at the session level. * libsoup/soup-message-queue.c: Add a mutex and make all of the operations thread-safe. * libsoup/soup-socket.c (disconnect_internal): Make this thread-safe. (soup_socket_connect): Make the sync case work correctly. * libsoup/Makefile.am: add the SoupSession subclasses * tests/Makefile.am: libsoup depends on libgthread now, so revserver doesn't need to explicitly. * tests/get.c, tests/auth-test.c, tests/simple-proxy.c: Use soup_session_async_new().
* Change G_LOG_DOMAIN to "libsoup". Remove unused defines.Dan Winship2003-11-181-1/+1
| | | | | | | | | | | | | | | | | | | * libsoup/Makefile.am (INCLUDES): Change G_LOG_DOMAIN to "libsoup". Remove unused defines. * libsoup/soup-connection.c: Fix doc comments * libsoup/soup-message.c: Likewise * libsoup/soup-misc.c: Likewise * libsoup/soup-socket.c: Likewise * libsoup/soup-uri.c: Likewise * libsoup/soup-address.h: Fixes to please gtk-doc * libsoup/soup-connection.h: Likewise * libsoup/soup-message.h: Likewise * libsoup/soup-message-private.h: Likewise * libsoup/soup-misc.h: Likewise * libsoup/soup-server-auth.h: Likewise * libsoup/soup-socket.h: Likewise
* Remove refcounting, but note whether or not the CA file has been loaded.Dan Winship2003-09-231-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libsoup/soup-gnutls.c (SoupGNUTLSCred): Remove refcounting, but note whether or not the CA file has been loaded. (SoupGNUTLSChannel): add a "hostname" field. (verify_certificate): Remove the comment about not being able to verify the hostname because of soup problems. Now it's because of GNUTLS problems instead. (soup_ssl_wrap_iochannel): Renamed from soup_ssl_get_iochannel, and takes a hostname and a creds argument now. (soup_ssl_get_client_credentials, soup_ssl_get_server_credentials): Return client/server credentials structures. (soup_ssl_free_client_credentials, soup_ssl_free_server_credentials): and free them. * libsoup/soup-session.c (class_init, set_property, get_property): add ssl_ca_file property (get_host_for_message): when returning an SSL host for the first time, create a client credentials structure for the session. (run_queue): Pass the ssl creds to the new connection. Also fix an unrelated bug that caused infinite loops on "bad hostname". * libsoup/soup-server.c: Use GObject properties, including ssl_cert_file and ssl_key_file properties. (soup_server_new): Remove "protocol" argument; if the cert file and key file properties were set, create a server credential structure from them and pass that to soup_socket_server_new. * libsoup/soup-connection.c (SoupConnectionPrivate): Rename dest_uri to origin_uri to match RFC 2616 terminology. Add an "ssl_creds" field. (class_init, set_property, get_property): add SSL_CREDS property (soup_connection_connect_async, soup_connection_connect_sync): Pass ssl_creds to soup_socket_client_new calls. * libsoup/soup-socket.c: Use GObject properties, including an ssl_creds property (soup_socket_set_flags): Gone (replaced with boolean properties) (soup_socket_new): Make this take a list of properties (listen_watch): copy ssl creds from listener to new socket (soup_socket_start_ssl): Pass remote hostname and socket creds structure to soup_ssl_wrap_iochannel. (soup_socket_client_new_async, soup_socket_client_new_sync, soup_socket_server_new): Replace the SSL boolean with an ssl_creds structure. * libsoup/soup-misc.c (soup_set_ssl_ca_file, soup_set_ssl_cert_files, soup_get_ssl_ca_file, soup_get_ssl_cert_files): Gone. SSL state is now per-session or per-server. * tests/get.c: add a "-c CAfile" argument, for loading a CA certificate file to validate https connections against * tests/simple-httpd.c: Add "-c certfile" and "-k keyfile" arguments for loading an SSL server certificate. Only start an SSL server if those arguments were used. * tests/test-cert.pem: * tests/test-key.pem: SSL certificate for testing simple-httpd * tests/revserver.c: Update for API changes * tests/simple-proxy.c: Likewise
* Replaces the three previous soup_connection_new* functions and usesDan Winship2003-09-171-6/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Remove the "status" field from here, since it's mostly used byDan Winship2003-09-101-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libsoup/soup-message-private.h (SoupMessagePrivate): Remove the "status" field from here, since it's mostly used by SoupSession, which shouldn't need access to SoupMessagePrivate. * libsoup/soup-message.h (SoupMessage): Move it here. (SoupCallbackFn): Remove this alias for SoupMessageCallbackFn. (soup_message_set_uri): also moved from soup-message-private.h * libsoup/soup-message.c: s/msg->priv->status/msg->status/. * libsoup/soup-message-handlers.c: s/SoupCallbackFn/SoupMessageCallbackFn/ everywhere. * libsoup/soup-message-io.c (soup_message_io_client, soup_message_io_server, soup_message_io_unpause): Don't set up an idle handler, just jump right in to reading/writing; if this is a synchronous socket, then the caller wants to block, and if it's not, then we'll quickly get an EAGAIN anyway. * libsoup/soup-session.c: (queue_message): Likewise. (*) Update for SoupMessageStatus move and remove soup-message-private.h include. * libsoup/soup-server-message.c: Remove soup-message-private.h include. * libsoup/soup-server.c: Likewise. * libsoup/soup-connection.c (soup_connection_is_connected, soup_connection_is_new): Remove these, since they weren't being used. * libsoup/soup-md5-utils.c: Moved from md5-utils.c and renamed, to avoid namespace pollution. * libsoup/soup-auth-digest.c: Update for that. * libsoup/soup-server-auth.c: Likewise * tests/auth-test.c: Remove soup-message-private.h include
* Beginnings of improved synchronous API supportDan Winship2003-09-091-23/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libsoup/soup-dns.c: Simplify this by making it not automatically return the result: force the caller to poll. (This isn't really a performance issue: the results should come back quickly anyway.) Also, make the cache thread-safe. (soup_dns_entry_from_name): Was soup_gethostbyname (soup_dns_entry_from_addr): Was soup_gethostbyaddr (soup_dns_entry_check_lookup): Used to poll to see if DNS is done (soup_dns_entry_get_hostent): Gets the hostent from an entry (and blocks if it's not resolved yet). * libsoup/soup-address.c: Update for soup-dns changes. (soup_address_new): Don't automatically start resolving the hostname now, since we don't know if the caller is going to want it resolved synchronously or asynchronously. (soup_address_resolve_async): Renamed from soup_address_resolve. (soup_address_resolve_sync): New routine to do blocking synchronous DNS. * libsoup/soup-socket.c (soup_socket_connect): Now returns a status value directly when connecting synchronously. (soup_socket_client_new_async, soup_socket_client_new_sync): Separate async/sync client socket functions. (soup_socket_get_iochannel): Made static since it was not used outside soup-socket. * libsoup/soup-connection.c (soup_connection_new, soup_connection_new_proxy, soup_connection_new_tunnel): Just set up the data, don't actually start connecting. (soup_connection_connect_async, soup_connection_connect_sync): New async and sync SoupConnection connecting routines. (soup_connection_get_socket): Remove this since it wasn't being used. * libsoup/soup-session.c (final_finished): Run the queue since a connection is now freed up. (run_queue): Update for soup_connection_new* changes. * libsoup/soup-misc.c (soup_substring_index): Remove, since it wasn't being used any more. * libsoup/soup-private.h: Remove some prototypes for functions that no longer exist. * libsoup/soup-uri.c (soup_uri_copy_root): New utility function (copies the protocol, host, and port of a SoupUri). * tests/auth-test.c: * tests/get.c: * tests/simple-proxy.c: belatedly update for soup-session change * tests/revserver.c: Handle each new connection in its own thread, using synchronous SoupSocket calls.
* Renamed from soup-error.h, with types and defines renamed accordingly.Dan Winship2003-09-031-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* First draft at the new object to maintain formerly-global state. (Not yetDan Winship2003-09-021-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libsoup/soup-session.c: First draft at the new object to maintain formerly-global state. (Not yet complete; still need to get rid of SoupContext). * libsoup/soup-message-queue.c: Data structure used by SoupSession * libsoup/soup-queue.c: Gone. Mostly moved into soup-session, but some bits went into soup-connection. * libsoup/soup-connection.c (soup_connection_send_request): New, to send a request on a connection. The connection updates its internal state and then hands off to soup_message_send_request. (request_done): Callback set up by soup_connection_send_request. Marks the connection as no-longer-in-use, and disconnects it if the message says to. (soup_connection_set_in_use, soup_connection_mark_old): No longer needed; the connection takes care of this itself now. (soup_connection_new_proxy): New, to create a new connection that is explicitly marked as being through an HTTP proxy. (soup_connection_new_tunnel): New, to create a new HTTPS connection through a proxy. (Includes the code to send the CONNECT.) * libsoup/soup-context.c (try_existing_connections): Don't need to call soup_connection_set_in_use. (try_create_connection): Use soup_connection_new, soup_connection_new_proxy, or soup_connection_new_tunnel as appropriate. * libsoup/soup-message.c (soup_message_prepare): Replaces queue_message. (soup_message_queue, soup_message_requeue, soup_message_prepare): Gone. This must be done via a SoupSession now. (soup_message_set_connection): don't need to mark in_use/not in_use. Also, msg->priv->socket is gone now. (soup_message_get_socket): Gone. * libsoup/soup-message-handlers.c (soup_message_run_handlers): Remove references to global handlers. (redirect_handler, authorize_handler): Moved to soup-session.c. * libsoup/soup-misc.c (soup_shutdown): Gone; just unref the session to shut down now. * libsoup/soup.h: add soup-session.h * libsoup/Makefile.am: updates * tests/auth-test.c, tests/get.c, tests/simple-proxy.c: Use SoupSession.
* New header with typedefs, to avoid #include loops among other headers.Dan Winship2003-08-271-5/+3
| | | | | | | | | * libsoup/soup-types.h: New header with typedefs, to avoid #include loops among other headers. * libsoup/Makefile.am (libsoupinclude_HEADERS): add it * libsoup/*.[ch], tests/*.c: Update for soup-types.h
* Higher-than-soup-message-io-level functions to do client-side IO. (CodeDan Winship2003-08-261-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Make this a GObject. (Note that since SoupMessage was not refcountedDan Winship2003-08-201-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libsoup/soup-message.c: Make this a GObject. (Note that since SoupMessage was not refcounted before, it's not really refcounted now either. TBF) (soup_message_free): Gone, replaced by g_object_unref (soup_message_copy, soup_message_foreach_remove_header): Remove these, since neither was currently functional. (soup_message_is_keepalive): New utility function to look at HTTP version and request/response headers to decide if a message indicates the connection should be kept alive. (soup_message_set_connection, soup_message_get_connection): New (soup_message_get_socket): New * libsoup/soup-server-message.c: Make this a subclass of SoupMessage. (soup_server_message_new): Now takes a SoupServer and SoupSocket (soup_server_message_get_server): New (soup_server_message_set_encoding, soup_server_message_get_encoding): Get/set whether the message should be sent with content-length or chunked encoding (soup_server_message_is_started, soup_server_message_is_finished): Private member accessors. (soup_server_message_add_chunk): Renamed from add_data (soup_server_message_get_chunk): Pops a chunk from the list. (soup_server_message_get_source): Gone * libsoup/soup-server.c: Update for SoupServerMessage changes. (error_cb, write_done_cb): All the cleanup stuff that used to be here happens automatically by unreffing the message now. (get_response_header): Remove some erroneous leftover CGI stuff (issue_bad_request): add "Connection: close" to the response. (read_headers_cb): clean this up a bit. Reject HTTP/1.1 messages with no Host header as per RFC 2616. * libsoup/soup-connection.c (soup_connection_start_ssl): Gone (soup_connection_set_in_use): Let the caller set the connection to "not in use" even after the socket has been disconnected. * libsoup/soup-context.c: Use soup_message_get_connection * libsoup/soup-headers.c (soup_headers_parse_request): Remove the check on request length, since it was rejecting "GET / HTTP/1.0\r\n\r\n", which is a valid complete request. * libsoup/soup-queue.c: Use soup_message_get_connection and soup_message_get_socket. (soup_queue_read_done_cb): Use soup_message_is_keepalive (proxy_https_connect_cb): Use soup_socket_start_ssl rather than soup_connection_start_ssl * libsoup/soup-socket.c (finalize): disconnect the GIOChannel handlers if the socket hasn't been disconnected yet. * libsoup/soup-transfer.c (soup_reader_read_body_chunk, reader_read): Fix these so that reader_read will exit properly if the read is cancelled. * tests/auth-test.c (main): s/soup_message_free/g_object_unref/ * tests/simple-httpd.c (server_callback): set the message to content-length encoding. * tests/simple-proxy.c (server_callback): Likewise
* New API for doing socket IO. Works both synchronously and asynchronously,Dan Winship2003-08-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * libsoup/soup-socket.c (soup_socket_read, soup_socket_read_until, soup_socket_write): New API for doing socket IO. Works both synchronously and asynchronously, and buffers data to prevent the "100 Continue" problem. (soup_socket_set_flag): Replaces formerly-private soup_set_sockopts. (primarily to let the caller turn off SOUP_SOCKET_FLAG_NONBLOCKING). * libsoup/soup-transfer.c (soup_transfer_read, soup_transfer_write, soup_transfer_write_simple): Take a SoupSocket instead of a GIOChannel. Use the new socket IO api. Changed the prototypes of some of the callbacks to be less hackish. * libsoup/soup-connection.c (soup_connection_get_socket): Replaces soup_connection_get_iochannel. * libsoup/soup-message.c: Fix up for soup-transfer changes * libsoup/soup-queue.c: Likewise * libsoup/soup-server.c: Likewise * tests/revserver.c: A slightly more complicated replacement for timeserver. (Does both reads and writes)
* New, split out from soup-context and made into a GObject.Dan Winship2003-08-141-0/+54
* libsoup/soup-connection.c: New, split out from soup-context and made into a GObject. (soup_connection_disconnect): Disconnects the connection and emits a signal. (Replaces the old "keep_alive" flag.) (soup_connection_is_connected): Checks if the connection is still connected (connection_died): Just disconnect, rather than freeing the connection. This way if anyone else is still referencing it they won't end up with an invalid pointer. * libsoup/soup-context.c: Make this a GObject, remove all the SoupConnection code. Add an "ntlm_auths" field to SoupHost so that SoupContext can keep track of connection auth stuff there without SoupConnection needing to care. Various other updates. * libsoup/soup-private.h: Remove SoupContext and SoupConnection definitions. * libsoup/*.c, tests/get.c: Update for context/connection changes * libsoup/soup-socks.c (soup_connect_socks_proxy): Change the definition to deal with the fact that there's no soup_connection_get_context any more. * libsoup/soup-queue.c (soup_queue_read_headers_cb): Don't deal with connection persistence here. (soup_queue_read_done_cb): Do it here instead. Disconnect the connection when appropriate. (proxy_connect, proxy_https_connect, proxy_https_connect_cb): Reference-count the connection properly. (I think.) * libsoup/soup-marshal.list: New, for SoupConnection's "disconnected" signal. * libsoup/Makefile.am: add rules to build soup-marshal.[ch] * configure.in: Use AM_PATH_GLIB_2 rather than pkg-config, so that GLIB_GENMARSHAL gets set too.