summaryrefslogtreecommitdiff
path: root/libsoup/soup-session.h
Commit message (Collapse)AuthorAgeFilesLines
* add these to query session features. #565392.Dan Winship2008-12-231-8/+12
| | | | | | | | * libsoup/soup-session.c (soup_session_get_features) (soup_session_get_feature): add these to query session features. #565392. svn path=/trunk/; revision=1223
* New interface type representing a feature that can be added to aDan Winship2008-04-081-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | * libsoup/soup-session-feature.c: New interface type representing a feature that can be added to a SoupSession. * libsoup/soup-session.c (soup_session_add_feature): Add a feature to the session by prepending it to priv->features and calling soup_session_feature_attach() on it. (soup_session_add_feature_by_type): Add a feature to the session by creating an object of the indicated type and passing it to soup_session_add_feature. (soup_session_remove_feature) (soup_session_remove_feature_by_type): Likewise, remove features (soup_session_class_init, set_property): register/handle construct-time feature adding/removing properties (dispose): cleanup features * libsoup/soup-logger.c: port to SoupSessionFeature * tests/test-utils.c (soup_test_session_new): Use soup_session_add_feature rather than soup_logger_attach. svn path=/trunk/; revision=1133
* 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
* use an underscore for struct definitions. Fixes bug #518317.Benjamin Otte2008-02-251-1/+1
| | | | | | | | | | | | | | | | | | | | 2008-02-25 Benjamin Otte <otte@gnome.org> * libsoup/soup-address.h: * libsoup/soup-auth-domain.h: * libsoup/soup-auth.h: * libsoup/soup-message.h: * libsoup/soup-server.h: * libsoup/soup-session-async.h: * libsoup/soup-session-sync.h: * libsoup/soup-session.h: * libsoup/soup-socket.h: * libsoup/soup-types.h: * libsoup/soup-uri.h: use an underscore for struct definitions. Fixes bug #518317. svn path=/trunk/; revision=1093
* fix default connections-per-host again; it was defined in two places. AddDan Winship2008-02-031-0/+1
| | | | | | | | | | | | | | * libsoup/soup-session.c: fix default connections-per-host again; it was defined in two places. Add SOUP_SESSION_USER_AGENT property (setup_message): set the User-Agent request header on the request * libsoup/soup-server.c: add SOUP_SERVER_SERVER_HEADER property (start_request): set the Server response header on the request. * tests/get.c: * tests/simple-httpd.c: set the User-Agent/Server headers svn path=/trunk/; revision=1071
* Use GObject properties. (soup_address_new, soup_address_new_from_sockaddr)Dan Winship2008-02-011-3/+4
| | | | | | | | | | | | | | | | | | | | * libsoup/soup-address.c: Use GObject properties. (soup_address_new, soup_address_new_from_sockaddr) (soup_address_new_any): Make these just wrappers around g_object_new. * libsoup/soup-message-body.c (soup_message_body_get_type): * libsoup/soup-message-headers.c (soup_message_headers_get_type): * libsoup/soup-server.c (soup_client_context_get_type): Register these as boxed types, for language bindings. * libsoup/soup-date.c (soup_date_get_type): * libsoup/soup-message-body.c (soup_buffer_get_type): * libsoup/soup-value-utils.c (soup_byte_array_get_type): * libsoup/soup-uri.c (soup_uri_get_type): Upgrade to the latest yummiest type-registering idiom. svn path=/trunk/; revision=1067
* Merge libsoup-2.4 branch to trunkDan Winship2008-01-151-26/+23
| | | | | | * Merge libsoup-2.4 branch to trunk svn path=/trunk/; revision=1041
* 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
* 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.
* require glib-2.0 >= 2.4.0Dan Winship2005-04-111-4/+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)
* New. An interface for objects that want to act on every message passingDan Winship2003-12-191-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-7/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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().
* Remove refcounting, but note whether or not the CA file has been loaded.Dan Winship2003-09-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* free the hostent.Dan Winship2003-09-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* (soup_session_abort): New, to cancel all pending requests.Dan Winship2003-09-171-1/+3
|
* Replaces the three previous soup_connection_new* functions and usesDan Winship2003-09-171-18/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Add "authenticate" and "reauthenticate" signals. (invalidate_auth): RemoveDan Winship2003-09-101-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libsoup/soup-session.c: Add "authenticate" and "reauthenticate" signals. (invalidate_auth): Remove the call to soup_auth_invalidate. (authenticate_auth): soup_auth_fn is gone. If the URI doesn't contain authentication, then emit "authenticate" or "reauthenticate" (depending on whether or not this is the first time we've asked for a password for this auth). (update_auth_internal): If the server rejects our username/password, don't bail out immediately. Try doing a "reauthenticate" first. * libsoup/soup-misc.c (soup_set_authorize_callback): Gone * libsoup/soup-auth.c (soup_auth_new_from_header_list): Remove the "pref" arg. (soup_auth_invalidate): Remove this; it doesn't actually do anything useful for us. * libsoup/soup-auth-basic.c (invalidate): Remove * libsoup/soup-auth-digest.c: (invalidate): Remove * libsoup/soup-auth-ntlm.c: (invalidate): Remove * libsoup/soup-uri.c: Remove all references to "authmech". (soup_uri_set_auth): Remove this too. * tests/auth-test.c: Update to use the "authenticate" and "reauthenticate" signals instead of encoding usernames and passwords in the URIs. Add a few more test cases.
* Move a bunch of logic here from soup-context. Now the session keeps trackDan Winship2003-09-051-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | * 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-0/+46
* 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.