diff options
author | Dan Winship <danw@src.gnome.org> | 2002-11-05 19:45:46 +0000 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2002-11-05 19:45:46 +0000 |
commit | d4629510fb547f3ed2cce829ea1ec0c73bc5647c (patch) | |
tree | 19ee5b614bf12a0aa2ebd29d8a9fd2535dea8386 | |
parent | 6314c214c92e43c84be54754013580ecb475b486 (diff) | |
download | libsoup-d4629510fb547f3ed2cce829ea1ec0c73bc5647c.tar.gz libsoup-d4629510fb547f3ed2cce829ea1ec0c73bc5647c.tar.bz2 libsoup-d4629510fb547f3ed2cce829ea1ec0c73bc5647c.zip |
Split libsoup out of soup. ChangeLog.old contains the original soup
* Split libsoup out of soup. ChangeLog.old contains the original
soup ChangeLog.
* Makefile.am, etc: Fix things up to work with the new directory
layout. Disable docs until we fix them.
* autogen.sh: Use gnome-autogen.sh
* configure.in: Require autoconf 2.53. Remove stuff that was only
needed for httpd or wsdl code. Remove glib1 support. Bump version
to 2.0.
* libsoup/Makefile.am: Rename library to libsoup-2.0, put includes
in ${includedir}/soup-2.0
* libsoup/*: Merge soup-0-7 back onto the trunk. Remove
SOAP-specific stuff, Windows support, and other things that
weren't being maintained.
* soup-config.in, soupConf.sh: Kill these. We only support
pkg-config now.
46 files changed, 1620 insertions, 5681 deletions
@@ -1,5 +1,5 @@ aclocal.m4 -config.cache +autom4te*.cache config.guess config.h config.h.in @@ -13,11 +13,6 @@ ltmain.sh Makefile Makefile.in soup.pc -soup.spec -soup-config -soupConf.sh -soup_apacheConf.sh -soup_wsdlConf.sh stamp-h stamp.h stamp-h.in @@ -1,3914 +1,23 @@ -2002-05-31 Jacob Berkman <jacob@ximian.com> +2002-11-05 Dan Winship <danw@ximian.com> - * src/libsoup/soup-message.h (SoupHandlerFilterType): add - 'typedef' + * Split libsoup out of soup. ChangeLog.old contains the original + soup ChangeLog. -2002-04-08 Alex Graveley <alex@ximian.com> + * Makefile.am, etc: Fix things up to work with the new directory + layout. Disable docs until we fix them. - * src/libsoup/soup-server.c (auth_context_copy): Return copied - auth context. doh. + * autogen.sh: Use gnome-autogen.sh -2002-03-21 Alex Graveley <alex@ximian.com> + * configure.in: Require autoconf 2.53. Remove stuff that was only + needed for httpd or wsdl code. Remove glib1 support. Bump version + to 2.0. - * src/libsoup/soup-queue.c (soup_queue_read_headers_cb): Handle - forced no-content response codes 204, 205, and 304. Check - transfer-encoding before content-length to handle broken - Traffic-Server proxies. - -2002-03-20 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-server.c (soup_server_get_handler): Return - default handler if none exist. Unregister default handler before - resetting. - (soup_server_register): Break out auth copying. - (auth_context_copy): To here. - -2002-03-20 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-queue.c (start_request): Issue callback - directly as we might not be in the request processing loop. - (proxy_connect): Ditto. - (soup_queue_connect_cb): Ditto. - (request_in_progress): Impl. Check request is in queue. - (soup_idle_handle_new_requests): Use request_in_progress before - assigning connect_tag. - -2002-03-13 Alex Graveley <alex@ximian.com> - - * src/soup-httpd/soup-httpd.c (ap_ctx_get): Add stub so - soup-apache modules an be run by soup-httpd. - (ap_get_server_port): Ditto. - - * src/soup-wsdl/wsdl-soap-skels.c (wsdl_emit_soap_skels_service): - Generate the _get_server function, which returns a SoupServer - representing the protocol/port defined in the WSDL file. - - * tests/stockquote2-mod-server.sh: Added. Runs soup-httpd using - the libstockquote2.so module generated from - tests/stockquote2-mod-server.c - - * tests/stockquote2-mod-server.c: Update for new API generated by - soup-wsdl. - - * tests/mod-server-test.c (soup_server_init): Update for new - soup_server_register API. - -2002-03-13 Alex Graveley <alex@ximian.com> - - * tests/stockquote2-client.c (callback): Check for transport - error. - - * src/libsoup/soup-env.c (soup_env_get_header): Handle fully - qualified header names in URL form. - -2002-03-13 Alex Graveley <alex@ximian.com> - - * src/soup-wsdl/wsdl-soap-stubs.c (emit_sync_stub): #if 0 out - generated code to use overridden URL in requests. - - * src/libsoup/soup-env.c (copy_header): Make static. - - * src/libsoup/soup-env.h: Fix macros. - - * tests/stockquote2-client.c: Update for new client API. - -2002-03-13 Alex Graveley <alex@ximian.com> - - * tests/stockquote2-server.c: Update for new server API. - - * tests/server-test.c (soup_server_init): Use auth_callback to - validate requests to /hello. - -2002-03-13 Alex Graveley <alex@ximian.com> - - * src/libwsdl/wsdl-soap-parse.c (wsdl_soap_headers): Use - soup_env_add_recv_header to add the new header to the incoming - headers. - -2002-03-12 Alex Graveley <alex@ximian.com> - - * src/soup-ssl-proxy/soup-openssl.c (soup_openssl_get_iochannel): - Loop on SSL_connect for some buggy versions of OpenSSL that still - return SSL_ERROR_WANT_READ/WRITE even for syncronous sockets. - Thanks to Chris Toshok for finding this. - -2002-03-11 Alex Graveley <alex@ximian.com> - - * configure.in, src/libsoup/soup-private.h: Bump development - version to 0.7.99. - - * Merge all changes from soup-0-6 branch. - -2002-03-07 Alex Graveley <alex@ximian.com> - - * configure.in: SOUP_AGE goes to 1, SOUP_CURRENT goes to 4. - Update version to 0.6.99. - - * src/libsoup/soup-private.h (VERSION): Update win version to - Win/0.6.99. - -2002-03-07 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-context.c (soup_context_connect_cb): Remove - debugging g_print. - -2002-03-07 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-socket.h: Add soup_address_lookup_in_cache. - - * src/libsoup/soup-socket.c (soup_socket_connect): Handle host - address already being resolved by checking in address cache. - Allows us to return a non-null state pointer if soup_address_new - calls its callback inline, but soup_socket_new does not. - - * src/libsoup/soup-socket-unix.c (lookup_in_cache_internal): Impl, - checks the address cache for an existing resolved address or - in progress lookup. - (soup_address_lookup_in_cache): Impl, return existing resolved - address if it exists. - (soup_address_new): use lookup_in_cache_internal. - - * src/libsoup/soup-socket-win.c (soup_address_get_cached): Impl, - return NULL as windows has no address hash. - -2002-02-26 JP Rosevear <jpr@ximian.com> - - * src/libsoup/soup-socket-unix.c (soup_address_new): inaddr is a - different type for inet_addr, calculate sizeof directly - -2002-02-25 JP Rosevear <jpr@ximian.com> - - * src/libsoup/soup-socket-unix.c: apparently some platforms don't - define INADDR_NONE either - -2002-02-25 JP Rosevear <jpr@ximian.com> - - * src/soup-httpd/Makefile.am: add popt cflags to includes - - * src/libsoup/soup-socket.c: apparently INET_ADDRSTRLEN is not - defined on some unix platforms - - * src/libsoup/soup-socket-unix.c (soup_address_new): handle not - have inet_pton and inet_aton with inet_addr - - * configure.in: check for inet_aton as well and allow config - options to specify popt location - -2002-02-23 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-queue.c (proxy_connect): Pull proxy connection - code out of soup_queue_connect_cb to here. - (start_request): Delay calling soup_message_issue_callback here. - (soup_queue_connect_cb): Ditto. - (soup_idle_handle_new_requests): Call soup_message_issue_callback - if req->errorcode is set. This avoids an FMW when setting the - connect tag on a request which has a connect error and has been - freed. - - * src/libsoup/soup-message.c (requeue_connect_cb): Call - soup_message_issue_callback if req->errorcode is set. - - * src/libsoup/soup-context.c (soup_context_connect_cb): Add - timeout handler to retry connect if new connection failed and - there are existing connections to this host. - (soup_context_get_connection): Drop timeout interval to 150 from 500. - - * src/libsoup/soup-misc.c: Set default connection limit to 10. - -2002-02-17 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-socket.c (soup_socket_connect_inetaddr_cb): - Check result from soup_socket_new. - - * src/libsoup/soup-queue.c (soup_idle_handle_new_requests): Check - result from soup_context_get_connection. - - * src/libsoup/soup-context.c (soup_context_connect_cb): Don't - access 'data' after free. - (soup_context_get_connection): Check return from - soup_socket_connect, as a null result means our callback has been - issued and our state freed. - -2002-02-15 Dan Winship <danw@ximian.com> - - * src/libsoup/soup-queue.c (soup_queue_shutdown): Only - g_source_remove the idle handler if it's been set, to avoid a glib - warning. - -2002-02-14 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-message.c (soup_message_send): Check if - soup_initialized is FALSE signifying that soup_shutdown has been - called while processing. - - * src/libsoup/soup-queue.c (soup_queue_shutdown): Set - soup_initialized to FALSE so any currently running synch sends - will quit. - -2002-02-13 Ettore Perazzoli <ettore@ximian.com> - - * src/libsoup/soup-ntlm.c (soup_ntlm_response): Set `decodelen' to - be 5 bytes less than the challenge's length to avoid overflowing - the input buffer. - -2002-02-13 Dan Winship <danw@ximian.com> - - * src/libsoup/soup-queue.c (soup_queue_add_request, - soup_queue_remove_request, soup_queue_first_request, - soup_queue_next_request): Routines to all simulataneous iteration - and modification of the active request list. Fixes Ximian 14030. - (soup_idle_handle_new_requests): Use the above functions. - (soup_queue_message): Likewise. - (soup_queue_shutdown): Likewise. - - * src/libsoup/soup-message.c (soup_message_cleanup): Use - soup_queue_remove_request. - -2002-02-10 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-transfer.c (soup_transfer_read_cb): Temporary - fix for 100% cpu usage as HUPs are not being caught in some cases. - -2002-02-08 Dan Winship <danw@ximian.com> - - * src/soup-ssl-proxy/soup-openssl.c (soup_openssl_write): Handle - SSL_ERROR_WANT_READ here too. Fixes at least Ximian 19792 and - maybe others. - -2002-01-17 Joe Shaw <joe@ximian.com> - - * src/libsoup/soup-message.c: Add soup_message_get_http_version() - function. - -2002-01-08 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-error.h: Add SOUP_ERROR_MOVED_TEMPORARILY - (which was in early HTTP1.1 and HTTP1.0 specs) defined to - SOUP_ERROR_FOUND (its replacement). - - * configure.in: Use /usr/lib as the default location for nss and - nspr libs. Also, NSS static libs are named differently from their - dynamic version. - -2002-01-08 Dan Winship <danw@ximian.com> - - * src/libsoup/soup-transfer.c (issue_final_callback): Remove the - gio sources from the reader before invoking the read_done - callback, since the connection will be marked free before the - user's callback is called, so if that callback posts another - request synchronously, the callback will end up getting called - back again when the new request finishes, which is wrong. - -2002-01-08 Alex Graveley <alex@ximian.com> - - * TODO: Update - - * acconfig.h: undef SSL_PROXY_NAME - - * src/libsoup/soup-ssl.c (soup_ssl_get_iochannel): Execute - customly chosen SSL proxy name. - - * src/soup-ssl-proxy/Makefile.am (install-exec-hook): Add - install-time hook for customly named SSL proxy. - - * configure.in: Don't let -lpopt sneak into $LIBS. Add option to - allow custom name for the openssl proxy. Add option to allow - static linking of the SSL library. - -2002-01-02 Rodrigo Moya <rodrigo@ximian.com> - - * src/libsoup-apache/soup-apache.c (soup_apache_handler): updated - for the new field names in SoupServerAuthBasic - -2001-12-21 Alex Graveley <alex@ximian.com> - - * src/libsoup/Makefile.am (libsoup_la_SOURCES): Add - soup-server-auth.c. - - * src/libsoup/soup-server-auth.c: Implement server-side - basic/digest authentication. - (soup_server_auth_get_user): Impl. Allows server auth/path handler - to get the username. - (soup_server_auth_check_passwd): Impl. Allows server auth/path - handler to check a password against the one used in the request. - - * src/libsoup/soup-server.c (call_handler): Create SoupServerAuth - and call auth context's callback before calling path handler. - (message_new): Don't create temporary context, just pass NULL. - (soup_server_register): Copy auth context correctly. - (soup_server_message_new): If a server message already exists, - return that. - (soup_server_message_finish): Start server message as well as - finish, in case message_start is never called. - - * src/libsoup/soup-private.h: Include sys/types.h so sockaddr - works for FreeBSD. - - * src/libsoup/soup-misc.c: Move base64 encoding/decoding here from - soup-ntlm.c. Remove copyright notice as soup_base64_encode is now - taken from evolution. - (soup_base64_encode): Use soup_base64_encode_close. - (soup_base64_decode): Impl. Use soup_base64_decode_step. - - * src/libsoup/soup-misc.h: Make base64 code public. - - * src/libsoup/soup-ntlm.c: Use base64 code from soup-misc.c. - - * src/libsoup/soup-headers.c: Move header parameter parsing to - here from soup-auth.c. - - * src/libsoup/soup-auth.c: Use header parsing from soup-headers.c. - (digest_init_func): Handle empty digest - realm or user passwd. - (decode_data_type): Return 0 on empty value. - - * src/libsoup/soup-uri.c (soup_uri_equal): Impl. - -2001-12-19 Alex Graveley <alex@ximian.com> - - * src/soup-ssl-proxy/soup-openssl.c (soup_openssl_seed): #define - RAND_status to constants for older versions of OpenSSL (before - 0.9.5). - - * src/soup-ssl-proxy/soup-ssl-proxy.c (main): Check that ssh - channel is created before adding watches. - -2001-12-17 Alex Graveley <alex@ximian.com> - - * src/soup-ssl-proxy/soup-openssl.c (soup_openssl_seed): Use - RAND_status less often. - -2001-12-17 Alex Graveley <alex@ximian.com> - - * src/soup-ssl-proxy/soup-openssl.c (soup_openssl_init): Implement - a simple PRNG seed if needed. - -2001-12-15 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-server.c (message_new): Don't use temporary - context to create message, just pass a NULL one. - -2001-12-14 Alex Graveley <alex@ximian.com> - - * tests/server-test.c (push_callback): Add test for server push, - which creates a SoupServerMessage and sends the headers, body, and - ends the transfer at 4 second intervals. - (soup_server_init): Update for new server api. - - * tests/cgi-test.c (soup_server_init): Update for new server api. - - * src/libsoup/soup-transfer.c (soup_transfer_write_simple): - Impl. Just write the headers and data buffer passed. - (soup_transfer_write): Use callback to get header data, remove - header done callback. - (soup_transfer_write_pause): Pause the write by removing the - writable io watch. - (soup_transfer_write_unpause): Unpause by adding it back again. - (write_chunk_sep): Handle (rare) case where 0 length chunk is - first chunk. Final chunks end in \r\n\r\n not just \r\n. - - * src/libsoup/soup-server.c (get_header_cgi_cb): Create header for - delayed writes if soup_server_message_start() has been called, - otherwise pause write. - (get_header_cb): Ditto, use chunked encoding if client supports - it. - (get_chunk_cb): Free the current chunk, not the last one. Pause - write if no new data. - (soup_server_message_start): Impl. Asyncronously send the headers - of the request. Unpause write. - (soup_server_message_add_data): Unpause write. - (soup_server_message_finish): Unpause write. - - * src/libsoup/soup-queue.c (start_request): Use - soup_transfer_write_simple. - - * src/libsoup/soup-socket.c: Comment formatting. - -2001-12-13 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-queue.c (start_request): Use - soup_transfer_write_simple. - -2001-12-13 Alex Graveley <alex@ximian.com> - - * src/libsoup-apache/soup-apache.c (soup_apache_get_server): - Impl. Returns the SoupServer which handles this request's port and - protocol, creating and initializing the server if this is its - first use. - (soup_apache_handler): Check auth_type not auth.type. Update for - new SoupServerContext members. - -2001-12-09 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-uri.c (normalize_path): Add path normalization - code from libxml. - -2001-12-06 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-socket.c (soup_socket_connect_tcp_cb): Free - state before callback. - (soup_socket_connect_inetaddr_cb): Don't shadow param. - -2001-12-06 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-method.[ch]: Create. - - * src/libsoup/soup-dav-server.c: Rehash to be controlled by - caller through soup_dav_server_process, instead of registering - paths with the server internally. This adds the restricition of - only being able to service dav move/copy requests to paths under - the caller's registered path. - - * src/libsoup/soup-server.c (call_handler): Add message, request - path, and method id to SoupServerContext. - - * src/libsoup/soup-message.h: Remove method defines. - -2001-12-05 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-server.c (soup_server_run): Allow recursive - calls and/or blocking on a running async server. - -2001-12-05 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-fault.c: Formatting nitpicks. - - * src/libsoup/soup-server.c (free_handler): Call unregister handler. - - * src/libsoup/soup-server.h: Add unregister callback to - SoupServerHandler so handlers can free temporary resources on - server shutdown. - - * src/libsoup/soup-transfer.c (soup_transfer_write_cb): Call - headers_done_cb if wrote >= header_len. - - * src/libsoup/soup-dav-server.c (soup_dav_server_register): Pass - dav_unregister_handler to soup_server_register, to cleanup state - on server free. - - * src/libsoup/soup-env.c: Rehash. - - * src/libsoup/soup-message.c (soup_message_new): Allow NULL - contexts. - (soup_message_copy): Impl. Copy request/response buffers. - - * src/libsoup/soup-queue.c (soup_queue_message): Handle NULL - message contexts by issuing a cancelled callback. Break out queue - initialization to soup_queue_initialize(). - -2001-12-04 Dan Winship <danw@ximian.com> - - * src/libsoup/soup-message.c (soup_message_requeue): Don't try to - wait for the rest of the data if the read_tag is 0 (eg, if the - write attempt got an EPIPE). Fixes a crash if the server - idle-timeouts a keepalived connection. - -2001-12-02 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-private.h: Remove req_header from - SoupMessagePrivate. - - * src/libsoup/soup-message.c (finalize_message): No more - req_header. - - * src/libsoup/soup-queue.c (start_request): Ditto. - - * src/libsoup/soup-server.c (read_done_cgi_cb): Ditto. - (read_done_cb): Ditto. - -2001-12-01 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-server-auth.h: Pull the SoupServerAuth from - soup-server.h to here. - - * tests/cgi-test.c: - * tests/mod-server-test.c: - * tests/server-test.c: Update for new server api. Add a handler - that sets the errorphrase, add some response headers, and prints - the request body, uri, and headers in the response. - - * src/soup-httpd/soup-httpd.c: Update for new server api, remove - module reloading, which trivializes the server code. - - * src/libsoup-apache/soup-apache.c: Update for new server api. - - * src/libsoup/soup-uri.c (soup_uri_copy): Copy element by element, - don't stringify/unstringify. - - * src/libsoup/soup-uri.h: Remove query_elems from SoupUri. - - * src/libsoup/soup-transfer.c (soup_transfer_write): Take an - encoding argument to allow chunked writes, and a write_chunk_cb to - allow new data to be written. Use a secondary buffer to make - writes (and especially chunked writes) larger, and also simplify - the code. - (write_chunk_sep): Impl. - (write_chunk): Impl. - - * src/libsoup/soup-socket.c (soup_socket_connect_inetaddr_cb): - Free state before issuing failure callback. Add FIXME, as this - shouldn't be needed but avoids a segfault. - - * src/libsoup/soup-socket-unix.c: Formatting. - - * src/libsoup/soup-server.c: Reimplement to support server push - through SoupServerMessage, CGI support, and persistent - connections. Modules are now passed a SoupServer during init, - instead of having well-known global server objects -- these have - been removed. - - * src/libsoup/soup-queue.c (start_request): Update for new - transfer_write interface, passing content length as the encoding - and a NULL write_chunk_cb. - - * src/libsoup/soup-private.h: Add server, server_sock, and - server_msg to _SoupMessagePrivate. Gut _SoupServer. - - * src/libsoup/soup-message.c (soup_message_requeue): Cleanup - boolean eval. - - * src/libsoup/soup-headers.c (soup_headers_parse_response): Wrap - at 80. - - * src/libsoup/soup-dav-server.[ch]: Update for new server handler - interface. - - * configure.in: Check for sys/ioctl.h and sys/filio.h - -2001-11-30 Dan Winship <danw@ximian.com> - - * src/libsoup/soup-headers.c (soup_headers_parse_status_line): - Split this functionality out of soup_headers_parse_response. - - * src/libsoup/Makefile.am (libsoupinclude_HEADERS): Add - soup-message.h to the public headers. - -2001-11-21 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-socket.c (soup_address_set_sockaddr): Remove. - (soup_address_get_sockaddr): Impl. Return the address's internal - sockaddr, and its length. - -2001-11-20 Dan Winship <danw@ximian.com> - - * src/libsoup/soup-ntlm.c (soup_ntlm_request): Simplify. Don't - specify a host and domain, and tweak the flags to a new magic - value that makes the server return some info such as a default - domain to pick. - (soup_ntlm_response): Allow "host" and "domain" to be NULL. If - domain is NULL, use the default from the server response. - - * src/libsoup/soup-auth.c (ntlm_init): soup_ntlm_request no longer - takes host/domain. soup_ntlm_response can take NULL host/domain. - -2001-11-19 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-private.h: Add auth member to SoupConnection. - - * src/libsoup/soup-queue.h: Export soup_queue_connect_cb. - - * src/libsoup/soup-queue.c (soup_encode_http_auth): Get auth token - from connection's auth. - - * src/libsoup/soup-message.c (soup_message_run_handlers): Break if - status after running a handler is also SOUP_STATUS_CONNECTING. - (soup_message_requeue): If the connection uses NTLM, reset - error/finished callbacks. - (requeue_read_finished): Impl. Requeue the message using the - current connection on success. - (requeue_read_error): Impl. Queue the message again and get a new - connection. - (requeue_connect_cb): Impl. Use the old connection's auth data - before passing off to soup_queue_connect_cb. - (soup_message_cleanup): Only reset callbacks if the reader and - connection exist. - (authorize_handler): Set/get the connection's auth data if it - exists and the new auth created uses NTLM. - - * src/libsoup/soup-transfer.c (soup_transfer_read_cb): Dump read - data to stderr if DUMP is defined. - (soup_transfer_write_cb): ditto for writes. - - * src/libsoup/soup-context.c (soup_context_connect_cb): Don't ref - context here, but rather - (soup_context_get_connection): Here, in case the context goes away - while connecting. - -2001-11-14 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-socket-win.c (soup_address_get_name_cb): Don't - leak state on failure, pass address's name, not a copy. - (soup_address_new_cb): Don't access things after we realloc to a - smaller size. - -2001-11-13 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-queue.c (soup_queue_error_cb): Use - soup_message_requeue. - (soup_queue_read_headers_cb): Don't end the transfer if a handler - requeues the message. Close the connection on malformed headers. - (soup_queue_read_chunk_cb): Ditto for the former. - - * src/libsoup/soup-message.c (soup_message_requeue): Impl. Requeue - the message using existing callback/user_data. - (authorize_handler): Use soup_message_requeue. - (redirect_handler): Ditto. - - * src/libsoup/soup-transfer.c (soup_transfer_read_set_callbacks): - Impl. Allows changing of the reader's callbacks to ignore certain - events (like chunk data) and change the user_data. - - * src/libsoup/soup-message.c (soup_message_cleanup): If still - reading response, reset the SoupReader's callbacks to only release - (on finish) or release and close (on error) the connection, - instead of terminating the read which could leave data in the - socket to to hork future messages which use this connection. Also - NULL the message's references to the connection and SoupReader so - that they are not disposed of on message free. - -2001-11-12 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-queue.c (start_request): Impl. Move request - sending code here from soup_queue_connect_cb. - (proxy_https_connect): Impl. Send intermediate CONNECT request to - proxy for SSL connections. If successful, convert connection to - SSL. - (soup_queue_connect_cb): Call proxy_https_connect if we are using - a proxy and the destination is SSL. Call start_request. - (soup_idle_handle_new_requests): If request already has a - connection, just call start_request. - (soup_get_request_header): Special case URI is hostname:port for - CONNECT requests. - (soup_queue_read_headers_cb): Special case connection persistence - for CONNECT requests: if message is successful, assume valid - connection. Special case body handling for CONNECT requests: - assume zero length body. - -2001-11-08 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-queue.c (soup_queue_read_headers_cb): - (soup_queue_read_chunk_cb): - (soup_queue_read_done_cb): Update to call renamed SoupHandlerEvents. - - * src/libsoup/soup-message.[ch]: Remove - soup_message_get_request_header, soup_message_set_request_header, - soup_message_get_response_header, - soup_message_set_response_header, - soup_message_add_error_code_handler, - soup_message_add_error_class_handler, - soup_message_add_header_handler. - (redirect_handler): Update for new handler interface. - (authorize_handler): Ditto. - (timeout_handler): Impl. - (soup_message_remove_handler): Impl. - (soup_message_remove_handler_by_func): Impl. - (soup_message_remove_handler_by_func_and_data): Impl. - (soup_message_list_handlers): Impl. - -2001-11-08 Alex Graveley <alex@ximian.com> - - * configure.in: Version 0.6.0. - * src/libsoup/soup-private.h (VERSION): Ditto. - -2001-11-08 Alex Graveley <alex@ximian.com> - - * configure.in (debug_default): Set debug default to "minimum", - which turns off G_ENABLE_DEBUG (and the ptrace magic) by default. - To turn back on for a debugging environment, use --enable-debug. - - * src/libsoup/soup-socket-unix.c (SOUP_PTRACE_DETACH): Wrap - SOUP_PTRACE defines in check for G_ENABLE_DEBUG. - -2001-11-08 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-socks.c (socks_data_free): Add cleanup function - to avoid leaving context/address references around. - (WSHORT): Use memcpy. - (soup_socks_read): Pass len as sizeof (buf). - (soup_socks_error): Add error handler just in case. - (soup_connect_socks_proxy): Unref the io channel. - (soup_lookup_dest_addr_cb): Ditto. - -2001-11-07 Dan Winship <danw@ximian.com> - - * src/libsoup/soup-auth.c (ntlm_init): Mark the auth completed - after sending the response string. - (ntlm_compare_func): A new NTLM auth doesn't invalidate an - already-completed one. (Makes it not loop forever on a wrong - password.) - -2001-11-02 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-private.h: Add death_tag to _SoupConnection. - - * src/libsoup/soup-socks.c (soup_connect_socks_proxy): Unref proxy - context. - (soup_socks_write): Ditto. - - * src/libsoup/soup-context.c (connection_free): Impl. - (soup_prune_least_used_connection): Use connection_free(). - (soup_connection_release): Ditto. - (soup_prune_foreach): Simplify to not use custom data struct. Just - use a SoupConnection ** to hold state. - (connection_death): Impl. Free the connection if its not - currently in use. - (soup_context_connect_cb): Install a death handler for valid - connections, so connection death can be caught and handled when no - SoupMessage exists to handle it. Ref the context. - (soup_context_get_connection): For reused connections, ref the - connection's new context, unref the old one, and assign the - connection's context to the new one. - (soup_context_unref): Don't free connections, as there must be - none left for all the contexts to have been removed. - (soup_connection_get_context): Add a reference before returning - context. - - * src/libsoup/soup-message.c (soup_message_set_context): Add - precondition checks. - (soup_message_get_context): Ditto. - -2001-11-02 Alex Graveley <alex@ximian.com> - - * src/soup-ssl-proxy/soup-ssl-proxy.c: Remove NSS-related code, as - this is now moved to libsoup. - -2001-11-02 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-private.h: Rename killme to cached in _SoupAddress. - - * src/libsoup/soup-socket-unix.c (soup_address_get_name_cb): Use - g_strndup instead of g_new/strncpy. - (soup_address_new_cb): Set cache status to CACHE_OK on success. - (prune_zeroref_addresses_foreach): Use ia->cached. - (soup_address_unref): Free addresses which are NOT_CACHED. - -2001-11-02 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-context.c (soup_try_existing_connections): - Remove old fixed FIXME. - - * src/libsoup/soup-socket-unix.c - (prune_zeroref_addresses_timeout): Remove timeout if - active_address_hash is null. - (soup_address_unref): Only install timeout handler if the address - has a name, otherwise just free. - -2001-11-01 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-transfer.c (issue_final_callback): Null - terminate recv_buf before copying the data pointer. - -2001-10-31 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-context.c (soup_context_connect_cb): Drop - connection count of connect failed. - (soup_context_get_connection): Increment connection count before - calling soup_socket_connect() to avoid connection limit being - passed by many messages queued at the same time. - - * src/libsoup/soup-server.c (read_done_cb): Assign request's data - buffer to message request buffer, not response. Caught by Tim - Moloney. - - * src/libsoup/soup-transfer.c (soup_transfer_read_cb): Zero - terminate alloca'd header string passed to headers_done_cb. - -2001-10-31 Dan Winship <danw@ximian.com> - - * configure.in: Fix the popt check so you can pass CPPFLAGS and - LDFLAGS in in the environment. - -2001-10-30 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-auth.c (soup_auth_set_context): Remove the - existing SoupAuth from the from the server's valid_auths hash. - (soup_auth_new_from_header_list): Fix bug where auth header - evaluation stopped after finding the first matching scheme. - -2001-10-30 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-socket-unix.c (soup_address_new): Consider - existing addresses with a zero refcount valid to return (with an - added refcount). - (prune_zeroref_addresses_foreach): Impl. - (prune_zeroref_addresses_timeout): Impl. - (soup_address_unref): Don't free zero ref addresses, instead make - sure zeroref timeout handler is installed and install if not. Also - move to here from soup-socket.c. - - * src/libsoup/soup-private.h: Add killme flag to soup_address. - - * src/libsoup/soup-socket-win.c (soup_address_unref): Move here - from soup-socket.c. - -2001-10-29 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-message.c (authorize_handler): Call - soup_auth_fn if we don't have auth data in the URI, then call - soup_auth_initialize if the callback set authenticate data on the - passed uri. - - * src/libsoup/soup-auth.h: Make type be SoupAuthType. - - * src/libsoup/soup-auth.c (soup_auth_initialize): Impl. To be - called after SoupAuth creation to apply auth data to the - SoupAuth. This allows us to parse the Authenticate headers to - figure out which auth scheme and realm is being used, and pass - this to the auth callback. - - * src/libsoup/soup-misc.c (soup_set_authorize_callback): Impl. - - * src/libsoup/soup-misc.h: Add SoupAuthType enum here. - - * src/libsoup/soup-server.h: Use SoupAuthType. Remove - SoupServerAuthType. - -2001-10-27 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-dav.c: Include soup-error.h - - * src/libsoup/soup-queue.c (soup_debug_print_headers): Use - soup_message_foreach_header. - - * src/libsoup/soup-message.c (soup_message_new): Default to GET if - method not supplied. - (soup_message_add_header): Remove code to delete header if no - value is supplied. - (soup_message_foreach_remove_header): Impl. - (soup_message_remove_header): Impl. - -2001-10-26 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-socket-unix.c (soup_address_new): Use WUNTRACED, - which should fix possible hang situation. - - * src/libsoup/soup-transfer.c (issue_chunk_callback): Address bug - where data buffer passed to chunk callback could be invalid due to - appending a null. Just don't addend NULL for chunk callbacks. - -2001-10-26 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-message.c (redirect_handler): Use - soup_uri_set_auth(). - - * src/libsoup/soup-uri.c (soup_uri_free): Don't use g_assert. - (soup_uri_set_auth): Impl. - - * src/libsoup/soup-server.c (read_headers_cb): Use - soup_message_set_context(). - - * src/libsoup/soup-message.c (soup_message_set_context): Impl. - (soup_message_get_context): Impl. - (redirect_handler): Use soup_message_set_context(). - -2001-10-25 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-message.c (redirect_handler): Handle redirects - when source uri has auth data by copying auth to new url. - -2001-10-25 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-queue.c (soup_queue_read_headers_cb): Fixe bug - where informational responses were treated as an unknown encoding, - causing the actual response to be considered part of the - informational response body. - -2001-10-25 Dan Winship <danw@ximian.com> - - * configure.in: Fix up the networking library checks to work on - Solaris. Check for inet_pton. (Solaris doesn't have inet_aton.) - - * src/libsoup/soup-socket-unix.c (soup_address_new): Use inet_pton - instead of inet_aton if available. - -2001-10-22 Joe Shaw <joe@ximian.com> - - * src/soup-ssl-proxy/soup-ssl-proxy.c (soup_ssl_proxy_readwrite): - Make sure we handle G_IO_IN before we handle G_IO_HUP so we don't - lose data on the pipe, as you can receive both at the same time. - Ian Peters actually found this, but I am his commit monkey. - -2001-10-22 JP Rosevear <jpr@ximian.com> - - * src/libsoup/soup-dav.c (soup_dav_response_new): use new error - api - - * src/libsoup/soup-queue.c (soup_parse_headers): ditto - - * src/libsoup/soup-message.c (soup_message_set_error_full): ditto - (soup_message_set_error): ditto - -2001-10-21 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-message.h: Reorganize. - - * src/libsoup/Makefile.am (libsoupinclude_HEADERS): Add soup-error.h. - (libsoup_la_SOURCES): Add soup-error.c. - - * src/libsoup/soup-error.[ch]: Move SoupKnownErrorCode and - SoupErrorClass defines to here. Move soup_get_error_phrase and - soup_get_error_class here, and rename to soup_error_get_phrase and - soup_error_get_class. - -2001-10-19 Alex Graveley <alex@ximian.com> - - This is the first attempt at authentication inheritence, it - still needs some work. Auth headers are always sent no matter - what, auth realms are not respected, auth data in the uri is - ignored unless an existing auth attempt fails, and auth data - should be registered at context creation time. - - * src/libsoup/soup-auth.c (digest_parse_func): Compute a1 hash - "user:realm:passwd:nonce:cnonce" here, to cut down on per-request - overhead. Accept a SoupUri from which to get auth info. - (basic_parse_func): Base64 encode user:passwd here for same - reason. Accept a SoupUri for getting auth info. - (compute_response): Get uri path from message instead of SoupAuth. - (digest_auth_func): Ditto. - (soup_auth_lookup): Impl. Given a context, lookup the SoupAuth of - the nearest parent directory. - (soup_auth_set_context): Impl. Register a SoupAuth to be used for - requests to the context's path and subdirectories. - - * src/libsoup/soup-auth.h: Move define of SoupAuth here, in - preparation for making public eventually. - - * src/libsoup/soup-queue.c (soup_encode_http_auth): Use - soup_auth_lookup (). - (soup_get_request_header): Don't check the request's uri for auth - info, as a parent context may have a valid registered SoupAuth. - - * src/libsoup/soup-message.c (authorize_handler): Use - soup_auth_lookup() to find last (failing) SoupAuth. Use - soup_auth_set_context() to register the created SoupAuth for this - context. - - * src/libsoup/soup-message.h: Explicitly define values for soup - transport-level errorcodes, just because. - - * src/libsoup/soup-context.c (soup_context_unref): When freeing - the SoupHost parent of this context, free all associated - SoupAuths. - - * src/libsoup/soup-private.h: Remove auth pointer from context, - add hashtable of valid auths to SoupAuth. - -2001-10-18 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-queue.c (soup_queue_read_headers_cb): Set - encoding out param appropriately. - * src/libsoup/soup-server.c (soup_httpd_read_headers_cb): Ditto. - - * src/libsoup/soup-transfer.h: Add SoupTransferEncoding enum. - - * src/libsoup/soup-transfer.c (soup_transfer_read_error_cb): - Handle unknown encoding by issuing the read_done callback when the - connection is closed. - (issue_chunk_callback): Pass in a cancelled arg to simplify code. - (read_unknown): Impl. Same as read_content_length () except never - return TRUE. - (soup_transfer_read_cb): Make headers_done_cb take an encoding out - parameter to avoid magic values in content_length. Switch on - encoding to see if read completed. Use issue_final_callback (). - -2001-10-18 JP Rosevear <jpr@ximian.com> - - * src/libsoup/soup-transfer.c (remove_block_at_index): the array - length assertion should be >= rather than less than. - -2001-10-17 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-transfer.c (read_content_length): Don't call - chunk callback if there is no new data. - -2001-10-17 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-transfer.c (remove_block_at_index): Add some - bounds checking. - - * src/libsoup/soup-queue.c (soup_queue_connect_cb): Handle - iochannel creation failure which can happen when using SSL. - -2001-10-16 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-transfer.c (decode_hex): Impl. - (remove_block_at_index): Impl. - (decode_chunk): Simplify using utility functions. - (soup_transfer_read_cb): Use remove_block_at_index. - (read_chunk): Ditto. - -2001-10-16 Joe Shaw <joe@ximian.com> - - * src/libsoup/soup-auth.c (compute_response): A NULL passwd is - perfectly valid, so we want to avoid crashing if that is the case. - -2001-10-16 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-transfer.c (decode_chunk): Fix nasty chunked - encoding bug when the message is set to truncate chunks. Code - reorg to be a lot cleaner. - - * src/libsoup/soup-ntlm.c: Move alloca #define-foo to: - * src/libsoup/soup-private.h: Here. - - * src/libsoup/soup-uri.c (soup_uri_to_string): Handle the case - where path does not begin with a '/'. - - * src/libsoup/soup-server.c (soup_server_free): Use foreach_remove. - -2001-10-09 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-socks.c (soup_connect_socks_proxy): Assign - source connection correctly. - -2001-10-09 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-dav-server.c (parent_exists): don't call - __uri_exists as __is_collection should check this. - -2001-10-06 Alex Graveley <alex@ximian.com> - - * configure.in (enable_nss): Explicitly add libplc4 and libplds4 - which are dependencies of libnspr4. - - * src/libsoup/Makefile.am (libsoup_la_LIBADD): Link with NSS libs. - (libsoup_la_SOURCES): Add soup-nss.[ch]. - - * src/libsoup/soup-nss.c: Added. GIOChannel wrapper for Mozills NSS. - - * src/libsoup/soup-ssl.c: Use NSS if available to avoid out of - process SSL proxy. - - * src/soup-ssl-proxy/Makefile.am (soup_ssl_proxy_SOURCES): Remove - soup-nss.[ch]. - (soup_ssl_proxy_LDADD): Do not link NSS libs, as these are now - linked directly into libsoup. - -2001-10-05 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-message.c (soup_message_clear_headers): - Impl. Use instead of custom header free funcs throughout. - (soup_message_foreach_header): Impl. - (global_handlers): Handle redirects before authenticating. - (redirect_handler): Use soup_message_get_header. - (run_handler): Ditto. - -2001-10-04 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-socket-unix.c (soup_address_new_cb): Ugg. Don't - call waitpid with NOHANG. Avoid zombies. Gain friends. - -2001-10-04 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-message.c (authorize_handler): Call - soup_message_get_header_list. - - * src/libsoup/soup-auth.c (soup_auth_new_from_header_list): Set - crypto strength for authentication types, and try to choose the - strongest when authenticating. - - * src/libsoup/soup-queue.c (soup_check_used_headers): Kill warnings. - - * tests/simple-test.c (list_headers): Handle multiple values for - header. - - * tests/handler-test.c (list_headers): Ditto. - -2001-10-04 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-server.c (read_headers_cb): Fix const warnings. - -2001-10-04 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-server.c (read_headers_cb): Don't create - response_headers. This is done in soup_message_new. Use - soup_message_get_header throughout. - - * src/libsoup/soup-queue.c (soup_check_used_headers): Write list - of headers. - (soup_parse_headers): Don't create response_headers. This is done - in soup_message_new. - (soup_debug_print_a_header): Handle multiple header vals. - (soup_check_used_headers): Ditto. - (soup_queue_remove_header): Ditto. - (soup_queue_message): Don't destroy hashtable, just clear it. - Use soup_message_get_header throughout. - -2001-10-04 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-message.c (soup_message_add_header): Handle - multiple values in header hash tables. - (free_header): Free the list of values. - (soup_message_new): Create request_headers and response_headers - here instead of on header insertion. - (soup_message_set_request_header): Deprecate. - (soup_message_get_request_header): Deprecate. - (soup_message_set_response_header): Deprecate. - (soup_message_get_response_header): Deprecate. - - * src/libsoup/soup-dav-server.c: Update to use new header get/add - funcs. - - * src/libsoup/soup-headers.c (soup_headers_parse): Store headers - as a GSList of values. - -2001-10-03 Dan Winship <danw@ximian.com> - - * src/libsoup/soup-uri.c (soup_uri_new): The @ in - http://foo/bar@baz is part of the path, not the username/hostname - split. - -2001-10-01 Alex Graveley <alex@ximian.com> - - * configure.in: Fix HAVE_OPENSSL and HAVE_NSS checks as these were - always being defined. - -2001-10-01 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-socket-unix.c (soup_address_new): Add defines - for SOUP_PTRACE_ATTACH and SOUP_PTRACE_DETACH to remove - architecture incompatibilities for ptrace() arguments. - - * configure.in: Add libdl to OpenSSL LDFLAGS. Fix NSS header - paths. Define HAVE_OPENSSL and HAVE_NSS if the libraries are - found successfully. - - * src/libsoup/soup-socket.h: Remove soup_gethostbyname and - soup_gethostbyaddr, and move to: - * src/libsoup/soup-private.h: here. - -2001-09-28 Alex Graveley <alex@ximian.com>
-
- * src/libsoup/soup-ntlm.c: Remove redundant alloca define.
-
- * src/libsoup/soup-socket.c (soup_socket_server_new): Use
- SOUP_SOCKET_CLOSE.
-
- * src/libsoup/soup-socket.h: Include winsock.h if windows.
-
-2001-09-28 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-socket-win.c: Fix copyright notice. - * src/libsoup/soup-socket-unix.c: Ditto. - * src/libsoup/soup-socket.c: Ditto. - -2001-09-28 Alex Graveley <alex@ximian.com> - - * build/libsoup.dsp (SOURCE): Add soup-socket-win.c. - - * tests/simple-test.c (main): Take HTTP method and body parameters - to use in the request. - - * src/libsoup/soup-socket.h: Make soup_gethostbyname and - soup_gethostbyaddr public. - - * src/libsoup/soup-socket-unix.c: Added, split of networking code - into unix-specific sections. - - * src/libsoup/soup-socket-win.c: Added, Windows networking code. - - * src/libsoup/soup-socket.c: Holds common socket functions. - -2001-09-27 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-socket.c: Remove Glib workarounds for Windows - socket io. - -2001-09-27 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-socket.c (soup_address_new): #ifdef protect the - ptrace attach/detach code until I have a chance to look at why it - fails on some platforms. - -2001-09-27 Alex Graveley <alex@ximian.com> - - * build/libsoup.def: Update for new exports. - -2001-09-27 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-dav-server.h: Fix constness for get_dav_prop - and get_custom_prop. - -2001-09-19 Dan Winship <danw@ximian.com> - - * src/libsoup/soup-message.c (soup_message_send): Fix this to not - return immediately after parsing the first line of the response. - (Needed an update for the 09-07 api changes.) - -2001-09-17 Vladimir Vukicevic <vladimir@ximian.com> - - * src/libsoup/soup-socket.c, src/libsoup/soup-socket.h: - Added soup_address_copy(). Changed soup_address_new to check - whether the ports are the same before using a cached - address. - -2001-09-14 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-serializer.c - (soup_serializer_get_namespace_prefix): Return const string. - - * Makefile.am (EXTRA_DIST): Install soup.m4. - - * src/libwsdl/wsdl-soap-marshal.c: - * src/libwsdl/wsdl-typecodes.c: - * src/soup-wsdl/wsdl-parse.c: Formatting. - -2001-09-13 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-serializer.c - (soup_serializer_get_namespace_prefix): Impl. - -2001-09-12 Alex Graveley <alex@ximian.com> - - * tests/filesys-server.c (main): Pass protocol to soup_server_new. - * tests/server-test.c (main): Ditto. - - * src/soup-wsdl/Makefile.am (soup_wsdl_LDADD): Remove libwsdl.so - link. - - * src/libwsdl/Makefile.am (libwsdl_build_a_SOURCES): Include - libwsdl.so sources in libwsdl-build.a so libtool 1.3.5 doesn't - ill. Remove libwsdl_build_a_LIBADD. - - * src/libsoup/soup-server.c (soup_server_new): Take a SoupProtocol - argument. - - * src/libsoup/soup-dav-server.c (move_copy): Serialize multi-status. - (i_copy): Fix bug where directory contents were sometimes created - before parent. Add multi-status error reporting. - - * src/libsoup/soup-dav.c (soup_dav_response_new): Remove - response_phrase param. - -2001-09-11 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-dav-server.c (dav_proppatch): Rewrite to - correctly handle rollback and propstat result. Fill in missing - response errors throughout. - -2001-09-11 Alex Graveley <alex@ximian.com> - - * tests/filesys-server.c: Initial commit of DAV test server which - allows manipulation of the filesystem through Web-DAV. - - * tests/Makefile.am (noinst_PROGRAMS): Add filesys-server. - -2001-09-10 Alex Graveley <alex@ximian.com> - - * tests/mod-server-test.sh: Rename from mod-server-test to be - obvious that its a script which simply executes soup-httpd. - -2001-09-10 Alex Graveley <alex@ximian.com> - - * build/soup_httpd.dsp (SOURCE): Fix typo. - - * build/libsoup.dsp: Add src/libsoup/soup-ntlm.[ch] - (SOURCE): Remove soup-apache.c - -2001-09-10 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-dav-server.c (dav_mkcol): Report errors. Check - that parent path exists. - (dav_put): Ditto. - (dav_options): set 404 if path not found. - (dav_options): Handle server-level OPTIONS requests. - (parent_exists): impl. - -2001-09-10 Alex Graveley <alex@ximian.com> - - * src/libsoup/soup-dav-server.h: Replace opt_search with - opt_other. Remove SOUP_DAV_SEARCH. - - * src/libsoup/soup-dav-server.c: Replace dav_search with - dav_other. - -2001-09-10 Alex Graveley <alex@ximian.com> - - * tests/cgi-test.c (main): Pass authtypes param to - soup_server_register. - * tests/server-test.c (main): Ditto. - * tests/mod-server-test.c (soup_server_init): Ditto. - - * tests/stockquote2.wsdl: Format fixes. - -2001-09-07 Alex Graveley <alex@ximian.com> - - * tests/stress-test.c: Rewritten for the new apis, and to be more - clean, and to have many settings for varying simultaneous - messages, message counts, iterations, posting of data, etc. - - * tests/simple-test.c: Rewritten for the new apis, and to be more - clean. - - * tests/server-test.c (main): Added. Simple test for standalone - dynamic servers. - - * tests/mod-server-test.c (callback): Added. Simple test for - soup-httpd/apache server modules. - - * tests/handler-test.c: Added. Stress test for SoupMessage - handlers. - - * tests/cgi-test.c: Added. Simple test for CGI serving. - - * src/soup-httpd/soup-httpd.c: Use libsoup's SoupServer code for - all request processing. soup-httpd becomes a wrapper for module - loading and logging. - - * src/libwsdl/Makefile.am (INCLUDES): Remove WSDL_CFLAGS. - - * src/libsoup/soup-socket.c (soup_socket_server_accept): Set - O_NONBLOCK on the returned SoupSocket. - (soup_socket_server_try_accept): Ditto. - - * src/libsoup/soup-server.c: Reimplement for independent - SoupServer support. Remove separate authorization handler - concept. Process based on request paths. Import code from - soup-httpd to allow standalone dynamic servers, and cgi support. - - * src/libsoup/soup-queue.c (soup_check_used_headers): Remove - special handling of SOAPAction. - (soup_queue_connect_cb): Start listening for reads immediately so - that we cna process HTTP 1xx intermediate responses. - (soup_queue_message): Rename from soup_message_queue. - soup_message_queue is now in soup-message.c and simply calls this. - - * src/libsoup/soup-private.h (RESPONSE_BLOCK_SIZE): Rename - existing SoupServer to SoupHost. Create new SoupServer struct. - Add server and server_sock elements to SoupMessagePrivate. Move - SoupServerHandler definition to soup-server.h. Move define for - soup_queue_shutdown to new soup-queue.h. - - * src/libsoup/soup-ntlm.c: Add mojo for getting a portable alloca. - - * src/libsoup/soup-message.h: Remove SoupErrorCode. Add - SoupKnownErrorCode and SoupErrorClass enums. Add - SOUP_ERROR_CANT_CONNECT_PROXY and - SOUP_ERROR_CANT_AUTHENTICATE_PROXY for errors related directly to - proxy communications. - - * src/libsoup/soup-message.c (soup_message_new): Take the HTTP - method name as the second argument. Remove per-message handlers - for authentication and redirection. - (soup_message_issue_callback): Uses finalize_message to avoid - double cleanup. Remove error argument, as they should be set - using soup_message_set_error. - (soup_message_run_handlers): Run per-message handlers followed by - global handlers, if a handler requeues a message we stop - processing. If the invoke_type is POST_BODY, we issue the final - callback. - (soup_message_remove_handler): Make public. - (soup_message_set_error): Impl - (soup_message_set_error_full): Impl - (soup_message_set_handler_error): Impl - (soup_get_error_phrase): Impl - (soup_get_error_class): Impl - - * src/libsoup/soup-dav-server.c: Add a reference to the SoupServer - we are registered with. Use soup_message_set_error throughout. - (i_copy): Fix assignment causing this loop to never run. - (soup_dav_server_register): Add SoupServer and required authtypes - parameters. - - * src/libsoup/soup-context.c: Replace references to SoupServer - with SoupHost, so we don't clash with the SoupServer from - soup-server.h. Rename soup_servers to soup_hosts. - - * src/libsoup/Makefile.am (libsoup_la_SOURCES): Add soup-queue.h. - - * configure.in (SOUP_CURRENT): Add some helpful comments and bump - to '3'. Bump version to 0.5.99 (0.6 development). Use - AC_FUNC_ALLOCA instead of just checking for alloca.h. Remove - WSDL_CFLAGS. - -2001-08-30 Alex Graveley <alex@ximian.com> - - * src/soup-wsdl/Makefile.am (soup_wsdl_LDADD): Link with - libwsdl.so and libwsdl-build.a. - - * src/libwsdl/Makefile.am (libwsdlinclude_HEADERS): Dont install - wsdl-typecodes-c.h. Make libwsdl-build a static lib. - (libwsdl_build_a_SOURCES): Remove everthing but wsdl-typecodes-c.[ch]. - (libwsdl_build_a_LIBADD): Depend on libwsdl. - -2001-08-29 Alex Graveley <alex@ximian.com> - - * build/soup_ssl_proxy.dsp: - * build/soup_httpd.dsp: - * build/libsoupwsdl.dsp: - * build/libsoupapache.dsp: - * build/libsoup.dsp: Update for new layout. - -2001-08-29 Alex Graveley <alex@ximian.com> - - * src/*/*.h: Fix headers for new layout. - * tests/*.c: Ditto. - - * tests/Makefile.am (LDFLAGS): Use libtool to link with built - libsoup and libwsdl. - (libstockquote2_la_LIBADD): Ditto for libsoup-apache. - - * tests/stockquote2.wsdl: Indent prettily. - - * src/Makefile.am (SUBDIRS): Update for new source layout. - - * configure.in (SOUP_INCLUDEDIR): Use @includedir@/soup. - (SOUP_WSDL_LIBS): include $SOUP_LIBS. - (CFLAGS): Add Makefiles for new layout. - - * soup-config.in: Use @includedir@/soup. - - * soup.pc.in (Cflags): Use @includedir@/soup. - -2001-08-28 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-socket.c (soup_address_new): Perform deep - unix magic in order to identify if we are running in a - debugger. This is needed because gdb causes segfaults in child - processes that load shlibs due to breakpoints being left over in - the new unwatched process. Now, gethostbyname() loads shared libs - to do name resolution on many unixes, which would cause soup to be - hard to use and otherwise suck when run inside a debugger. So now - everything works perfectly both inside and outside of gdb. - (soup_address_new_cb): Resolve the hostname syncronously if we are - inside a debugger. - -2001-08-28 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-context.c (soup_try_existing_connections): - Remove mega FIXME. - - * src/soup-core/soup-queue.c (soup_queue_read_headers_cb): If the - response server is HTTP 1.0, default to non-persistent connections. - - * src/soup-core/soup-httpd.c (soup_httpd_read_headers_cb): Store - http version for incoming message. - - * src/soup-core/soup-headers.c (soup_headers_parse_response): - Support returning the http version. - (soup_headers_parse_request): Ditto. - -2001-08-28 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-transfer.c (soup_transfer_read_chunk): - Rewrite HEX decoding to hopefully be easier to understand and maintain. - - * src/soup-core/soup-message.c (redirect_handler): Don't unref the - old context until after we requeue the message using the new - context, as we may still have a connection from the old one. - -2001-08-27 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-auth.c (soup_auth_new_digest): Set the - compare func on the returned object. - -2001-08-27 Joe Shaw <joe@ximian.com> - - * src/soup-core/soup-context.c (soup_try_existing_connections): - Just return NULL from this function for now. There are some bugs - in it. Added a big, triple FIXME. - -2001-08-26 Alex Graveley <alex@ximian.com> - - * src/soup-wsdl/*: Format fixes. - * src/soup-wsdl-runtime/*: Format fixes. - -2001-08-26 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-misc.c (soup_config_ssl_ca_file): impl. - (soup_config_ssl_ca_directory): impl. - (soup_config_ssl_certificate): impl. - Add config file support for client certificates. - -2001-08-26 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-misc.c (soup_set_ssl_ca_file): impl. - (soup_set_ssl_ca_dir): impl. - (soup_set_ssl_cert_files): impl. - - * src/soup-core/soup-openssl.c (soup_openssl_init): Load cert - authority files found in HTTPS_CA_DIR and HTTPS_CA_FILE. - (soup_openssl_get_iochannel): Load certificate found in - HTTPS_CERT_FILE and private key from file in - HTTPS_KEY_FILE. Client certificates thanks to Scott Hutton - (shutton@pobox.com). - -2001-08-24 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-queue.c (soup_queue_connect_cb): Always - regenerate req->priv->req_header. - - * src/soup-core/soup-ntlm.c (soup_ntlm_lanmanager_hash): pass 15 - byte buffer to work around array bounds read by setup_schedule. - - * src/soup-core/soup-message.c (authorize_handler): No need to - free msg->priv->req_header as it is generated on each request now. - (soup_message_set_request_header): Ditto. - - * src/soup-core/soup-auth.c (ntlm_auth): Only return - auth->response one time. Subsequent calls return NULL. - - * src/soup-core/soup-queue.c (soup_encode_http_auth): Check for - NULL auth response. - -2001-08-23 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-auth.c (ntlm_new): Fix under-allocation. - (ntlm_parse): Comment out the NTLM host/domain parsing code, as it - segfaults for some reason. Not that this matters as IIS seems to - competely ignore these parts of the NTLM message :) There is also - some memory corruption in soup-ntlm.c causing segfaults after the - message-finished callback returns. - -2001-08-23 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-auth.c (soup_auth_invalidates_prior): Add - SoupAuth.compare_func and call this from here, to remove hardcoded - auth scheme knowledge. - (soup_auth_new_from_header): Iterate known_auth_schemes looking - for a match with auth scheme supplied, instead of hardcoding known - auth schemes. - -2001-08-23 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-auth.c (soup_auth_invalidates_prior): Take an - old_auth argument, if auth_types do not match always return - TRUE. This allows for a server requested re-auth with a different - auth mechanism. - -2001-08-23 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-ntlm.[ch]: Microsoft NTLM authentication - support compliments of Dan Winship (danw@ximian.com). - - * src/soup-core/Makefile.am (libsoup_la_SOURCES): Add soup-ntlm.[ch] - - * src/soup-core/soup-auth.c (soup_auth_new_from_header): Set auth - context before header parsing. Add NTLM case. Call - auth->parse_func instead of hardcoding. - (soup_auth_invalidates_prior): add NTLM, which should always - invalidate. - (ntlm_new): impl. - (ntlm_free): impl. - (ntlm_parse): impl. Hack to get domain from the uri's authmech - field. - (ntlm_auth): impl. - - * src/soup-core/soup-dav-server.c (get_depth): return 0 for - unknown value. - - * src/soup-core/soup-server.h: Remove SoupServerAnonymousToken and - add SoupServerNTLMToken. - -2001-08-20 Joe Shaw <joe@ximian.com> - - * configure.in: Bump up version to 0.4.4 - * src/soup-core/soup-private.h: Ditto. - - * src/soup-core/soup-auth.c (compute_response, digest_auth_func): - Instead of just passing uri->path, pass - uri->path + '?' + uri->querystring if present. - -2001-08-17 Alex Graveley <alex@ximian.com> - - * build/libsoup.def: Update for DAV methods. - -2001-08-17 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-dav-server.[ch]: Initial WebDAV server - support. - - * src/soup-core/soup-dav.[ch]: Beginnings of WebDAV client - support. - - * configure.in: Add warning about updating - src/soup-core/soup-private.h when version changes. - - * src/soup-core/soup-private.h: Declare SoupAuth here, so - including is possible. - -2001-08-12 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-ssl.c (soup_ssl_get_iochannel): Connect to - HUP signal to avoid indefinate hangs. Remove idle waitpid - handler. Thanks to Chris Toshok for finding this one. - -2001-08-11 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-ssl-proxy.c (main): Fix typo causing - O_NONBLOCK not to be set. - - * src/soup-core/soup-ssl.c (soup_ssl_get_iochannel): Ditto. - -2001-08-10 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-private.h: Include sys/socket.h for sa in - SoupAddress. - -2001-08-08 Alex Graveley <alex@ximian.com> - - * configure.in: Bump version to 0.4.3. - -2001-08-08 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-transfer.c (soup_transfer_read_chunk): - Handle entity headers after chunk body, closes bug #6846. - - * src/soup-core/soup-queue.c (soup_queue_read_done_cb): Fixup comments. - -2001-08-06 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-private.h: Define VERSION to "Win/0.4.2" for - Windows clients. - -2001-08-06 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-transfer.c (soup_transfer_read_cb): Remove - warning used for testing. - (soup_transfer_write_cb): Ditto. - -2001-08-06 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-transfer.c (soup_transfer_read_cb): Read - speedup to read all available data before processing and returning - to the mainloop. - - * src/soup-core/soup-message.h: Add defines for standard DAV methods. - -2001-07-31 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-queue.c (soup_get_request_header): Remove - special case for GET and HEAD when adding content-length header. - -2001-07-30 Alex Graveley <alex@ximian.com> - - * configure.in: Bump version to 0.4.2. - -2001-07-30 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-queue.c (soup_queue_read_headers_cb): - Content-length should be avoided for HEAD requests. - -2001-07-30 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-misc.c (soup_load_config_internal): Fix bug - where only the first valid config token is loaded from the config file. - -2001-07-30 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-socket.c (soup_address_new_cb): Fix dangling - pointer error where a resolved SoupAddress is passed to the callback, - and then realloc'd. - - * src/soup-core/soup-headers.c (soup_headers_parse_response): - Don't require gchar const **status_phrase. - -2001-07-29 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-apache.c (soup_apache_message_create): strdup - response_phrase. - - * src/soup-core/soup-httpd.c (soup_httpd_read_done_cb): Ditto. - - * src/soup-core/soup-message.c (soup_message_free): Free - response_phrase. - - * src/soup-core/soup-context.c (soup_try_existing_connections): - Revert accidental commit. - - * src/soup-core/soup-queue.c (soup_get_request_header): Only - inhibit Content-Length for GET and HEAD if request.length is 0; - (soup_message_queue): Free response_phrase on requeue. - - * src/soup-core/soup-socket.c (soup_address_new): Fix - formatting. - -2001-07-26 Joe Shaw <joe@ximian.com> - - * src/soup-core/soup-queue.c (soup_get_request_header): Don't display - the SOAPAction header if it's either provided by the user or it is - NULL. - -2001-07-26 Joe Shaw <joe@ximian.com> - - * configure.in: Bump the version up to 0.4.1. - - * src/soup-core/soup-queue.c (soup_get_request_header): Fix a logic - error. Send the actual version of Soup with the User-Agent header - instead of always 0.1. - -2001-07-25 Joe Shaw <joe@ximian.com> - - * src/soup-core/soup-socket.c (soup_address_new, - soup_address_get_name): Close a bunch of leaked file descriptors from - piping. - -2001-07-19 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-queue.c (soup_get_request_header): Allow - override of http version. Only include Content-Length if method is - not GET or HEAD. - - * src/soup-core/soup-message.c (soup_message_new): Set default - http_version to SOUP_HTTP_1_1; - (soup_message_set_http_version): Impl. - (soup_message_get_flags): Check for NULL. - - * src/soup-core/soup-private.h: Add http_version to _SoupMessagePrivate. - -2001-07-19 Alex Graveley <alex@ximian.com> - - * configure.in: Bump version to 0.4.0. - -2001-07-19 Alex Graveley <alex@ximian.com> - - * configure.in: Remove -Werror from WSDL_CFLAGS as this ills on so - many redhat distros. Remove unused ISO C99 IEEE754 section. Set - the default to hide more warnings. - - * src/soup-wsdl-runtime/wsdl-typecodes.c: Remove \r from end of - lines. - - * src/soup-wsdl/Makefile.am: Formatting. - * src/soup-wsdl-runtime/Makefile.am: Formatting. - -2001-07-17 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-context.c (soup_context_uri_hash): Add - querysting to hash. - (soup_context_uri_equal): Compare querystring for equality. - - * src/soup-core/soup-transfer.c (soup_transfer_read_error_cb): Add - gross hack to avoid double frees by only freeing the SoupReader - or SoupWriter if we are not currently processing a callback. - (soup_transfer_read_cb): Ditto - (soup_transfer_write_error_cb): Ditto. - (soup_transfer_write_cb): Ditto. - (soup_transfer_read_cancel): Return if currently processing a callback. - (soup_transfer_write_cancel): Ditto. - - * src/soup-core/soup-message.c (soup_message_new): Add - redirect_handler by default. - (soup_message_set_flags): Remove redirect handler when - SOUP_MESSAGE_NO_REDIRECT is set, and add it when it is unset. - - * src/soup-core/soup-message.h: Change SOUP_MESSAGE_FOLLOW_REDIRECT to - SOUP_MESSAGE_NO_REDIRECT, as redirect is on by default now. - -2001-07-16 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-transfer.c (soup_transfer_read_cb): Set len - to 0 before calling callback to handle cases where no content - length is specified. Special thanks goes out to Joe Shaw - (joe@ximian.com) for finding this one. - -2001-07-16 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-private.h: Remove the unused digest_data from - _SoupMessagePrivate. - - * src/soup-core/soup-auth.c: Reorganize into basic-auth, - digest-auth, public interface, and parse routines hopefullly to - make this more readable. - -2001-07-13 Alex Graveley <alex@ximian.com> - - * src/soup-wsdl-runtime/wsdl-typecodes.c: Add windows x86 type - alignment defines. - -2001-07-10 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-uri.h: Replace SOUP_PROTOCOL_SHTTP with - SOUP_PROTOCOL_HTTPS. - * src/soup-core/soup-context.c (soup_connection_get_iochannel): Ditto. - * src/soup-core/soup-httpd.c (soup_httpd_conn_accept): Ditto. - -2001-07-09 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-socket.c (soup_socket_server_new): Typo to go - to SETUP_ERROR on error. - -2001-07-09 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-uri.c (soup_uri_get_protocol): Use - g_strncasecmp. - - * src/soup-core/soup-transfer.c (soup_transfer_write_cb): ifdef - wrap all references to SIGPIPE. - - * src/soup-core/soup-ssl.c: ifdef wrap sys/wait.h and sys/socket.h. - (soup_ssl_get_iochannel): Do nothing if on windows. - - * src/soup-core/soup-socket.c: Various never-before compiled - windows cleanups. - - * src/soup-core/soup-misc.c (soup_load_config): ifdef wrap - SYSCONFDIR souprc loading. - - * src/soup-core/soup-context.c: ifdef wrap sys/socket.h - (soup_connection_setup_socket): Do nothing if on windows. - - * src/soup-core/soup-auth.c: If on windows include <process.h> for - getpid(). - - * configure.in: Add checks for sys/sockio.h and sys/wait.h - -2001-07-09 Alex Graveley <alex@ximian.com> - - * build/Soup_core.dsp - build/Soup_wsdl_runtime.dsp - build/Soup_wsdl.dsp: Use unique Debug output directory. - -2001-07-09 Alex Graveley <alex@ximian.com> - - * build/Soup.dsw - build/Soup_apache.dsp - build/Soup_core.dsp - build/Soup_httpd.dsp - build/Soup_ssl_proxy.dsp - build/Soup_wsdl.dsp - build/Soup_wsdl_runtime.dsp: Initial run of windows build scripts. - -2001-07-09 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-auth.[ch]: New client authentication (basic/digest) - code from Joe Shaw (joe@ximian.com). - - * src/soup-core/soup-queue.c (soup_encode_http_auth): Updated to - use soup-auth. - (soup_get_request_header): Pass the SoupMessage to - soup_encode_http_auth instead of just the URI. Check for - req->action in header creation. - (soup_queue_error_cb): Reset read_tag and write_tag to avoid - double free. - (soup_encode_http_auth): Use soup_auth_authorize(). - - * src/soup-core/soup-private.h: Add SoupAuth to SoupContext. - - * src/soup-core/soup-context.c (soup_context_unref): Free auth. - - * src/soup-core/soup-cgi.c: Flog. - - * src/soup-core/soup-message.c (soup_message_new): Create handlers - for 401 (Authorization Required) and 407 (Proxy-Authorization - Required) response codes. - (soup_message_redirect): Rename to redirect_handler. - (redirect_handler): Don't unref existing context if new context - creation fails. - (soup_message_set_header): Check for value before insertion. - - * src/soup-core/soup-transfer.c (soup_transfer_read_cancel): Free - recv_buf contents if no callback has been issued. - (soup_transfer_read_cb): Set callback_issued. - -2001-07-05 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-socks.c (soup_connect_socks_proxy): Use const uris. - - * src/soup-core/soup-queue.c (soup_encode_http_auth): Make uri const. - - * src/soup-core/soup-context.[ch] (soup_context_get_uri): Return a - const SoupUri. - - * src/soup-core/soup-digest.c (soup_digest_md5_finalize): Make - compile. - -2001-07-02 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-digest.c: Formatting fixes. - (digest_md5_challenge): Use string auth_header instead of - GByteArray for token. - (soup_digest_challenge): Free response GByteArray after adding - Authorization header. - -2001-07-02 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-private.h: Remove _SoupMessagePrivate bits - covered by soup-transfer. - - * src/soup-core/soup-queue.c: Use soup-transfer. - (soup_queue_error_cb): Remove handling of buggy MS IIS server - tranferring partial content then closing connection. Report this - as SOUP_ERROR_IO instead. - - * src/soup-core/soup-httpd.c: Use soup-transfer. - - * src/soup-core/soup-transfer.[ch]: Added. HTTP Transport - abstraction used to clean up client and standalone/cgi server code - duplication. - - * configure.in: Bump version to 0.3. - - * src/soup-core/soup-queue.c (soup_check_used_headers): Use - toupper in switch instead of upper/lower cases for each. - - * src/soup-core/soup-httpd.c: Declare apache dummy method - implementations to avoid warnings. - -2001-06-27 Joe Shaw <joe@ximian.com> - - * src/soup-core/soup-digest.c: Largely gutted. Made RFC 2617 - compliant. Removed RFC 2831 compliance. - (soup_digest_challenge): Implemented. - -2001-06-21 Joe Shaw <joe@ximian.com> - - * src/soup-core/soup-message.c (soup_message_new): Do a - g_return_val_if_fail() on the SoupContext being passed in so we don't - generate a bad SoupMessage. - -2001-06-19 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-context.c (soup_context_from_uri): Use - soup_context_uri_hash and soup_context_uri_equal for matching - existing server contexts instead of just matching on path. - (soup_context_uri_hash): Added. Returns a hash of the user, authmech, - password, and path of a given SoupUri. - (soup_context_uri_equal): Added. Returns TRUE if the user, authmech, - password, and path of a two SoupUris match. - -2001-06-15 Alex Graveley <alex@ximian.com> - - * configure.in: add check for unistd.h - - * src/soup-core/soup-apache.c, - src/soup-core/soup-cgi.c, - src/soup-core/soup-context.c, - src/soup-core/soup-digest.c, - src/soup-core/soup-nss.c, - src/soup-core/soup-openssl.c, - src/soup-core/soup-private.h, - src/soup-core/soup-queue.c, - src/soup-core/soup-server.c, - src/soup-core/soup-ssl-proxy.c, - src/soup-core/soup-ssl.c. - src/soup-wsdl-runtime/wsdl-typecodes.c: #ifdef protect config.h - and unistd.h inclusion. - -2001-06-15 Dick Porter <dick@ximian.com> - - * src/soup-wsdl-runtime/wsdl-schema.h: - * src/soup-wsdl-runtime/wsdl-schema.c: - * src/soup-wsdl-runtime/wsdl-schema-glib.h: - * src/soup-wsdl-runtime/wsdl-schema-glib.c: - * src/soup-wsdl/wsdl-parse.c: - * src/soup-core/soup-serializer.c: - * src/soup-core/soup-parser.c: replace 'childs' with - 'xmlChildrenNode', 'root' with 'xmlRootNode' and 'CHAR' with - 'xmlChar' for compatibility with both libxml1 and libxml2 - - * configure.in: Check for either libxml1 or libxml2, favouring - libxml1 but selectable with --with-libxml=[1,2] - -2001-06-14 Joe Shaw <joe@ximian.com> - - * src/soup-core/soup-misc.c (soup_set_proxy): If we're passing in - NULL (to reset the proxy), don't try to soup_context_ref() it. - -2001-06-14 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-queue.c (soup_read_chunk): Don't start from - header_len offset. - (soup_finish_read): Don't copy the recv_buf, just reference - it. Don't free recv_buf. - (soup_queue_read_cb): Handle truncating chunks, also truncate - recv_buf after finishing headers. Make recv_buf contents public - for chunk handlers. - - * src/soup-core/soup-message.c (soup_message_cleanup): Don't free - the recv_buf->data, as we no longer copy it. - - * src/soup-core/soup-httpd.c: Update to missing header_len field. - - * src/soup-core/soup-private.h: change SoupMessage.header_len to a - boolean headers_done. As we now truncate the buffer after - downloading headers. - -2001-06-14 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-message.c (soup_message_set_flags): Remove - redirect handler if option is removed. - (soup_message_remove_handler): Added. Remove handler given - function and user_data. Should this be made public? - (soup_message_run_handlers): Remove g_warning. No checks are run - against body handlers. - (soup_message_cleanup): Zero cur_chunk_len and cur_chunk_idx. - -2001-06-13 Joe Shaw <joe@ximian.com> - - * src/soup-core/soup-socket.c (soup_address_new): If SOUP_SYNC_DNS is - in the user's environment, use an old fashioned synchronous DNS lookup - on UNIX. - -2001-06-07 Joe Shaw <joe@ximian.com> - - * src/soup-core/soup-message.c (soup_message_redirect): Change - msg->priv->flags to msg->priv->msg_flags so it'll build again. - (soup_message_run_handlers): Add a default case to the switch - statement (for RESPONSE_BODY_HANDLER) to squash a warning. - -2001-06-07 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-message.c (soup_message_run_handlers): Stop - processing if a handler requeues the message. - - * src/soup-core/soup-queue.c (soup_process_headers): Allow a - handler to requeue the message without having any more handlers or - callbacks called. - (soup_finish_read): ditto. - (soup_queue_read_cb): ditto. - - * src/soup-core/soup-message.c (soup_message_redirect): Requeue - message based on Location header, if response status code is 300, - 301, 302, 303, or 305. - (soup_message_set_flags): If SOUP_MESSAGE_FOLLOW_REDIRECT is set, - add a header handler (on Location) which calls - soup_message_redirect (). - -2001-06-06 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-message.c (soup_message_add_header_handler): - implement. - (soup_message_add_response_code_handler): ditto. - (soup_message_add_body_handler): ditto. - (soup_message_run_handlers): uh-huh. - (soup_message_free): Free allocated handler info. - - * src/soup-core/soup-message.h: Change SOUP_MESSAGE_PROCESS_CHUNKS - to SOUP_MESSAGE_OVERWRITE_CHUNKS. This will allow large files to - be processed using a BODY_CHUNK handler, instead of keeping - everything in memory. - - * src/soup-core/soup-queue.c (soup_process_headers): Run PRE_BODY - handlers. - (soup_finish_read): Run POST_BODY handlers. - (soup_queue_read_cb): Run BODY_CHUNK handlers. - -2001-06-06 Joe Shaw <joe@ximian.com> - - * src/soup-core/soup-message.c (soup_message_set_method, - soup_message_get_method): Implement. Sets the HTTP method for a given - message. - (soup_message_new): Set the default method to SOUP_METHOD_POST. - - * src/soup-core/soup-misc.c (soup_substring_index): Make sure we - check the very last possible character (<= instead of <) for substrings. - - * src/soup-core/soup-queue.c (soup_get_request_header): Send an HTTP - request for the method set in the message instead of always POST. - - * src/soup-core/soup-parser.c: Change the #include to <parser.h> from - <gnome-xml/parser.h>. - - * src/soup-core/soup-serializer.h: Change the #include to <tree.h> from - <gnome-xml/tree.h>. - -2001-06-04 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-httpd.c: (ap_*) Add these empty Apache method - implementations so soup modules built using soup-apache can be - loaded into soup-http. - (main): Pass a SoupHttpdServerSock object representing a listening - server to soup_httpd_conn_accept. - (soup_httpd_finish_read): Return useful error explanations to - client when no SOAPAction header is specified, or no server handler for - the specified SOAPAction is found. - (soup_httpd_message_construct): Lookup content-length - correctly. Free req_method and req_path. - - * src/soup-core/soup-message.c (soup_message_set_header): if - overwriting an existing header, be sure - to free the old key and value. - - * src/soup-core/soup-queue.c (soup_queue_read_async): rename to - (soup_queue_read_cb): this. - (soup_queue_error_async): rename to - (soup_queue_error_cb): this. - (soup_queue_write_async): rename to - (soup_queue_write_cb): this. - (soup_queue_connect): rename to - (soup_queue_connect_cb): this. - -2001-06-04 Dick Porter <dick@ximian.com> - - * src/soup-wsdl-runtime/wsdl-schema.c: A new error message - mechanism for reporting schema parse errors to the calling code - - * src/soup-wsdl-runtime/wsdl-schema-glib.c - (wsdl_schema_glib_parse_struct, wsdl_schema_glib_start_element, - wsdl_schema_glib_end_element): Use new error message mechanism - - * src/soup-wsdl/wsdl-parse.c (wsdl_parse_warning, - wsdl_parse_error, wsdl_parse_fatal): Log messages via wsdl_debug, - so the module selection works - -2001-06-01 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-misc.c: Correctly note copyright for - soup_base64_encode() to the FSF, and credit Chris Blizzard as the - actual author. - -2001-06-01 Alex Graveley <alex@ximian.com> - - * src/soup-core/Makefile.am (libsoup_la_SOURCES): Take soup-cgi.c - out of rotation until server/client codepaths merge. - - * src/soup-core/soup-httpd.c (soup_httpd_finish_read): Don't span - mulptiple lines for content-type header. - -2001-06-01 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-queue.c (soup_check_used_headers): Only mark - which custom headers are used, and directly g_string_sprintfa() - the custom header. - (soup_get_request_header): Soptimize header writing. - -2001-06-01 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-message.c (soup_message_set_method): - (soup_message_add_header_handler): - (soup_message_add_response_code_handler): - (soup_message_add_body_handler): Added. - - * src/soup-core/soup-socket.c (soup_address_get_name_sync): Allow - syncronous reverse name lookups. - - * TODO (TODO): Updated. - - * src/soup-core/Makefile.am (bin_PROGRAMS): Added soup-httpd. - - * src/soup-core/soup-httpd.c: Added. Simple httpd server - implementation. This shares a *lot* of code with soup-queue.c, so - some hardc0re refactoring action is planned. - - * configure.in (GMODULE_LIBS): Added. - -2001-05-29 Dick Porter <dick@ximian.com> - - * tests/Makefile.am: Put the generated code into the build - directory. Run soup-config through /bin/sh to work around a - permissions problem. - -2001-05-25 Dick Porter <dick@ximian.com> - - * Documentation - -2001-05-25 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-queue.c (soup_message_queue): No need to free - priv->recv_buf as it is now done in soup_message_cleanup(). - (soup_message_queue): Free response_header keys and values before - destroying the hash table. - - * src/soup-core/soup-message.c (soup_message_free): Don't free - priv->recv_buf here. - (soup_message_cleanup): Free priv->recv_buf here instead. - - * src/soup-core/soup-queue.c (soup_finish_read): Since we now - g_strdup() all headers, and we already g_memdup the actual body - buffer, free the temporary recv_buf. - - * src/soup-core/soup-headers.c (soup_headers_parse_response): - g_strdup() the response reason phrase. - -2001-05-24 Alex Graveley <alex@ximian.com> - - * README: Update Licensing section for soup-ssl-proxy. - -2001-05-24 Larry Ewing <lewing@ximian.com> - - * src/soup-wsdl-runtime/wsdl-soap-parse.c: include string.h for - strlen and strcmp prototypes. - * src/soup-wsdl-runtime/wsdl-soap-memory.c: include string.h for - memset prototype. - -2001-05-23 Dick Porter <dick@ximian.com> - - * src/soup-wsdl-runtime/wsdl-typecodes-c.c - (wsdl_typecode_write_c_mm_list): - * src/soup-wsdl-runtime/wsdl-soap-parse.c - (wsdl_soap_set_list_param): - * src/soup-wsdl-runtime/wsdl-soap-marshal.c - (wsdl_soap_marshal_list_param): Eliminate the extra layer of - indirection for list items that are naturally pointers. - - * tests/test-wsdl-runtime.c: Update list tests - - * src/soup-wsdl-runtime/wsdl-typecodes.c: - * src/soup-wsdl-runtime/wsdl-schema.c: - * src/soup-wsdl/wsdl-trace.c: - * src/soup-wsdl/wsdl-soap-emit.c: - * src/soup-wsdl/wsdl-parse.c: - * src/soup-wsdl/wsdl-describe.c: - * docs/reference/soup-sections.txt: Started documenting the code - -2001-05-22 Alex Graveley <alex@ximian.com> - - * RELEASE (ANNOUNCE): Added. All release announcements should be - prepended here. - -2001-05-22 JP Rosevear <jpr@ximian.com> - - * src/soup-core/soup-apache.c (soup_apache_read_request): null - terminate the buffer - -2001-05-22 Rodrigo Moya <rodrigo@ximian.com> - - * src/soup-wsdl/wsdl-soap-parse.c: don't emit code to add the - transport headers to the SoupEnv, which is only used for SOAP - request/response headers - * src/soup-core/soup-env.c (soup_env_set_response_header): - g_strdup the hash table key also - (soup_env_set_request_header): ditto - -2001-05-21 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-queue.c (soup_message_queue): gtk-doc fixups. - - * src/soup-core/soup-socket.c (soup_socket_server_new): New. - (soup_socket_server_accept): New. - (soup_socket_server_try_accept): New. - -2001-05-18 Rodrigo Moya <rodrigo@ximian.com> - - * src/soup-wsdl-runtime/wsdl-soap-parse.c (wsdl_soap_headers): - use the correct XML node to get the headers - -2001-05-18 Alex Graveley <alex@ximian.com> - - * README: "Subscribe" not "Subject" in - soup-list-request@ximian.com message body. :) - -2001-05-18 Alex Graveley <alex@ximian.com> - - * docs/reference/soup-docs.sgml: Prune soup-core internal files. - - * configure.in: Add pretty section headers, move gtk-doc section - -2001-05-17 JP Rosevear <jpr@ximian.com> - - * src/soup-wsdl/wsdl-soap-skels.c - (wsdl_emit_soap_skels_binding_operation): do not free the callback - data, or the second time the method gets called, *KABOOM* - -2001-05-17 JP Rosevear <jpr@ximian.com> - - * src/soup-wsdl-runtime/wsdl-soap-parse.c (wsdl_soap_operation): - prevent leak and check for fault straight away (instead of - operation name) - - * src/soup-core/soup-env.c (soup_env_free): only free the fault if - there is one - (soup_env_clear_fault): ditto - - * src/soup-wsdl-runtime/wsdl-soap-marshal.c (wsdl_soap_marshal): - use the serializer functions to write out the fault and only write - the message return if there is no fault - -2001-05-17 JP Rosevear <jpr@ximian.com> - - * src/soup-core/soup-headers.c (soup_headers_parse): find the end - of the value and g_strndup only that as the value, rather than the - remainder of the string - - * src/soup-core/soup-message.c (soup_message_issue_callback): free - the message only if the callback exists, otherwise send_message is - borked. New a little more design to fix properly - -2001-05-17 Dick Porter <dick@ximian.com> - - * Fixed all gtk-doc moans in soup-core documentation - - * docs/reference: Extract gtk-doc documentation from the code - - * tests/test-wsdl-runtime.c: - * tests/stockquote2-server.c: - * tests/stockquote2-client.c: Updated for new API - - * tests/stress-test.c: - * tests/simple-test.c: Include installed soup headers - - * configure.in: Check for gtk-doc - - * tests/Makefile.am: Made example code just plain - "noinst_PROGRAMS", check_PROGRAMS are built as part of "make - dist". Wrestled with automake, automake won :-( I wanted to delete - the built sources from the dist target, and not have automake try - and recreate them with a non-existant soup-wsdl when I type "make - distcheck". - - * Makefile.am: Took tests out of SUBDIRS, added a "make examples" - target instead. - -2001-05-16 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-serializer.c: Document. Needs more details - and descriptions from the SOAP spec. - - * src/soup-core/soup-queue.c: Document. - - * src/soup-core/soup-misc.c: Document. - (soup_load_config): Reset security policy to - SOUP_SECURITY_DOMESTIC when reloading config. - - * src/soup-core/soup-message.c: Document. - -2001-05-16 JP Rosevear <jpr@ximian.com> - - * src/soup-core/soup-headers.c (soup_headers_parse): g_strdup the - response headers when adding them to the hash - - * src/soup-core/soup-context.c (soup_context_get): ditto - - * src/soup-core/soup-context.h: constify uri passed to - soup_context_get - - * src/soup-core/soup-env.h (soup_env_free): new protos - - * src/soup-core/soup-env.c (soup_env_set_address): new accessor to - set url to access for service - (soup_env_get_address): ditto - -2001-05-16 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-apache.c (soup_apache_add_header_from_table): - g_strdup headers from the apache headers table. - -2001-05-16 JP Rosevear <jpr@ximian.com> - - * tests/simple-test.c (main): change this to something sensible - -2001-05-16 Rodrigo Moya <rodrigo@ximian.com> - - * src/soup-wsdl/wsdl-soap-stubs.c: fully adapted to the new - SoupEnv stuff - -2001-05-16 Dick Porter <dick@ximian.com> - - * tests/test-wsdl-runtime.c: Bring up-to-date with new API, and - test typecode freeing too. - - * tests/stockquote2-server.c: - * tests/stockquote2-client.c: Bring up-to-date with new API - - * src/soup-wsdl-runtime/wsdl-soap-memory.c: New file of functions - to zero or free a set of types. - - * src/soup-wsdl-runtime/wsdl-typecodes.c - (wsdl_typecode_param_type): Handle adding '*' to certain types - when written as parameters. - - * src/soup-wsdl-runtime/wsdl-typecodes-c.c: Add pointers to memory - free functions to typecode structs. - New functions to write those memory free functions. - - * src/soup-wsdl-runtime/wsdl-soap-parse.c - (wsdl_soap_set_struct_param): Allocate memory for structs - (wsdl_soap_parse): Use the new function in wsdl-soap-memory.c to - zero the parameters. - - * src/soup-wsdl-runtime/wsdl-soap-marshal.c - (wsdl_soap_marshal_struct_param): Structs are now passed as - pointers, so need to add extra indirection here. - (wsdl_soap_marshal_param): Make sure we dont try to marshal NULL - pointers - - * src/soup-wsdl/wsdl-soap-skels.c - (wsdl_emit_soap_skels_binding_operation): Zero output args before - calling the callback, and free any memory used by them after - sending the response. - - * src/soup-wsdl/wsdl-soap-headers.c - (wsdl_emit_soap_headers_binding_operation): Server callback now - returns 'void' - (wsdl_emit_soap_header_mm): Write memory-management function - prototypes - - * src/soup-wsdl/wsdl-soap-emit.c (wsdl_emit_part): Use new - parameter-passing API - - * src/soup-wsdl/wsdl-soap-common.c (wsdl_emit_soap_common_mm): - Cause memory-management routines to be written for all - user-defined types - -2001-05-15 JP Rosevear <jpr@ximian.com> - - * src/soup-wsdl/wsdl-soap-skels.c - (wsdl_emit_soap_skels_binding_operation): soup_env_new needed "()" - to be a function call - - * src/soup-core/soup.h: explicitly include soup-fault.h and soup-env.h - - * src/soup-wsdl-runtime/wsdl-soap-marshal.h: kludge soup-env.h as - well. We really should rename the dirs properly - - * src/soup-wsdl-runtime/wsdl-soap-parse.h: kludge around include - problem - -2001-05-15 Rodrigo Moya <rodrigo@ximian.com> - - * src/soup-wsdl/wsdl-soap-stubs.c: replace all SoupFault - parameter with SoupEnv, and remove "GHashTable request_headers" - from list of parameters in server callbacks, because before - calling those callbacks, the stubs take care of adding the - SoupMessage's request headers to the SoupEnv being passed - * src/soup-wsdl-runtime/wsdl-soap-parse.c - (wsdl_soap_parse): replace SoupFault with the new - SoupEnv parameter - (wsdl_soap_headers): new internal function to parse all - the headers in the SOAP message and add them to the SoupEnv - * src/soup-wsdl-runtime/wsdl-soap-marshal.c - (wsdl_soap_marshal): don't access directly SoupFault - struct members. - Replace SoupFault parameter with the new SoupEnv - * src/soup-core/soup-env.c - (soup_env_get_request_header_list): new function - (soup_env_get_response_header_list): new function - (soup_env_set_fault): new function to associate a SoupFault - with a SoupEnv - -2001-05-13 Rodrigo Moya <rodrigo@ximian.com> - - * src/soup-core/soup-fault.[ch]: made the SoupFault structure - private, and add accessor functions for the struct members - * src/soup-core/soup-env.[ch]: added SoupEnv stuff, to easily - manage SOAP environments (request/response headers list, faults) - -2001-05-12 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-message.c (soup_message_set_request_header): - g_strdup name and value. - (soup_message_set_response_header): ditto. - (soup_message_get_response_header): implement. - (soup_message_get_request_header): implement. - -2001-05-12 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-fault.[ch]: Format cleanups. - - * src/soup-core/soup-parser.[ch]: Ditto. - -2001-05-12 Rodrigo Moya <rodrigo@ximian.com> - - * src/soup-core/soup-fault.[ch]: moved the SoupFault to its - own header file, since it will be also used by the upcoming - SoupEnv - -2001-05-11 Alex Graveley <alex@ximian.com> - - * tests/stress-test.c (current_temp_cb): handle - SOUP_ERROR_CANT_AUTHENTICATE. - - * tests/simple-test.c (current_temp_cb): handle - SOUP_ERROR_CANT_AUTHENTICATE. - -2001-05-11 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-nss.c (soup_nss_init): Use NSS_InitReadWrite(). - (soup_nss_get_iochannel): set SSL_BadCertHook(). - -2001-05-10 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-queue.c (soup_finish_read): set - response.owner to SOUP_BUFFER_SYSTEM_OWNED. - - * src/soup-core/soup-uri.c (soup_uri_copy): added. - - * src/soup-core/soup-context.c (soup_context_get): Free the - temporary URI. - (soup_context_from_uri): dup the passed uri if creating a new context. - -2001-05-09 JP Rosevear <jpr@ximian.com> - - * src/soup-wsdl/wsdl-soap-skels.c - (wsdl_emit_soap_skels_binding_operation): indent the SoupFault - parameter when written to the skels - -2001-05-09 Dick Porter <dick@ximian.com> - - * src/soup-wsdl-runtime/wsdl-typecodes.c: Put the glib namespace - prefix back into the typecode struct names - (wsdl_typecode_type): Return a namespace-prefixed type name for - struct and element types - (wsdl_typecode_lookup): Look up typecodes by namespace - - * src/soup-wsdl-runtime/wsdl-typecodes-c.c: Typecode struct names - include namespace prefixes - - * src/soup-wsdl-runtime/wsdl-schema-glib.c - (wsdl_schema_glib_parse_struct): Typecodes now have namespaces - associated with them. - - * src/soup-wsdl/wsdl-soap-headers.c: Deleted all the list - callbacks that printed variations on a parameter theme, call - wsdl_emit_part_list instead. - (wsdl_emit_soap_headers_binding_operation): Don't add a namespace - part for every level of WSDL indirection. - * src/soup-wsdl/wsdl-soap-stubs.c: ditto - * src/soup-wsdl/wsdl-soap-skels.c: ditto - - * src/soup-wsdl/wsdl-soap-emit.c: New file of C code emitting helper - functions. - - * src/soup-wsdl/wsdl-parse.c (wsdl_parse_message_part_attrs): Look - up typecodes by namespace - (wsdl_start_element): Pass more XML info to the schema parser - - * src/soup-core/soup-parser.h: include file wasn't on the search - path at compile time - -2001-05-09 Rodrigo Moya <rodrigo@ximian.com> - - * src/soup-core/soup-parser.c: retrieve info about faults - when parsing the SOAP messages - * src/soup-wsdl/wsdl-soap-stubs.c: use 'fault' and not - '&fault' in call to wsdl_soap_parse - * src/soup-wsdl/: some small fixes for compilation - * src/soup-core/soup-parser.[ch]: added a basic SOAP messages - parser, which easily lets access to the message parameters - and faults - -2001-05-05 Rodrigo Moya <rodrigo@ximian.com> - - * src/soup-wsdl-runtime/wsdl-soap-fault.[ch]: added to manage/retrieve - info from SOAP faults - * src/soup-wsdl-runtime/wsdl-soap-parse.c (wsdl_soap_parse): retrieve - SOAP faults from the message being parsed. Added a wsdl_soap_fault - parameter, which will be returned if there was actually a SOAP fault - in the message - * src/soup-wsdl-runtime/wsdl-soap-marshal.c (wsdl_soap_marhal): add - a wsdl_soap_fault parameter, to be serialized along with the rest - of the SOAP message - * src/soup-wsdl/wsdl-soap-skels.c: use wsdl_soap_fault where appropriate - * src/soup-wsdl/wsdl-soap-stubs.c: ditto - * src/soup-wsdl/wsdl-soap-headers.c: ditto - -2001-05-04 Dick Porter <dick@ximian.com> - - * src/soup-wsdl-runtime/wsdl-schema.c: Decide which schema parser to - call for a WSDL <types> section. This supercedes the old glib schema - parser in wsdl-parse.c. The WSDL parser is now effectively decoupled - from the schema, which should make it much easier to add new schemas - in the future without having to change the parser. - - * src/soup-wsdl-runtime/wsdl-schema-glib.c: Build typecodes from - the simple glib schema - - * src/soup-wsdl-runtime/wsdl-typecodes-c.c: Write C code - describing a typecode. - - * src/soup-wsdl-runtime/wsdl-soap-parse.c: - * src/soup-wsdl-runtime/wsdl-soap-marshal.c: - * src/soup-wsdl-runtime/wsdl-param.h: Take all instances of 'glib' out - of typecode definitions and function names. - - * src/soup-wsdl-runtime/Makefile.am: Build a version of the - runtime library more useful for writing C code (ideally i'd make - this dynamically link the runtime library, but libtool wont let - me) - - * src/soup-wsdl/wsdl-thread.c (wsdl_thread_soap_parts): No need to - look up glib types, the message part already holds a pointer to - the typecode. - - * src/soup-wsdl/wsdl-soap-stubs.c: - * src/soup-wsdl/wsdl-soap-skels.c: Type names are looked up by - typecode. All checks for custom glib types have been deleted. - - * src/soup-wsdl/wsdl-soap-headers.c: All typecode declarations are - now printed using the runtime library. Type names are looked up - by typecode. All checks for custom glib types have been deleted. - - * src/soup-wsdl/wsdl-soap-common.c: All typecode printing is now - done using the runtime library. - - * src/soup-wsdl/wsdl-parse.c: Moved wsdl_qnamecmp() and - wsdl_attrnscmp to wsdl-schema.c (in the runtime library) - (wsdl_parse_message_part_attrs): Look up typecodes, not glib types. - (wsdl_parse_types): Call through the runtime schema parser, instead - of the custom glib type parser. - - * src/soup-wsdl/wsdl-memory.c (wsdl_free_types): Delete typecodes - rather than glib types. - - * src/soup-wsdl/wsdl-describe.c: Replace the type printing - routines with calls to wsdl_typecode_print - - * src/soup-wsdl/main.c (main): No need to initialise the glib - types any more. - - * src/soup-wsdl/Makefile.am (soup_wsdl_SOURCES): Don't bother to - compile wsdl-types-glib.c, it's been superceded by the typecode - builder - -2001-05-02 Dick Porter <dick@ximian.com> - - * src/soup-wsdl/wsdl-soap-stubs.c - (wsdl_emit_soap_stubs_binding_operation): Write synchronous client - stubs - - * src/soup-wsdl/wsdl-soap-headers.c - (wsdl_emit_soap_headers_binding_operation): Emit prototypes for - synchronous stubs - - * src/soup-wsdl/wsdl-soap-skels.c - (wsdl_emit_soap_skels_binding_operation): Write server skels - - * src/soup-wsdl/wsdl-soap-headers.c - (wsdl_emit_soap_headers_binding_operation): Emit prototypes for - skels - (wsdl_emit_soap_headers): Include the right soup headers - - * src/soup-wsdl/wsdl-soap-stubs.c (wsdl_emit_soap_stubs): Include - the right soup headers - - * src/soup-wsdl-runtime/Makefile.am (INCLUDES): - * src/soup-wsdl-runtime/wsdl-soap-marshal.h: A kludge to work - around include path searching whether compiling or at runtime - -2001-04-30 Dick Porter <dick@ximian.com> - - * src/soup-wsdl/wsdl-soap-stubs.c: Use the new marshaller instead - of a large printf. Drastically reduced the complexity of both the - wsdl compiler code and the generated stubs. Deleted huge tracts of - now-unused code too. - - * src/soup-wsdl/wsdl-types-glib.c: Deleted unused code - -2001-04-29 Dick Porter <dick@ximian.com> - - * src/soup-wsdl-runtime/wsdl-soap-parse.c - (wsdl_soap_set_simple_param): Some more error checking. Read - booleans as "true", "false", "yes", "no" as well as an integer. - (wsdl_soap_set_param): Give the XML child node to - wsdl_soap_set_list_param(). - - * src/soup-wsdl-runtime/wsdl-soap-marshal.c: A typecode based soap - marshaller - - * src/soup-wsdl-runtime/wsdl-param.h: Moved definition of wsdl_param - into a common header - - * tests/test-wsdl-runtime.c: Added marshal test - - * src/soup-core/soup-serializer.c (soup_serializer_write_time): - Changed name of "time" parameter to not conflict with time(2) - -2001-04-25 JP Rosevear <jpr@ximian.com> - - * soup-config.in (lib_soup): get this script working again and add - wsdl - - * Makefile.am: create and install new script - - * configure.in: create variables for script substitution - - * soup_wsdlConf.sh.in: gnome-config script for wsdl compilation - info - -2001-04-23 Rodrigo Moya <rodrigo@ximian.com> - - * src/soup-wsdl/wsdl-soap-headers.c - (wsdl_emit_soap_headers_binding_operation): added - "gpointer user_data" parameter to generated functions - * src/soup-wsdl/wsdl-soap-stubs.c - (wsdl_emit_soap_stubs_binding_operation): ditto & - make use of a private structure to be able to pass both - the user callback and a custom parameter to SOUP-generated - callback - -2001-04-23 Dick Porter <dick@ximian.com> - - * src/soup-wsdl-runtime/wsdl-typecodes-glib.c: Typecode support - for the simple glib schema, similar in style to CORBA typecodes. - The alignment and size routines are based on the ones in ORBit. - - * src/soup-wsdl-runtime/wsdl-soap-parse.c: A parser that walks an - XML document, and writes values into memory locations provided - - * tests/test-wsdl-runtime.c: Test the typecode support and parser - - * src/soup-wsdl/wsdl-soap-stubs.c (wsdl_emit_soap_stubs_params): - Write a list of parameter to typecode bindings for the soap - document parser - - * src/soup-wsdl/wsdl-soap-headers.c: Write extern prototypes for - typecode definitions - - * src/soup-wsdl/wsdl-soap-common.c: Write typecode definitions - into a common code file - - * src/Makefile.am: Build new soup-wsdl-runtime directory before - soup-wsdl - - * configure.in: Added test to discover alignments - - * acconfig.h: Added defines for alignments - -2001-04-23 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-socket.h: SoupSocketConnectFn no longer takes - a SoupAddress argument, as it can be fetched from the SoupSocket - correctly now. - - * src/soup-core/soup-socket.c: lots of rewrites. Cache existing - SoupAddresses to avoid duplicate lookups. Handles multiple - simultaneous requests for the same address. Add syncronous - versions of calls which just run the main loop until completion or - request. Make SoupContext use a SoupAddress instead of sockaddr. - - * src/soup-core/soup-uri.h: Add query_elems to SoupUri. Contains a - list of query string elements, as delimited by a - '&'. SoupUri.protocol is now a SoupProtocol. - - * src/soup-core/soup-uri.c (soup_uri_new): convert uri_string - protocol to SoupProtocol equivalent. - - * src/soup-core/soup-private.h: remove protocol from - SoupContext. Use a SoupAddress instead of a sockaddr in SoupSocket. - - * src/soup-core/soup-misc.c (soup_load_config_internal): kill - tiny (8 byte) mem leak. - - * src/soup-core/soup-message.h: add SoupOwnership - SOUP_BUFFER_STATIC. - add SoupErrorCode SOUP_ERROR_CANT_AUTHENTICATE. - - * src/soup-core/soup-context.h: move SoupProtocol to soup-uri.h. - - * src/soup-core/soup-context.c (soup_context_new): - removed. Protocol is now held only in uri. - (soup_context_from_uri): added. - (soup_context_get): just calls soup_context_from_uri() after - creating uri. - (soup_context_unref): don't evaluate a post-decremented refcount. - (soup_context_connect_cb): no longer take a SoupAddress arg. - (soup_context_get_protocol): removed, use uri. - - * src/soup-core/soup-apache.c (soup_apache_message_create): use - SOUP_BUFFER_STATIC for request buffer. - - * src/soup-core/md5-utils.c: initial commit. MD5 encryption. - - * src/soup-core/soup-digest.c: initial commit. no worky. - - * src/soup-core/Makefile.am (libsoup_la_SOURCES): add md5-utils.h, - md5-utils.c, soup-digest.h, soup-digest.c. - - * tests/stress-test.c (main): handle ugly refcount bug causing - extra unrefs of the context. - -2001-04-18 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-server.h: Added SoupServerBasicToken, - SoupServerDigestToken, SoupServerAnonymousToken structs, all with - a SoupServerAuthType as the first element. Added - SoupServerAuthToken which is a union of all three auth types. - - * src/soup-core/soup-server.c (soup_server_register_full): - Added. Accept method authentication callback and allowed auth types. - - * src/soup-core/soup-apache.c (soup_apache_handler): Use a - SoupServerAuthToken. Log to apache only in error conditions. - - * src/soup-core/soup-server.c (soup_server_authorize): Accept a - SoupServerAuthToken instead of username/pass/realm. - -2001-04-04 Rodrigo Moya <rodrigo@ximian.com> - - * src/soup-wsdl/wsdl-soap-stubs.c (wsdl_emit_soap_stubs): - #include <soup/soup-*> and not soup-* - * src/soup-wsdl/wsdl-soap-headers.c (wsdl_emit_soap_headers): - #include <soup/soup-message.h> and not soup-message.h, to match - with the output given by `gnome-config --cflags soup` - -2001-03-30 Dick Porter <dick@ximian.com> - - * src/soup-wsdl/wsdl-types-glib.c, - src/soup-wsdl/wsdl-soap-headers.c, - src/soup-wsdl/wsdl-soap-stubs.c: Rewrote much of the glib schema - code to handle structs with child structs, and lists. - - * src/soup-wsdl/wsdl-thread.c (wsdl_thread_soap_parts): treat - message part "type" and "element" attributes as the same. - (wsdl_thread_soap_binding_operation): insist that soap:body elements - exist in operations. - - * src/soup-wsdl/wsdl-parse.c (wsdl_parse_types): Moved more glib - schema logic to wsdl-types-glib.c - - * src/soup-wsdl/wsdl-locate.c: Removed the glib schema locate - functions. - - * src/soup-wsdl/wsdl-describe.c: Removed most of the glib schema - describe functions - - * src/soup-wsdl/main.c: const-ified option string pointers. - (main): Call glib schema init helper functions. Moved "show doc" - option handler out of wsdl-parse.c to here. - - * src/soup-core/soup-private.h, src/soup-core/soup-queue.c: fixed - prototype for soup_queue_shutdown to avoid warning - - * configure.in: Went wild with gcc warning options, found - surprisingly few problems. - -2001-03-29 Rodrigo Moya <rodrigo@ximian.com> - - * configure.in: add CFLAGS to apxs parameters, to output the - correct compilation flags - -2001-03-21 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-socks.c: remove hack to look at internals of - GNET by using the new forked GNET :) - - * tests/stress-test.c: use soup_message_queue (). - - * tests/simple-test.c: use soup_message_queue (). - - * src/soup-core/soup-private.h: Added SoupAddress and SoupSocket. - - * src/soup-core/soup-misc.c (soup_shutdown): Added, just calls - soup_queue_shutdown. - - * src/soup-core/soup-queue.h: Removed. Added to soup-message.h. - - * src/soup-core/soup-queue.c (soup_queue_message): rename to - (soup_message_queue): this. - - * src/soup-core/soup-message.h: move SoupErrorCode, - SoupCallbackFn, and soup_message_queue() here. - - * src/soup-core/soup-message.c (soup_message_free): Free - msg->response if buffer is system owned. - (soup_message_issue_callback): set msg->priv->errorcode so - syncronous soup_message_send can check for completion. - (soup_message_send): Added: Synchronous message send. Queues the - message as per usual, then call g_main_iteration() until them - essage returns. - - * src/soup-core/soup-context.c: API Document. Switch gnet calls to - their soup-socket replacement. - (soup_context_get_connection): Remove environment check for - syncronous connect method. - - * src/soup-core/Makefile.am (INCLUDES): replace GNET_CFLAGS with - GLIB_CFLAGS. - (libsoup_la_LIBADD): replace GNET_LIBS with GLIB_LIBS. - (soupinclude_HEADERS): Remove soup-queue.h. Add soup-socket.h. - (libsoup_la_SOURCES): Add soup-socket.c. - - * soup.spec.in (Requires): remove GNET. Add libxml. - - * soup.pc.in (Libs): remove GNET. - (Cflags): ditto. - - * soup-config.in (depend_libs): remove GNET. - (depend_cflags): ditto. - - * configure.in: remove gnet references, look for libnsl and - libresolv, add checking to determine gethostbyname_r possibility. - - * acconfig.h: Add undefs for all the gethostbyname_r variants. - - * src/soup-core/soup-socket.[ch]: Fork of GNET, minus synchronous - bits. Removes dependency on GNET; we now only rely on Glib and - libXml. - -2001-03-20 Dick Porter <dick@ximian.com> - - * src/soup-wsdl/wsdl-types-glib.c: Parse a simple glib schema. - - Handle describe and free operations on the glib schema structures - here too. - - * src/soup-wsdl/wsdl-thread.c (wsdl_thread_soap_parts): Locate - references to types defined in the glib schema. - - * src/soup-wsdl/wsdl-soap-stubs.c: Handle references to types - defined in the glib schema. - - Handle output operation parameters. - - * src/soup-wsdl/wsdl-soap-headers.c: Emit typedefs for glib schema - elements and structs. - - Handle output operation parameters. + * libsoup/Makefile.am: Rename library to libsoup-2.0, put includes + in ${includedir}/soup-2.0 - * src/soup-wsdl/wsdl-parse.c: (wsdl_parse_types): Parse glib schemas - - (wsdl_parse_warning): (wsdl_parse_error): (wsdl_parse_fatal): Made - non-static, so that glib schema parsing can be separated. - - All attributes called "xmlns" or "xmlns:..." are ignored by the - WSDL part of the XML parser. - - All g_slist_prepend()s have been turned into g_slist_append()s, to - keep operation arguments in the expected order. - - * src/soup-wsdl/wsdl-memory.c (wsdl_free_types): Free glib type - schemas - - * src/soup-wsdl/wsdl-locate.c: New functions to look up glib - schema element or struct definitions - - * src/soup-wsdl/wsdl-describe.c (indent): Made non-static, so that - glib type describing can be separated. - (wsdl_describe_types): Describe glib type schemas - -2001-03-17 Dick Porter <dick@ximian.com> - - * src/soup-wsdl/wsdl-thread.c: Thread WSDL structures together. - - * src/soup-wsdl/wsdl-soap-stubs.c: - * src/soup-wsdl/wsdl-soap-headers.h: Most of the element matching - has been moved in the new threading routings. - - * src/soup-wsdl/wsdl-parse.h: WSDL elements have extra pointers to - thread structures together. - - * src/soup-wsdl/wsdl-memory.c: Free GSLists. WSDL elements have - extra pointers to thread structures together, and some of these - are GSLists that need freeing too. - - * src/soup-wsdl/wsdl-locate.c: Some more lookup functions. - - * src/soup-wsdl/main.c (main): Call the WSDL element threader, and - only proceed to write files if it succeeds. - -2001-03-15 JP Rosevear <jpr@ximian.com> - - * src/soup-core/soup-apache.c (soup_apache_message_create): use - the HTTP_OK macro for the response code rather than hard coding - 200 - (soup_apache_handler): return should be OK or !OK rather than the - http response code value (ie 200) - - * src/soup-core/soup-serializer.c (soup_serializer_reset): Make a - blank doc when resetting - -2001-03-14 JP Rosevear <jpr@ximian.com> - - * src/soup-core/soup-apache.c (soup_apache_read_request): oops, - deleted too much - -2001-03-14 Dick Porter <dick@ximian.com> - - * src/soup-wsdl/wsdl-parse.h: Support for simple glib types - - * src/soup-wsdl/wsdl-parse.c (wsdl_attrnscmp): Check the namespace - prefix of a string. - (wsdl_parse_types): Add a placeholder for parsing glib schemas - (wsdl_parse_message): Add support for simple glib types in part - elements - - * src/soup-wsdl/wsdl-describe.c (wsdl_describe_message_part): Show - glib types, if appropriate - -2001-03-13 JP Rosevear <jpr@ximian.com> - - * src/soup-core/soup-queue.c (soup_get_request_header): don't - escape the SoapAction header, this makes things work on the server - side but need to check if this breaks the spec - - * src/soup-core/soup-message.c (soup_message_free): don't try to - free the request body twice - - * src/soup-core/soup-apache.c (soup_apache_message_create): The - buffer is user owned. Use ap_contruct_url since the uri function - did not include happy things like hostname - will this get the - password properly though? - (soup_apache_read_request): don't adjust read_left twice - (soup_apache_handler): log some stuff to the apache log - -2001-03-13 JP Rosevear <jpr@ximian.com> - - * configure.in: don't chmod the files. soup-config become - executable on install by bin_SCRIPTS and *Conf.sh never need to be - executable, fix my apache cflags blunder - -2001-03-12 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-server.c (soup_server_get_handler): avoid - leading and trailing quotes. If an exact match is not found, - lookup based only on methodname not uri#methodnmae. - - * src/soup-core/soup-apache.c (soup_apache_handler): compile - without warnings. - - * configure.in (AC_OUTPUT): chmod +x soup_apacheConf.sh - -2001-03-09 Alex Graveley <alex@ximian.com> - - * src/soup-wsdl/wsdl-parse.c (wsdl_parse): set definitions = NULL - to pass -Werror. - -2001-03-09 Alex Graveley <alex@ximian.com> - - * tests/simple-test.c (main): demonstrate correct behavior here by - unref'ing the context after message creation. - - * tests/stress-test.c (main): ditto. - - * src/soup-core/soup-queue.c (soup_queue_message): set - req->priv->recv_buf = NULL here, as the media continues to barrate - dangling pointers. - - * src/soup-core/soup-server.h: make SoupServerAuthorizeFn typedef - const correct - - * src/soup-core/soup-server.c (soup_server_authorize): make const - correct. - - * src/soup-core/soup-message.c (soup_message_cleanup): don't free - response phrase. Don't set req->priv->recv_buf = NULL here, as - leaking memory continues to be considered "bad". - - * src/soup-core/soup-headers.c (soup_headers_parse_response): - don't alloc status_phrase, just point into buffer. - - * src/soup-core/soup-cgi.c (soup_cgi_read_cb): deal with response - phrase now being const. - - * src/soup-core/soup-apache.c (soup_apache_message_create): action - is already strdup'd in soup_message_new (). response_phrase - is now a const string. Remove unneeded content-type header. - (soup_apache_read_request): slight reorg, also use ap_palloc() - instead of ap_calloc(). - (soup_apache_handler): initial authentication handling, only basic - auth at this point. - -2001-03-09 Dick Porter <dick@ximian.com> - - * src/soup-wsdl/wsdl-parse.h: Each WSDL struct has a pointer into - the XML tree document - - * src/soup-wsdl/wsdl-parse.c (wsdl_qnamecmp): A function for - comparing element names and namespaces. - - Use wsdl_qnamecmp instead of strcmp to make parsing - namespace-aware. - - (wsdl_end_element): Maintain a pointer into the XML tree for each - WSDL node. - - * src/soup-wsdl/wsdl-memory.c (wsdl_free_definitions): Free the - XML document - - * src/soup-wsdl/main.c (main): Move the xml doc dump to here, for - better modularity - -2001-03-08 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-ssl.c (soup_ssl_get_iochannel): after failing - an explicit path execution, use execlp (instead of execl) to - search the path for soup-ssl-proxy. - - * configure.in: set the default openssl library prefix to /usr/lib - to fix weird linking problems when compiling with both openssl and - nss. - -2001-03-08 JP Rosevear <jpr@ximian.com> - - * configure.in: send the apache info to the config script - - * src/soup-core/soup-apache.c (soup_apache_handler): upon further - reading, content_type is for the outgoing document - (soup_apache_read_request): if ap_should_client_block != 0 we - want to keep going - -2001-03-08 JP Rosevear <jpr@ximian.com> - - * soup_apacheConf.sh.in: script to provide soup-apache config info - through gnome-config - - * Makefile.am: subst in the soup_apache config script - - * configure.in: create vars for soup-apache config foo - - * src/soup-core/soup-apache.c (soup_apache_handler): check for - null because content type can be null - -2001-03-07 JP Rosevear <jpr@ximian.com> - - * src/soup-core/soup-server.h: soup_server_init should be an - extern function - -2001-03-07 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-server.c (soup_server_set_global_auth): add - allowable authentication types mask. - (soup_server_set_method_auth): ditto. NOTE: This server auth stuff - may be removed altogether, so don't rely on it. - - * src/soup-core/soup-server.h: added SoupServerAuthType, a mask of - allowable authentication types. Make soup_server_init an extern - declaration instead of a function pointer. - - * src/soup-core/soup-apache.c (soup_apache_read_request): move - chunked data checking to here from soup_apache_handler. - -2001-03-07 JP Rosevear <jpr@ximian.com> - - * soupConf.sh.in: use configure.in vars for subst - - * configure.in: create variables for config script - - * Makefile.am: generate the soupConf.sh script in the makefile for - proper substitution - -2001-03-07 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-cgi.c: created. moved cgi-related request - processing here. do not use it. completely broken. - - * src/soup-core/soup-apache.c: initial commit of Apache module - handling, server registration should be performed in a - soup_server_init function. Authorization handling still needs to - be written. - - * src/soup-core/soup-server.c: cleaned up to have only generic - server functions. removed extraneous unregister functions. - (soup_server_set_global_auth): set the global server authorize - function, to be called in the absence of a method-specific - authorize function. - (soup_server_set_method_auth): set per-method authorize function. - - * src/soup-core/soup-queue.c (soup_parse_headers): remove unneeded - variables. - - * src/soup-core/soup-private.h: add SoupServerHandler, - soup_server_get_handler(), and soup_server_authorize(). - - * src/soup-wsdl/Makefile.am (INCLUDES): add WSDL_CFLAGS, to get - -Werror. - - * src/soup-core/Makefile.am: add new libsoup-apache.so target. - - * soup.spec.in: update and remove hardcoded library version. - - * soup-config.in: add module soup-apache. - - * configure.in: Fix library versioning. Switch version to - 0.2.1. Add APACHE_CFLAGS and APACHE_LIBS, gotten from running - `apxs`. Remove -Werror from CFLAGS, as apache_conf.h is missing a - prototype. Add WSDL_CFLAGS="-Werror" back. - - * TODO (TODO): Updated. - -2001-03-06 JP Rosevear <jpr@ximian.com> - - * configure.in: properly version the project and give an option to - disable more warnings - -2001-03-02 Alex Graveley <alex@ximian.com> - - * src/soup-wsdl/Makefile.am (INCLUDES): Remove WSDL_CFLAGS. - - * tests/simple-test.c (current_temp_cb): handle SOUP_ERROR_HANDLER - so we pass -Werror. - - * tests/stress-test.c (current_temp_cb): handle SOUP_ERROR_HANDLER - so we pass -Werror. - - * configure.in: remove some excess version-related cruft. Display - a Configuration list on completion. Add -Werror. Remove WSDL_CFLAGS. - -2001-03-02 Alex Graveley <alex@ximian.com> - - * src/soup-core/gionspr.c: remove, as this is not used. - -2001-03-02 Alex Graveley <alex@ximian.com> - - * configure.in: remove gmodule dependency. Fix OPENSSL_LIBS and - NSS_LIBS to include the library name and not only the path. - - * src/soup-core/soup-ssl-proxy.c (soup_ssl_proxy_init): remove - call to g_module_supported(). - - * src/soup-core/soup-nss.c: remove GModule NSS loading, - link conventionally instead. - - * src/soup-core/soup-openssl.c: remove GModule OpenSSL loading, - link conventionally instead. - -2001-03-02 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-ssl-proxy.c: oops. should have been added - yesterday. - -2001-03-02 Alex Graveley <alex@ximian.com> - - * tests/stress-test.c (main): exit nicely if no test URL is supplied. - - * tests/simple-test.c (main): use http://www.ximian.com is no test - URL is supplied. - - * tests/Makefile.am (INCLUDES): include glib headers. - - * src/soup-wsdl/Makefile.am (INCLUDES): include glib, popt, and - libxml headers. - (soup_wsdl_LDADD): explicitly add glib, popt, libxml deps. - - * src/soup-core/Makefile.am (INCLUDES): include gnet, libxml, - openssl, and nss headers. - (libsoup_la_LIBADD): explicitly add gnet, libxml deps. - (soup_ssl_proxy_LDADD): explicitly add glib, nss and openssl deps. - - * soup.spec.in: remove OpenSSL advertising clause. - - * soupConf.sh.in: list out dependencies (gnet, libxml). - - * soup.pc.in: list out dependencies (gnet, libxml). - - * soup-config.in: list out dependencies (gnet, libxml). - - * configure.in: Cleanups to remove unnecessary dependencies. - -2001-02-28 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-ssl.c (soup_ssl_idle_waitpid): glib idle - callback which calls waitpid (nonblockingously) on all the - soup-ssl-proxy children to make sure their resources are freed. - (soup_ssl_get_iochannel): execute soup-ssl-proxy, setting up STDIN - and STDOUT to point to the fd we will return a GIOChannel for, - also passing the security policy and the destination socket fd - number in the environments SECURITY_POLICY and SOCKFD, - respectively. - - * src/soup-core/soup-ssl-proxy.c: Created. This is a small SSL - proxy executable, licensed GPL, which allows us to use OpenSSL and - NSS without requiring applications which link with libsoup to have - to comply with the licenses of those SSL libraries. - - * src/soup-core/soup-server.c (soup_server_register): add handler - to list. - - * src/soup-core/soup-queue.c (soup_queue_write_async): ignore - SIGPIPE and handle errno. - - * src/soup-core/soup-misc.c (soup_set_security_policy): move from - soup-ssl.c. - (soup_get_security_policy): add. - - * src/soup-core/soup-context.c (soup_connection_get_iochannel): - setup TCP socket before getting an SSL wrapper channel. - - * src/soup-core/Makefile.am (INCLUDES): add -DBINDIR - (libsoup_la_SOURCES): remove ssl backends - (soup_ssl_proxy_SOURCES): create soup-ssl-proxy - - * src/soup-core/.cvsignore: add soup-ssl-proxy - -2001-02-28 Dick Porter <dick@ximian.com> - - * src/soup-wsdl/wsdl-trace.[ch]: New file of better debugging routines. - - * src/soup-wsdl/wsdl-soap-stubs.[ch]: New file that emits C code - for client stubs. - - * src/soup-wsdl/wsdl-soap-skels.[ch]: New file that will emit C - code for server skeleton functions. - - * src/soup-wsdl/wsdl-soap-headers.[ch]: New file that emits - structure definitions and function prototypes for stubs and skels - - * src/soup-wsdl/wsdl-soap-common.[ch]: New file that will emit C - code for functions common to stubs and skels. - - * src/soup-wsdl/wsdl-memory.[ch]: New file of routines to - recursively free WSDL structures. - - * src/soup-wsdl/wsdl-locate.[ch]: New file of routines to look up - WSDL structures given a name and a parent structure. - - * src/soup-wsdl/wsdl-describe.[ch]: New file of structure printing - routines. - - * src/soup-wsdl/wsdl.h: Deleted the debug logging stuff, added a - much better version in wsdl-trace.[ch] - - * src/soup-wsdl/wsdl-parse.h: Structures moved here from - wsdl-parse.c. Added all of the SOAP extensions. - - * src/soup-wsdl/wsdl-parse.c: Added the rest of the SOAP - extensions. Moved some of the parser internal struct definitions - into wsdl-parse.h. - Moved the structure printing routines into their own file. - (wsdl_get_location): Made the error reporting slightly more useful - (wsdl_parse_porttype_operation): Tell the difference between a - request-response operation and a solicit-response operation. - (wsdl_parse_xml): Combine tree and SAX parsing styles, so I can - build an xmlDocPtr tree, yet still fill in the WSDL structures as - the XML is being read. - (wsdl_parse): Set up the SAX parser so it calls the internal - libxml tree building routines, except for those elements that I - use to build WSDL structures. These elements must call the - corresponding xmlDefaultSAXHandler functions themselves. - - * src/soup-wsdl/main.c: Added options for code generation - (main): Call code generation routines - - * src/soup-wsdl/Makefile.am: Added a lot of new files - - * configure.in: Add -Werror to the WSDL CFLAGS - -2001-02-20 Alex Graveley <alex@ximian.com> - - * src/soup-core/Makefile.am (libsoup_la_LDFLAGS): remove -release - tag so libsoup is named libsoup.so.0.1.9 not libsoup-0.1.9.so.0.0.0 - - * soupConf.sh.in (SOUP_INCLUDEDIR): use $CPPFLAGS instead of $CFLAGS. - - * soup-config.in (depend_cflags): use $CPPFLAGS instead of $CFLAGS. - - * configure.in: Clean up to use $CPPFLAGS instead of $CFLAGS for - storing glib, gnet, libxml, openssl, nspr, and nss header - locations. - -2001-02-20 Alex Graveley <alex@ximian.com> - - * configure.in: cleaned up to no longer link with an SSL - library. Added options --with-nspr-includes, --with-nspr-libs, - --with-nss-includes, --with-nss-libs, --with-openssl-includes, and - --with-openssl-libs. - - * src/soup-core/Makefile.am (libsoup_la_SOURCES): Add - soup-nss.[ch], and soup-openssl.[ch]. - - * src/soup-core/soup-openssl.c: Added. Move existing OpenSSL code - here. Convert to using GModule to load the shared library at runtime. - - * src/soup-core/soup-nss.c: Added. Initial implementation of NSS - SSL support. Uses GModule to perform runtime loading. Needs - serious testing. - - * src/soup-core/soup-ssl.c (soup_set_security_policy): Sets the - underlying SSL library's policy wrt allowed ciphers. Valid options - are DOMESTIC, EXPORT, and FRANCE, though these may change as - domestic and export are confusing terms. - (soup_ssl_init): Now simply chains SSL library initialization until - one is loaded successfully. Attempts to start NSS then OpenSSL, then - simply fails gracefully for future SSL connections. - (soup_ssl_get_iochannel): dispatch to the underlying SSL library - in use, or return NULL if none are available. - - * src/soup-core/soup-misc.c (soup_load_config_internal): Converted - to use generic config file option table. - (soup_config_connection_limit): Added. Set the connection limit - given a "connection-limit" config file option. - (soup_config_proxy_uri): Added. Set the proxy uri given a - "proxy-uri" or "proxy-url" config file option. - (soup_config_security_policy): Added. Allows setting the SSL security - policy from the config file. - -2001-02-16 Alex Graveley <alex@ximian.com> - - * tests/Makefile.am: clear out some unneccassry cruft as currently - all tests link against libsoup. - - * src/soup-wsdl/Makefile.am (soup_wsdl_SOURCES): add wsdl.h. - - * src/soup-core/Makefile.am (libsoup_la_SOURCES): add - soup-headers.h, soup-private.h, soup-socks.h, and soup-ssl.h to - pass distcheck. - -2001-02-15 Alex Graveley <alex@ximian.com> - - * tests/stress-test.c (current_temp_cb): update to return void - from the callback. - (main): do not requeue existing messages when they have finished, - as they will be freed. instead create new SoupMessage objects. - - * tests/simple-test.c (current_temp_cb): update to return void - from the callback. - - * src/soup-core/soup-serializer.c (soup_serializer_start_element): - support creation of the request's SOAPAction header my taking the - namespace uri and name of the first element after starting the - body tag. - - * src/soup-core/soup-queue.h: add SOUP_ERROR_HANDLER which will be - used by the upcoming handler/interceptor stuff to return an - application-level error to the message callback. Make - SoupCallbackFn return void. - - * src/soup-core/soup-queue.c (soup_debug_print_headers): make public. - (soup_queue_write_async): attempt to write again if the first - write was okay and didn't block. - - * src/soup-core/soup-uri.c (soup_debug_print_uri): make public. - - * src/soup-core/soup-message.c (soup_message_issue_callback): - message callback now returns void, meaning that soup_queue_message() - takes ownership of the message and always frees it after calling - the callback (unless it was requeued from within the callback). - - * src/soup-core/soup-headers.c (soup_headers_parse_request): - renamed from soup_parse_request_headers. - (soup_headers_parse_response): renamed from soup_parse_response_headers. - (soup_headers_parse): renamed from soup_parse_headers. - -2001-02-13 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-ssl.c (soup_get_ssl_iochannel): renamed to - soup_ssl_get_iochannel. - -2001-02-13 Alex Graveley <alex@ximian.com> - - * src/soup-core/soup-ssl.c (soup_ssl_add_watch): work around fact - that data available in the socket does not always mean unencrypted - data is available for reading. - (soup_ssl_read_cb): called on socket data available. Only call the - real callback if SSL_pending() returns > 0 meaning there is actual - data to read. there is a bug here as SSL_pending() always returns - false, so its commented out. - - * src/soup-core/soup-queue.c (soup_queue_connect): add explicit - check for SOCKS protocol, remove call to soup_setup_socket. - - * src/soup-core/soup-context.c (soup_connection_get_iochannel): - add channel member to SoupConnection, and serve it up for future - requests. - - * src/soup-core/soup-queue.c (soup_setup_socket): removed. - (soup_get_request_header): change default Content-Type to - "text/xml; charset=utf-8". - - * src/soup-core/soup-context.c (soup_connection_setup_socket): - moved soup-queue.c:soup_setup_socket() to here. - -2001-02-12 alex <alex@ximian.com> - - * src/soup-core/soup-server.[ch]: Initial revision of server side - request handling dispatcher. - -2001-02-11 alex <alex@ximian.com> - - * TODO: add items left before a release. - - * soup-queue.c: change default Content-Type to "text/xml" from - "text/xml\r\n\tcharset=\"utf-8\"". - - * soup-serializer.[ch]: added soup_serializer_new_full which - removes unnecessary args to soup_serializer_start_envelope. - rearrange namespace args to soup_serializer_start_element to match - other methods. added soup_serializer_set_type to set the xsi:type, - and soup_serializer_set_null to set xsi:null="1". - -2001-02-06 alex <alex@ximian.com> - - * soup-config.in: remove some cruft. - - * soupConf.sh.in: remove some cruft. - - * src/soup-core/Makefile.am: build soup-headers.c - - * src/soup-core/soup-headers.[ch]: created. refactor of header parsing - logic for use in requests and responses. - - * src/soup-core/soup-message.c: free req->response_phrase as it is now - allocated. - - * src/soup-core/soup-queue.c (soup_parse_headers): use - soup_parse_response_headers. (soup_queue_reqest): free - req->response_phrase. - - * src/soup-core/soup-serializer.h: include <time.h> - -2001-01-31 Jeffrey Stedfast <fejj@ximian.com> - - * src/soup-core/gionspr.c: Implemented (probably somewhat broken). - -2001-01-25 Rodrigo Moya <rodrigo@ximian.com> - - * soup-config.in: replaced @glib_cflags@ and @glib_libs@ with - @GLIB_CFLAGS@ and @GLIB_LIBS@. Added -I@includedir@/soup to - $cflags - -2001-01-23 alex <alex@ximian.com> - - * ChangeLog: Created from rcs2log. - - * AUTHORS: Added Dick Porter. - - * soup.pc.in, soup-config.in, soupConf.sh, soup.m4: - Created with a dash of Maintainer Love. - - * soup.spec.in: RPM spec file. Needs fixing wrt to displaying the - OpenSSL license conditionally (if it was statically linked). - - * Makefile.am: Updated to install new config scripts and macros. - - * configure.in: add --enable-ssl, --with-ssl=[nss/openssl/none], - and --with-nss-prefix=PFX to support choosing of an SSL library to - use, even though openssl is the only one currently supported. - - * src/soup-core/Makefile.am: don't install soup-ssl.h or - soup-socks.h, they're internal. - - * src/soup-core/soup-ssl.c: wrap openssl calls with a conditional - to avoid building if --enable-ssl=no or NSS is chosen as the - library. soup_get_ssl_iochannel() will print "SSL Not Supported." - and return NULL if no library has been chosen. - - * tests/stress-test.c: make the callback handle errors by - requeuing request and not just g_error'ing. - -2001-01-23 alex <alex@ximian.com> - - * soup-context.c (soup_context_get_connection): check environment - for SOUP_NO_ASYNC_CONNECT, and if set use syncronous name lookup - and connect. Use this when debugging. - - * soup-queue.c (soup_read_chunk): fix buffer overflow. - - * soup-queue.c (soup_queue_read_async): set header_len to include - trailing \r\n\r\n as this makes more sense. - - * soup-serializer.[ch] (soup_serializer_get_xml_doc): allows - getting at the serializer's internal xml tree. - - * soup.h: install soup-serializer.h. - -2001-01-21 alex <alex@ximian.com> - - * /cvs/helixcode/services/soup/src/soup-wsdl/Makefile.am, - /cvs/helixcode/services/soup/tests/Makefile.am, - /cvs/helixcode/services/soup/configure.in, - /cvs/helixcode/services/soup/src/Makefile.am: Update Makefile.ams - and configure.in to work with new layout. - - * /cvs/helixcode/services/soup/src/soup.h, - /cvs/helixcode/services/soup/src/soup-socks.h, - /cvs/helixcode/services/soup/src/soup-ssl.c, - /cvs/helixcode/services/soup/src/soup-ssl.h, - /cvs/helixcode/services/soup/src/soup-uri.c, - /cvs/helixcode/services/soup/src/soup-uri.h, - /cvs/helixcode/services/soup/src/soup-context.c, - /cvs/helixcode/services/soup/src/soup-context.h, - /cvs/helixcode/services/soup/src/soup-message.c, - /cvs/helixcode/services/soup/src/soup-message.h, - /cvs/helixcode/services/soup/src/soup-misc.c, - /cvs/helixcode/services/soup/src/soup-misc.h, - /cvs/helixcode/services/soup/src/soup-private.h, - /cvs/helixcode/services/soup/src/soup-queue.c, - /cvs/helixcode/services/soup/src/soup-queue.h, - /cvs/helixcode/services/soup/src/soup-serializer.c, - /cvs/helixcode/services/soup/src/soup-serializer.h, - /cvs/helixcode/services/soup/src/soup-socks.c: Adding Dick's wsdl - compiler to the soup package, to src/soup-wsdl. Moving existing - soup stuff to src/soup-core. - -2001-01-19 dick <dick@ximian.com> - - * /cvs/helixcode/services/soup/src/soup-wsdl/main.c, - /cvs/helixcode/services/soup/src/soup-wsdl/Makefile.am, - /cvs/helixcode/services/soup/src/soup-wsdl/wsdl.h, - /cvs/helixcode/services/soup/src/soup-wsdl/wsdl-parse.c, - /cvs/helixcode/services/soup/src/soup-wsdl/wsdl-parse.h, - /cvs/helixcode/services/soup/tests/stockquote2.wsdl, - /cvs/helixcode/services/soup/tests/stockquote.wsdl: First part of - the WSDL compiler. - - The parser accepts an XML file in WSDL syntax. Some syntax - checking is done, but there is no consistency checking yet. - - User-specified types are not yet supported. - -2001-01-17 alex <alex@ximian.com> - - * src/soup-serializer.c (soup_serializer_start_element): handle - cases where users want to be lazy and supply a namespace prefix - but not a uri (i.e. broken xml). - - * src/soup-misc.c (soup_load_config_internal): warn the user if a - config file entry is not allowed by system config. - - * src/soup-serializer.[ch]: initial commit of simple serializer - API. Uses libxml to handle tree creation. - - * configure.in: check for libxml. - -2001-01-15 alex <alex@ximian.com> - - * src/soup-misc.c: Fix a typo - - * src/soup-misc.c: hacked to support permissions in the global - config file on which options can be set from user config - files. Global config file is now always loaded first, before - either a program specified file or the user's dot-file. Also - supports "allow all" and "deny all" which have the expected - results. - - * src/soup-ssl.[ch]: move unneeded #include's to the source file. - - * soup-socks.c: Umm, ya. So I was like umm, sleepy last night and - stuff. So this umm makes last night's commit a little less - embarrassing. - -2001-01-14 alex <alex@ximian.com> - - * src/soup-misc.c: oops, forgot to mention that user local config - file (~/.souprc) is now loaded after the system config file. This - needs to be thought out more as administrators may not want - variables overwritten. - - * src/soup-socks.[ch]: SOCKS version 4 and version 5 support. This - code is not very simple because we are attempting to make a - multi-step conversation completely asyncronous. Also this includes - a hack to get at GNET's GInetAddr private memebers (the - sockaddr_in) for SOCKS4, as the client has to lookup the - destination host address and send it to the socks proxy, and we - want to use gnet to do this asyncronously. - - * src/soup-context.[ch]: Added soup_context_get_protocol(), - soup_connection_get_context(), and soup_connection_is_new() so - that we can keep the abstractions between the contexts/connections - and messages clean. soup_context_get_uri() changed to return a - SoupUri instead of a string, as this is more useful. Made - SoupProtocol a public enum so it can be returned by - soup_context_get_protocol(). - - * src/soup-queue.c: updated to use context/connection accessors, - instead of looking at private members. AB-STRAC-SHUN! - -2001-01-12 alex <alex@ximian.com> - - * soup-misc.c (soup_load_config): simple config file - loading. Passing NULL as the config file name will load from the - system config file, which is $(sysconfdir)/souprc. Only options - supported now are proxy-url and connection-limit. - - * */.cvsignore: a little maintainer love. - -2001-01-11 alex <alex@ximian.com> - - * soup-queue.c (soup_get_request_header): append a '?' between - path and query string in request header. NULL terminate the call - to g_strconcat. - - * soup-context.c (soup_context_get): bomb if url passed in does - not have a protocol. do not default to HTTP. - -2001-01-08 alex <alex@ximian.com> - - * /cvs/helixcode/services/soup/src/soup-message.c, - /cvs/helixcode/services/soup/src/soup-message.h, - /cvs/helixcode/services/soup/src/soup-request.c, - /cvs/helixcode/services/soup/src/soup-request.h: * Oops. Forget to - add new files and remove old ones when I renamed SoupRequest to - SoupMessage. - - * /cvs/helixcode/services/soup/src/soup-ssl.c, - /cvs/helixcode/services/soup/src/soup-queue.c: * soup-ssl.c - (soup_ssl_add_watch): make ssl work. pass the ssl iochannel to the - underlying iochannel's funcs->io_add_watch, so that our ssl - functions get called. this is a hack. this will need to be fixed - in order to get windows portability, as the SoupSSLChannel struct - is mimicing GIOUnixChannel so the add_watch will work correctly. - - * soup-queue.c (soup_queue_read_async): fix bug when searching for - end of http headers where req->priv->header_len was being set - whether the end was found or not. - - * /cvs/helixcode/services/soup/src/Makefile.am, - /cvs/helixcode/services/soup/src/soup.h, - /cvs/helixcode/services/soup/src/soup-private.h, - /cvs/helixcode/services/soup/src/soup-queue.c, - /cvs/helixcode/services/soup/src/soup-queue.h, - /cvs/helixcode/services/soup/tests/simple-test.c, - /cvs/helixcode/services/soup/tests/stress-test.c: * Renamed - SoupRequest to SoupMessage, as it contains both the request and - the response, changed all API names accordingly. This had to be - done, so what better time than now? - - * /cvs/helixcode/services/soup/configure.in, - /cvs/helixcode/services/soup/src/Makefile.am, - /cvs/helixcode/services/soup/src/soup-context.c, - /cvs/helixcode/services/soup/src/soup-context.h, - /cvs/helixcode/services/soup/src/soup-private.h, - /cvs/helixcode/services/soup/src/soup-queue.c, - /cvs/helixcode/services/soup/src/soup-request.c, - /cvs/helixcode/services/soup/src/soup-ssl.c, - /cvs/helixcode/services/soup/src/soup-ssl.h: * soup-queue.c: - chunked encoding support finalized, fixed a few small buffer over - allocations, use strcasecmp instead of strcmp when comparing - custom request headers, better error handling in - soup_queue_error_async which fixes a bug found in certain IIS - servers. - - * soup-context.c: (soup_connection_get_iochannel) return iochannel - from soup-ssl.c:soup_get_ssl_iochannel() if protocol for - connection is SOUP_PROTOCOL_SHTTP. - - * soup-ssl.c: simple GIOChannel wrapper around the OpenSSL - library. - -2000-12-27 alex <alex@ximian.com> - - * /cvs/helixcode/services/soup/src/soup-core/soup-private.h, - /cvs/helixcode/services/soup/src/soup-core/soup-queue.c, - /cvs/helixcode/services/soup/src/soup-private.h, - /cvs/helixcode/services/soup/src/soup-queue.c: * soup-private.h: - Content length is now a guint. - - * soup-queue.c (soup_parse_headers): Added minimum status-line - length check. - - * soup-queue.c (soup_queue_request): Removed g_error() call for - user-iwned response buffers. We now just issue a - SOUP_ERROR_CANCELLED callback and print a warning. - - * /cvs/helixcode/services/soup/tests/Makefile.am, - /cvs/helixcode/services/soup/tests/stress-test.c: * Added - tests/stress-test.c which makes 3 simultaneous requests to a url, - each repeating 110 times (enough to trigger Apache to kill - keep-alive connections), goes to sleep for 20 seconds (long enough - for Apache to kill keep-alive connections again) and repeats. It - also sets the connection limit to 2. - - * /cvs/helixcode/services/soup/tests/simple-test.c: * - SOUP_ERROR_UNKNOWN has been removed. Don't check for it. - -2000-12-26 alex <alex@ximian.com> - - * /cvs/helixcode/services/soup/src/soup-context.c, - /cvs/helixcode/services/soup/src/soup-context.h, - /cvs/helixcode/services/soup/src/soup-misc.c, - /cvs/helixcode/services/soup/src/soup-private.h, - /cvs/helixcode/services/soup/src/soup-queue.c, - /cvs/helixcode/services/soup/src/soup-queue.h, - /cvs/helixcode/services/soup/src/soup-request.c, - /cvs/helixcode/services/soup/src/soup-request.h, - /cvs/helixcode/services/soup/src/soup-uri.c: * Made SoupConnection - wrap Gnet's TcpSocket. This means there are no gnet references in - the public interface. - - * Lots of code cleanup/reorg/bugfixes. - -2000-12-20 alex <alex@ximian.com> - - * /cvs/helixcode/services/soup/src/soup-context.c, - /cvs/helixcode/services/soup/src/soup-private.h, - /cvs/helixcode/services/soup/src/soup-queue.c, - /cvs/helixcode/services/soup/src/soup-request.c, - /cvs/helixcode/services/soup/src/soup-uri.c, - /cvs/helixcode/services/soup/tests/simple-test.c: * Header parsing - works according to spec, including multi-line headers. - - * Content-length driven responses work correctly. - - * Chunked encoding almost working :) - - * Updated simple-test to take a url from the command line. - -2000-12-13 alex <alex@ximian.com> - - * /cvs/helixcode/services/soup/src/soup-core/soup-uri.c, - /cvs/helixcode/services/soup/src/soup-uri.c: * soup-uri.c - (soup_uri_new): Forgot to set the path for cases where we don't - have a querystring (which is most of the time). Doh. - - * soup-uri.c (soup_uri_get_default_port): No such thing as an - smtp://foo@bar uri, only mailto:foo@bar. - - * /cvs/helixcode/services/soup/tests/Makefile.am, - /cvs/helixcode/services/soup/tests/simple-test.c, - /cvs/helixcode/services/soup/configure.in, - /cvs/helixcode/services/soup/Makefile.am, - /cvs/helixcode/services/soup/src/soup-context.c, - /cvs/helixcode/services/soup/src/soup-context.h, - /cvs/helixcode/services/soup/src/soup-misc.c, - /cvs/helixcode/services/soup/src/soup-private.h, - /cvs/helixcode/services/soup/src/soup-queue.c, - /cvs/helixcode/services/soup/src/soup-queue.h, - /cvs/helixcode/services/soup/src/soup-request.c, - /cvs/helixcode/services/soup/src/soup-request.h, - /cvs/helixcode/services/soup/src/soup-uri.c, - /cvs/helixcode/services/soup/src/soup-uri.h: * Beginnings of - test-suite added. - - * Made SoupContext opaque. Removed SoupContextPrivate. Added - soup_context_get_uri() to get the uri string for a given context. - - * Added a response_headers hashtable to SoupRequest so the - callback can do whatever it wants with passed headers. All entries - in this hashtable are just parsed strings from - req->priv->recv_buf, so no new strings are allocated. - - * Renamed custom_headers to request_headers - - * Fixed context creation logic - - * Made soup_servers hashtable use case insensitive hostname - matching. - - * Removed SOUP_ERROR_URI_NOT_FOUND, SOUP_ERROR_URI_NOT_PERMITTED, - and SOUP_ERROR_URI_OBJECT_MOVED from SoupCallbackResult enum. Its - up to the application to figure out all the different HTTP - states. This may change however. - - * Added querystring to SoupUri, so that contexts can be cached - based only on path. - - * Added default port logic to SoupUri. Known protocols are https - (port 443), http (80), smtp/mailto (25), and ftp (20). - -2000-12-12 alex <alex@ximian.com> - - * /cvs/helixcode/services/soup/src/soup-context.c, - /cvs/helixcode/services/soup/src/soup-queue.c: * Also changed the - passing of a gchar** to a gchar* in soup_process_headers()'s - sscanf(). - - * /cvs/helixcode/services/soup/src/soup-context.c, - /cvs/helixcode/services/soup/src/soup-context.h, - /cvs/helixcode/services/soup/src/soup-queue.c, - /cvs/helixcode/services/soup/src/soup-request.c: * Internal rehash - of handling cases where the connection limit is reached, involves - setting a timeout event source to check for the ability to create - a connection, and allowing either the timeout or the gnet connect - routine to be canceled depending on the current connect - state. Clients should now use soup_context_cancel_connect() to - cancel a connection in progress. - - * /cvs/helixcode/services/soup/src/soup-queue.c: * Don't use glibc - sscanf extensions. - -2000-12-11 alex <alex@ximian.com> - - * /cvs/helixcode/services/soup/src/soup-queue.c: Better error - checking on HTTP response line. Avoid doing a lookup for every - used header by iterating the hash table and doing a strcmp for all - known headers. This is not necessarily faster for several cases, - but it allows us to gather custom headers at the same time and - avoid a second iteration. - - * /cvs/helixcode/services/soup/configure.in, - /cvs/helixcode/services/soup/src/Makefile.am, - /cvs/helixcode/services/soup/src/soup-context.c, - /cvs/helixcode/services/soup/src/soup-context.h, - /cvs/helixcode/services/soup/src/soup.h, - /cvs/helixcode/services/soup/src/soup-misc.c, - /cvs/helixcode/services/soup/src/soup-misc.h, - /cvs/helixcode/services/soup/src/soup-private.h, - /cvs/helixcode/services/soup/src/soup-queue.c, - /cvs/helixcode/services/soup/src/soup-queue.h, - /cvs/helixcode/services/soup/src/soup-request.c, - /cvs/helixcode/services/soup/src/soup-request.h, - /cvs/helixcode/services/soup/src/soup-uri.h: * Rewrote the - connection pool logic, and cleaned up the request queueing loop. - - * Added ref/unref to SoupContext. - - * Made getting a connection for a SoupContext generic which cleans - up the code and makes it useable for purposes other than soup. - - * Connection limits handling moved to the connection pooling to - avoid races, and allows for better handling when we have hit the - connection limit. - - * Added soup-misc.[ch] which provide global functions for getting - and setting the proxy context and the connection limit. - - * Changed proxy to be a SoupContext. - - * Support for http headers near completion. - - * Added support for custom request headers which can override the - standard headers without duplication. - - * Lots of code reorg and cleaning up. - -2000-12-07 alex <alex@ximian.com> - - * /cvs/helixcode/services/soup/configure.in, - /cvs/helixcode/services/soup/src/soup-queue.c: Replaced CVS gnet - feature for setting TCP_NODELAY - -2000-12-06 alex <alex@ximian.com> - - * /cvs/helixcode/services/soup/acconfig.h, - /cvs/helixcode/services/soup/AUTHORS, - /cvs/helixcode/services/soup/autogen.sh, - /cvs/helixcode/services/soup/ChangeLog, - /cvs/helixcode/services/soup/configure.in, - /cvs/helixcode/services/soup/docs/soap-encoding.txt, - /cvs/helixcode/services/soup/docs/soap-envelope.txt, - /cvs/helixcode/services/soup/Makefile.am, - /cvs/helixcode/services/soup/NEWS, - /cvs/helixcode/services/soup/README, - /cvs/helixcode/services/soup/src/Makefile.am, - /cvs/helixcode/services/soup/src/soup-context.c, - /cvs/helixcode/services/soup/src/soup-context.h, - /cvs/helixcode/services/soup/src/soup.h, - /cvs/helixcode/services/soup/src/soup-private.h, - /cvs/helixcode/services/soup/src/soup-queue.c, - /cvs/helixcode/services/soup/src/soup-queue.h, - /cvs/helixcode/services/soup/src/soup-request.c, - /cvs/helixcode/services/soup/src/soup-request.h, - /cvs/helixcode/services/soup/src/soup-uri.c, - /cvs/helixcode/services/soup/src/soup-uri.h: Initial version + * libsoup/*: Merge soup-0-7 back onto the trunk. Remove + SOAP-specific stuff, Windows support, and other things that + weren't being maintained. + * soup-config.in, soupConf.sh: Kill these. We only support + pkg-config now. @@ -1,13 +1,14 @@ In order to build Soup, just follow the generic directions in the INSTALL file. -All changes to Soup must be approved by the maintainers before they can be -commited. Mail your patch (created using diff -u) with a detailed ChangeLog and -a description of changes to soup-list@ximian.com [1], and do not apply it until -it is approved by Alex or Dick. +All changes to Soup must be approved by the maintainers before they +can be commited. Mail your patch (created using diff -u) with a +detailed ChangeLog and a description of changes to +soup-list@ximian.com [1], and do not apply it until it is approved by +one of the maintainers. Please be sure to follow the GNOME Programming guidelines for all code -submitted. The programming guidelines can be found in the white-papers CVS -module. +submitted. The programming guidelines can be found in the white-papers +CVS module. [1] To subscribe to the Soup discussion list, send mail with the word "Subscribe" in the message body to soup-list-request@ximian.com. diff --git a/MAINTAINERS b/MAINTAINERS new file mode 100644 index 00000000..2a6f53a3 --- /dev/null +++ b/MAINTAINERS @@ -0,0 +1,3 @@ +Alex Graveley <alex@ximian.com> +Joe Shaw <joe@ximian.com> +Dan Winship <danw@ximian.com> diff --git a/Makefile.am b/Makefile.am index 8559c7cb..5b2c4dff 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,63 +1,9 @@ ## Process this file with automake to produce Makefile.in -SUBDIRS = src docs +SUBDIRS = libsoup -# I want to include tests in the distributed version, but that requires -# some automake deep magic to stop it trying to include generated files in -# the automated dependency logic. (hint: OMIT_DEPENDENCIES did SFA) -#DIST_SUBDIRS = $(SUBDIRS) tests - -EXTRA_DIST = \ - autogen.sh \ - soupConf.sh.in \ - soup_apacheConf.sh.in \ - soup_wsdlConf.sh.in \ - soup.m4 \ - soup.pc.in \ - soup.spec.in - -bin_SCRIPTS = soup-config - -soupConf.sh: $(top_srcdir)/soupConf.sh.in Makefile - sed -e 's?\@SOUP_LIBDIR\@?$(SOUP_LIBDIR)?g' \ - -e 's?\@SOUP_INCLUDEDIR\@?$(SOUP_INCLUDEDIR)?g' \ - -e 's?\@VERSION\@?$(VERSION)?g' \ - -e 's?\@SOUP_LIBS\@?$(SOUP_LIBS)?g' \ - < $(top_srcdir)/soupConf.sh.in > soupConf.tmp \ - && mv soupConf.tmp soupConf.sh - -soup_apacheConf.sh: $(top_srcdir)/soup_apacheConf.sh.in Makefile - sed -e 's?\@SOUP_APACHE_LIBDIR\@?$(SOUP_APACHE_LIBDIR)?g' \ - -e 's?\@SOUP_APACHE_INCLUDEDIR\@?$(SOUP_APACHE_INCLUDEDIR)?g' \ - -e 's?\@VERSION\@?$(VERSION)?g' \ - -e 's?\@SOUP_APACHE_LIBS\@?$(SOUP_APACHE_LIBS)?g' \ - < $(top_srcdir)/soup_apacheConf.sh.in > soup_apacheConf.tmp \ - && mv soup_apacheConf.tmp soup_apacheConf.sh - -soup_wsdlConf.sh: $(top_srcdir)/soup_wsdlConf.sh.in Makefile - sed -e 's?\@SOUP_WSDL_LIBDIR\@?$(SOUP_WSDL_LIBDIR)?g' \ - -e 's?\@SOUP_WSDL_INCLUDEDIR\@?$(SOUP_WSDL_INCLUDEDIR)?g' \ - -e 's?\@VERSION\@?$(VERSION)?g' \ - -e 's?\@SOUP_WSDL_LIBS\@?$(SOUP_WSDL_LIBS)?g' \ - < $(top_srcdir)/soup_wsdlConf.sh.in > soup_wsdlConf.tmp \ - && mv soup_wsdlConf.tmp soup_wsdlConf.sh - -confexecdir = $(libdir) -confexec_DATA = soupConf.sh soup_apacheConf.sh soup_wsdlConf.sh - -m4datadir = $(datadir)/aclocal -m4data_DATA = soup.m4 +EXTRA_DIST = soup-2.0.pc.in pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = soup.pc - -examples: - $(MAKE) -C tests - -dist-hook: soup.spec - cp soup.spec $(distdir) - -rpms: distcheck - rpm -ta $(top_builddir)/@PACKAGE@-@VERSION@.tar.gz +pkgconfig_DATA = soup-2.0.pc -CLEANFILES = soupConf.sh soup_apacheConf.sh soup_wsdlConf.sh @@ -1,18 +1,12 @@ -Soup is a SOAP (Simple Object Access Protocol) implementation in C. +Libsoup is an HTTP library implementation in C. It was originally part +of a SOAP (Simple Object Access Protocol) implementation called Soup, but +the SOAP and non-SOAP parts have now been split into separate packages. -It provides an queued asynchronous callback-based mechanism for sending and -servicing SOAP requests, and a WSDL (Web Service Definition Language) to C -compiler which generates client stubs and server skeletons for easily calling -and implementing SOAP methods. - -It uses the Glib main loop and is designed to work well with GTK -applications. This enables GNOME applications to access SOAP servers -on the network in a completely asynchronous fashion, very similar to the -Gtk+ programming model (a synchronous operation mode is also supported -for those who want it). - -The WSDL compiler will help you make your applications interoperate -with services that expose their descriptions through WSDL. +libsoup uses the Glib main loop and is designed to work well with GTK +applications. This enables GNOME applications to access HTTP servers +on the network in a completely asynchronous fashion, very similar to +the Gtk+ programming model (a synchronous operation mode is also +supported for those who want it). Features: * Completely Asynchronous @@ -20,24 +14,14 @@ Features: * HTTP chunked transfer support * HTTP, SOCKS4, and SOCKS5 authenticated proxy support * SSL Support using OpenSSL or Mozilla NSS - * Apache module server support * Client support for Digest, NTLM, and Basic authentication - * Standalone SOAP server support Planned Features: * Server digest authentication * Gconf configuration and proxy integration - * UDDI Support - * Disco support - * GTK or Bonobo object generation -To subscribe to the Soup discussion list, send mail with the word "Subscribe" in -the message body to soup-list-request@ximian.com. +To subscribe to the Soup discussion list, send mail with the word +"Subscribe" in the message body to soup-list-request@ximian.com. Licensing: - * The Soup runtime is licensed LGPL, see COPYING.LIB for more details. - * The WSDL compiler is licensed GPL, see COPYING for more details. - * The soup-ssl-proxy application is licensed GPL, see COPYING for more - details. This is in order to comply with the licensing restrictions - imposed by the SSL libraries used by Soup, while allowing the Soup - application libraries and runtime to remain LGPL. +libsoup is licensed under the LGPL, see COPYING for more details. @@ -2,147 +2,20 @@ # Run this to generate all the initial makefiles, etc. srcdir=`dirname $0` -PKG_NAME="the package." +test -z "$srcdir" && srcdir=. -DIE=0 +PKG_NAME="libsoup" -(autoconf --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`autoconf' installed to." - echo "Download the appropriate package for your distribution," - echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" - DIE=1 +(test -f $srcdir/configure.in \ + && test -f $srcdir/ChangeLog \ + && test -d $srcdir/libsoup) || { + echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" + echo " top-level $PKG_NAME directory" + exit 1 } -(grep "^AM_PROG_LIBTOOL" $srcdir/configure.in >/dev/null) && { - (libtool --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`libtool' installed." - echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 - } +which gnome-autogen.sh || { + echo "You need to install gnome-common from the GNOME CVS" + exit 1 } - -grep "^AM_GNU_GETTEXT" $srcdir/configure.in >/dev/null && { - grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \ - (gettext --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`gettext' installed." - echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 - } -} - -grep "^AM_GNOME_GETTEXT" $srcdir/configure.in >/dev/null && { - grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \ - (gettext --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`gettext' installed." - echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 - } -} - -(automake --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`automake' installed." - echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 - NO_AUTOMAKE=yes -} - - -# if no automake, don't bother testing for aclocal -test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: Missing \`aclocal'. The version of \`automake'" - echo "installed doesn't appear recent enough." - echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 -} - -if test "$DIE" -eq 1; then - exit 1 -fi - -if test -z "$*"; then - echo "**Warning**: I am going to run \`configure' with no arguments." - echo "If you wish to pass any to it, please specify them on the" - echo \`$0\'" command line." - echo -fi - -case $CC in -xlc ) - am_opt=--include-deps;; -esac - -for coin in `find $srcdir -name configure.in -print` -do - dr=`dirname $coin` - if test -f $dr/NO-AUTO-GEN; then - echo skipping $dr -- flagged as no auto-gen - else - echo processing $dr - macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin` - ( cd $dr - aclocalinclude="$ACLOCAL_FLAGS" - for k in $macrodirs; do - if test -d $k; then - aclocalinclude="$aclocalinclude -I $k" - ##else - ## echo "**Warning**: No such directory \`$k'. Ignored." - fi - done - if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then - if grep "sed.*POTFILES" configure.in >/dev/null; then - : do nothing -- we still have an old unmodified configure.in - else - echo "Creating $dr/aclocal.m4 ..." - test -r $dr/aclocal.m4 || touch $dr/aclocal.m4 - echo "Running gettextize... Ignore non-fatal messages." - echo "no" | gettextize --force --copy - echo "Making $dr/aclocal.m4 writable ..." - test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4 - fi - fi - if grep "^AM_GNOME_GETTEXT" configure.in >/dev/null; then - echo "Creating $dr/aclocal.m4 ..." - test -r $dr/aclocal.m4 || touch $dr/aclocal.m4 - echo "Running gettextize... Ignore non-fatal messages." - echo "no" | gettextize --force --copy - echo "Making $dr/aclocal.m4 writable ..." - test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4 - fi - if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then - echo "Running libtoolize..." - libtoolize --force --copy - fi - echo "Running aclocal $aclocalinclude ..." - aclocal $aclocalinclude - if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then - echo "Running autoheader..." - autoheader - fi - echo "Running automake --gnu $am_opt ..." - automake --add-missing --gnu $am_opt - echo "Running autoconf ..." - autoconf - ) - fi -done - -#conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c - -if test x$NOCONFIGURE = x; then - echo Running $srcdir/configure $conf_flags "$@" ... - $srcdir/configure $conf_flags "$@" \ - && echo Now type \`make\' to compile $PKG_NAME -else - echo Skipping configure process. -fi +USE_GNOME2_MACROS=1 . gnome-autogen.sh diff --git a/configure.in b/configure.in index 74aa9446..4629d660 100644 --- a/configure.in +++ b/configure.in @@ -2,13 +2,20 @@ dnl ******************************************* dnl *** Initialize automake and set version *** dnl ******************************************* -AC_INIT(src/libsoup/soup.h) +AC_PREREQ(2.53) +AC_INIT(libsoup, 2.0) +AC_CONFIG_SRCDIR(soup-2.0.pc.in) + +AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION) +AM_CONFIG_HEADER(config.h) +AM_MAINTAINER_MODE +AC_PROG_MAKE_SET # Increment on interface addition. Reset on removal. -SOUP_AGE=1 +SOUP_AGE=0 # Increment on interface add, remove, or change. -SOUP_CURRENT=4 +SOUP_CURRENT=0 # Increment on source change. Reset when CURRENT changes. SOUP_REVISION=0 @@ -17,14 +24,6 @@ AC_SUBST(SOUP_CURRENT) AC_SUBST(SOUP_REVISION) AC_SUBST(SOUP_AGE) -# Update in src/soup-core/soup-private.h for Windows -AM_INIT_AUTOMAKE(soup, 0.7.99) - -AM_CONFIG_HEADER(config.h) -AM_MAINTAINER_MODE -AC_PROG_MAKE_SET - - dnl *************************** dnl *** Set debugging flags *** dnl *************************** @@ -66,142 +65,19 @@ AM_PROG_LIBTOOL # This isn't a program, but it doesn't fit anywhere else... AC_FUNC_ALLOCA - -dnl *************************** -dnl *** Checks for glib 1.2 *** -dnl *************************** - -AM_PATH_GLIB(1.2.0,, - AC_MSG_ERROR([Cannot find GLIB: Is glib-config in path?])) - -GLIB_CFLAGS=`glib-config --cflags glib` -GLIB_LIBS=`glib-config --libs glib` -GMODULE_LIBS=`glib-config --libs gmodule` - -AC_SUBST(GLIB_CFLAGS) -AC_SUBST(GLIB_LIBS) -AC_SUBST(GMODULE_LIBS) - - -dnl **************************** -dnl *** Checks for gnome-xml *** -dnl **************************** - -FAVOUR_LIBXML=1 -AC_ARG_WITH(libxml, - [ --with-libxml=[1/2] which version of libxml to use [default=$FAVOUR_LIBXML]],, - with_libxml=$FAVOUR_LIBXML) - -if test "x$with_libxml" = "x" -o "$with_libxml" = "yes"; then - with_libxml=$FAVOUR_LIBXML -fi - -if test "$with_libxml" = "1"; then - AC_PATH_PROG(XML_CONFIG,xml-config,no) - if test x$XML_CONFIG = xno; then - AC_MSG_ERROR([Cannot find LIBXML: Is xml-config in path?]) - fi - - XML_MIN_VERSION=1.8.8 -else - if test "$with_libxml" = "2"; then - AC_PATH_PROG(XML_CONFIG,xml2-config,no) - if test x$XML_CONFIG = xno; then - AC_MSG_ERROR([Cannot find LIBXML2: Is xml2-config in path?]) - fi - - XML_MIN_VERSION=2.3.10 - else - AC_MSG_ERROR(Can't use libxml version $with_libxml) - fi -fi - -dnl Check version -XML_VERSION=`$XML_CONFIG --version` -ver=`echo $XML_VERSION | awk -F. '{printf("%d", ($1*1000+$2)*1000+$3);}'` -minver=`echo $XML_MIN_VERSION | awk -F. '{printf("%d", ($1*1000+$2)*1000+$3);}'` -if test "$minver" -gt "$ver" -then - AC_MSG_ERROR(Found libxml version $XML_VERSION. You need $XML_MIN_VERSION or newer) -fi - -XML_CFLAGS=`$XML_CONFIG --cflags` -XML_LIBS=`$XML_CONFIG --libs` - -AC_SUBST(XML_CFLAGS) -AC_SUBST(XML_LIBS) - - dnl *********************** -dnl *** Checks for popt *** +dnl *** Checks for glib *** dnl *********************** -AC_ARG_WITH(popt-includes, - [ --with-popt-includes Specify location of popt headers], - [popt_inc_prefix=-I$withval]) - -AC_ARG_WITH(popt-libs, - [ --with-popt-libs Specify location of popt libs], - [popt_prefix=$withval], - [popt_prefix=/usr/lib]) - -save_CPPFLAGS=$CPPFLAGS -save_LIBS=$LIBS -CPPFLAGS="$CPPFLAGS $popt_inc_prefix" -LIBS="$LIBS -L$prefix" - -AC_CHECK_LIB(popt, - poptGetContext, - [POPT_LIBS="$LIBS -lpopt"] , - AC_MSG_ERROR([popt is required])) -AC_CHECK_HEADERS(popt.h, [POPT_CFLAGS="$CFLAGS"], AC_MSG_ERROR([popt.h is required])) - -CPPFLAGS=$save_CPPFLAGS -LIBS=$save_LIBS - -AC_SUBST(POPT_CFLAGS) -AC_SUBST(POPT_LIBS) - - -dnl ********************************************** -dnl *** Variable substitution for soup*Conf.sh *** -dnl ********************************************** - -### soupConf.sh -SOUP_LIBDIR='-L${libdir}' -SOUP_INCLUDEDIR=" -I${includedir}/soup $GLIB_CFLAGS $XML_CFLAGS" -SOUP_LIBS="-lsoup $GLIB_LIBS $XML_LIBS" - -AC_SUBST(SOUP_LIBDIR) -AC_SUBST(SOUP_INCLUDEDIR) -AC_SUBST(SOUP_LIBS) - -### soup-apacheConf.sh -SOUP_APACHE_LIBDIR='-L${libdir}' -SOUP_APACHE_INCLUDEDIR="$SOUP_INCLUDEDIR $APACHE_CFLAGS" -SOUP_APACHE_LIBS="$SOUP_LIBS -lsoup-apache $APACHE_LIBS" - -AC_SUBST(SOUP_APACHE_LIBDIR) -AC_SUBST(SOUP_APACHE_INCLUDEDIR) -AC_SUBST(SOUP_APACHE_LIBS) - -### soup-wsdlConf.sh -SOUP_WSDL_LIBDIR='-L${libdir}' -SOUP_WSDL_INCLUDEDIR=" -I${includedir}/soup $GLIB_CFLAGS $XML_CFLAGS" -SOUP_WSDL_LIBS="$SOUP_LIBS -lwsdl" - -AC_SUBST(SOUP_WSDL_LIBDIR) -AC_SUBST(SOUP_WSDL_INCLUDEDIR) -AC_SUBST(SOUP_WSDL_LIBS) - +PKG_CHECK_MODULES(GLIB, glib-2.0) +AC_SUBST(GLIB_CFLAGS) +AC_SUBST(GLIB_LIBS) dnl ********************************* dnl *** Networking library checks *** dnl ********************************* -AC_CHECK_HEADERS(unistd.h) -AC_CHECK_HEADERS(netinet/in.h netinet/tcp.h) -AC_CHECK_HEADERS(sys/socket.h sys/sockio.h sys/poll.h sys/param.h sys/wait.h) +AC_CHECK_HEADERS(sys/sockio.h sys/poll.h sys/param.h) AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h) AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket)) @@ -228,7 +104,8 @@ AC_CHECK_FUNC(gethostbyname_r, dnl Have glibc gethostbyname_r AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIBC) + AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIBC, 1, + [Define if you have a glibc-style gethostbyname_r()]) HAVE_GETHOSTBYNAME_R=yes ], [ @@ -250,7 +127,8 @@ AC_CHECK_FUNC(gethostbyname_r, dnl Have Solaris/Irix gethostbyname_r AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_GETHOSTBYNAME_R_SOLARIS) + AC_DEFINE(HAVE_GETHOSTBYNAME_R_SOLARIS, 1, + [Define if you have a Solaris-style gethostbyname_r()]) HAVE_GETHOSTBYNAME_R=yes ], [ @@ -268,7 +146,8 @@ AC_CHECK_FUNC(gethostbyname_r, dnl Have HP-UX gethostbyname_r AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_GETHOSTBYNAME_R_HPUX) + AC_DEFINE(HAVE_GETHOSTBYNAME_R_HPUX, 1, + [Define if you have an HP-UX-style gethostbyname_r()]) HAVE_GETHOSTBYNAME_R=yes ] @@ -276,16 +155,15 @@ AC_CHECK_FUNC(gethostbyname_r, )] )]) -### If we don't have gethostbyname_r, try to use Glib mutexes +# If we don't have gethostbyname_r, we'll use Glib mutexes, but give a warning if test -z "$HAVE_GETHOSTBYNAME_R"; then - AM_PATH_GLIB(1.2.0, - AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIB_MUTEX), [ - AC_MSG_WARN(You have neither Glib threads nor the function - gethostbyname_r. This means that calls to - gethostbyname (called by the Soup address - functions) will not be thread safe so could - malfunction in programs that use threads.) - ]) + AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIB_MUTEX, 1, + [Define if you have no gethostbyname_r()]) + AC_MSG_WARN([You have neither Glib threads nor the function + gethostbyname_r. This means that calls to + gethostbyname (called by the Soup address + functions) will not be thread safe so could + malfunction in programs that use threads.]) fi @@ -328,12 +206,14 @@ AC_ARG_WITH(openssl-libs, ### ### Allow for a custom SSL proxy name ### +SSL_PROXY_NAME=libsoup-ssl-proxy AC_ARG_WITH(ssl-proxy-name, - [ --with-ssl-proxy-name Custom name for ssl proxy executable [default=soup-ssl-proxy]], + [ --with-ssl-proxy-name Custom name for ssl proxy executable [default=libsoup-ssl-proxy]], [SSL_PROXY_NAME=$withval], - [SSL_PROXY_NAME=soup-ssl-proxy]) + [SSL_PROXY_NAME=libsoup-ssl-proxy]) -AC_DEFINE_UNQUOTED(SSL_PROXY_NAME, "${SSL_PROXY_NAME}") +AC_DEFINE_UNQUOTED(SSL_PROXY_NAME, "${SSL_PROXY_NAME}", + [The name to use for the SSL proxy binary. Defaults to libsoup-ssl-proxy]) AC_SUBST(SSL_PROXY_NAME) ### @@ -361,7 +241,8 @@ if test "x$enable_ssl" = xyes; then OPENSSL_LIBS="-L$openssl_prefix -lssl -lcrypto $DL_LDFLAGS" fi OPENSSL_CFLAGS=$CPPFLAGS - AC_DEFINE(HAVE_OPENSSL) + AC_DEFINE(HAVE_OPENSSL, 1, + [Defined if you are using OpenSSL for SSL support]) else OPENSSL_LIBS= OPENSSL_CFLAGS= @@ -387,7 +268,8 @@ if test "x$enable_ssl" = xyes; then NSS_LIBS="-lpthread -L$nspr_prefix -lnspr4 -lplc4 -lplds4 $nss_prefix -lnss3 -lssl3" fi NSS_CFLAGS=$CPPFLAGS - AC_DEFINE(HAVE_NSS) + AC_DEFINE(HAVE_NSS, 1, + [Defined if you are using Mozilla NSS for SSL support]) else NSS_LIBS= NSS_CFLAGS= @@ -399,30 +281,6 @@ if test "x$enable_ssl" = xyes; then fi -dnl ************************* -dnl *** Checks for Apache *** -dnl ************************* - -enable_apache="no" - -AC_PATH_PROG(APXS,apxs,no) -if test x$APXS != xno; then - APACHE_CFLAGS="-I`apxs -q INCLUDEDIR CFLAGS`" - APACHE_LIBS=`apxs -q LDFLAGS_SHLIB LIBS_SHLIB` - - save_CPPFLAGS=$CPPFLAGS - CPPFLAGS=$APACHE_CFLAGS - AC_CHECK_HEADERS(httpd.h http_config.h http_core.h http_log.h http_main.h http_protocol.h, - [enable_apache="yes"], - [enable_apache="no" - break]) - CPPFLAGS=$save_CPPFLAGS - - AC_SUBST(APACHE_CFLAGS) - AC_SUBST(APACHE_LIBS) -fi - - dnl ********************************************* dnl *** Checks for gtk-doc (lifted from glib) *** dnl ********************************************* @@ -463,64 +321,6 @@ dnl to make this work with the tarballs. AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes) -dnl ******************************************************* -dnl *** Type alignment test (based on the one in ORBit) *** -dnl ******************************************************* - -AC_DEFUN(AC_CHECK_ALIGNOF, -[changequote(<<, >>)dnl -dnl The name to #define. -define(<<AC_TYPE_NAME>>, translit(alignof_$1, [a-z *], [A-Z_P]))dnl -dnl The cache variable name. -define(<<AC_CV_NAME>>, translit(ac_cv_alignof_$1, [ *], [_p]))dnl -changequote([, ])dnl -AC_MSG_CHECKING(alignment of $1) -align_save_libs="$LIBS" -LIBS="$GLIB_LIBS $LIBS" -AC_CACHE_VAL(AC_CV_NAME, -[AC_TRY_RUN([ -#include <stdio.h> -#include <glib.h> -typedef struct {char s1;} gstruct; -struct test {char s1; $1 s2;}; -main() -{ - FILE *f=fopen("conftestval", "w"); - if (!f) exit(1); - fprintf(f, "%d\n", &(((struct test*)0)->s2)); - exit(0); -}], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, AC_CV_NAME=0)])dnl -AC_MSG_RESULT($AC_CV_NAME) -LIBS="$align_save_libs" -AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME) -undefine([AC_TYPE_NAME])dnl -undefine([AC_CV_NAME])dnl -]) - -orig_CPPFLAGS=$CPPFLAGS -CPPFLAGS=$GLIB_CFLAGS -AC_CHECK_ALIGNOF(gboolean) -AC_CHECK_ALIGNOF(gchar) -AC_CHECK_ALIGNOF(guchar) -AC_CHECK_ALIGNOF(gint) -AC_CHECK_ALIGNOF(guint) -AC_CHECK_ALIGNOF(gshort) -AC_CHECK_ALIGNOF(gushort) -AC_CHECK_ALIGNOF(glong) -AC_CHECK_ALIGNOF(gulong) -AC_CHECK_ALIGNOF(gint8) -AC_CHECK_ALIGNOF(guint8) -AC_CHECK_ALIGNOF(gint16) -AC_CHECK_ALIGNOF(guint16) -AC_CHECK_ALIGNOF(gint32) -AC_CHECK_ALIGNOF(guint32) -AC_CHECK_ALIGNOF(gfloat) -AC_CHECK_ALIGNOF(gdouble) -AC_CHECK_ALIGNOF(gpointer) -AC_CHECK_ALIGNOF(gstruct) -CPPFLAGS=$orig_CPPFLAGS - - dnl ************************************* dnl *** Warnings to show if using GCC *** dnl ************************************* @@ -538,26 +338,36 @@ fi # Use reentrant functions CFLAGS="$CFLAGS -D_REENTRANT" +dnl ***************************** +dnl *** link proxy statically *** +dnl ***************************** +AC_ARG_ENABLE(static-proxy, + [ --enable-static-proxy Build ${SSL_PROXY_NAME} statically ]) + +if test x"$enable_static_proxy" = xyes; then + LINK_STATIC="-Wl,-Bstatic" + LINK_DYNAMIC="-Wl,-Bdynamic" + FORCE_SHLIBS="dl resolv rt nsl" + for lib in $FORCE_SHLIBS; do + OPENSSL_LIBS=`echo $OPENSSL_LIBS | sed "s/-l$lib/-Wl,-Bdynamic -l$lib -Wl,-Bstatic/"` + GMODULE_LIBS=`echo $GMODULE_LIBS | sed "s/-l$lib/-Wl,-Bdynamic -l$lib -Wl,-Bstatic/"` + done +else + LINK_STATIC= + LINK_DYNAMIC= +fi + +AC_SUBST(LINK_STATIC) +AC_SUBST(LINK_DYNAMIC) dnl ************************* dnl *** Output Everything *** dnl ************************* AC_OUTPUT([ - soup-config - soup.pc - soup.spec + soup-2.0.pc Makefile - docs/Makefile - docs/reference/Makefile - src/Makefile - src/libsoup/Makefile - src/libsoup-apache/Makefile - src/libwsdl/Makefile - src/soup-httpd/Makefile - src/soup-ssl-proxy/Makefile - src/soup-wsdl/Makefile - tests/Makefile + libsoup/Makefile ]) echo " @@ -568,9 +378,10 @@ Configuration: Compiler: ${CC} Build flags: ${CFLAGS} ${SOUP_DEBUG_FLAGS} + Static SSL Proxy: ${enable_static_proxy:-no} + SSL Proxy Name: ${SSL_PROXY_NAME} + OpenSSL support: ${enable_openssl} Mozilla NSS support: ${enable_nss} - Apache module support: ${enable_apache} - " diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am index 6763e827..5e0c5a72 100644 --- a/docs/reference/Makefile.am +++ b/docs/reference/Makefile.am @@ -9,7 +9,7 @@ DOC_MODULE=soup DOC_MAIN_SGML_FILE=soup-docs.sgml # The directory containing the source code. Relative to $(srcdir) -DOC_SOURCE_DIR=../../src +DOC_SOURCE_DIR=../../libsoup # Extra options to supply to gtkdoc-scan SCAN_OPTIONS=--deprecated-guards="G_DISABLE_DEPRECATED" diff --git a/libsoup/.cvsignore b/libsoup/.cvsignore index 69fb0bd8..0be24a01 100644 --- a/libsoup/.cvsignore +++ b/libsoup/.cvsignore @@ -4,3 +4,4 @@ .libs Makefile Makefile.in +libsoup-ssl-proxy diff --git a/libsoup/Makefile.am b/libsoup/Makefile.am index e47c5752..8e6f1697 100644 --- a/libsoup/Makefile.am +++ b/libsoup/Makefile.am @@ -1,71 +1,57 @@ ## Process this file with automake to produce Makefile.in -@SET_MAKE@ - INCLUDES = \ -DG_LOG_DOMAIN=\"SOUP\" \ -DSYSCONFDIR=\"$(sysconfdir)\" \ -DBINDIR=\"$(bindir)\" \ - -I$(top_srcdir)/src \ + -I$(top_srcdir) \ $(SOUP_DEBUG_FLAGS) \ $(GLIB_CFLAGS) \ - $(XML_CFLAGS) \ - $(NSS_CFLAGS) + $(NSS_CFLAGS) \ + $(OPENSSL_CFLAGS) -libsoupincludedir = $(includedir)/soup/libsoup +libsoupincludedir = $(includedir)/soup-2.0/libsoup libsoupinclude_HEADERS = \ soup.h \ soup-context.h \ - soup-dav.h \ - soup-dav-server.h \ - soup-env.h \ soup-error.h \ - soup-fault.h \ soup-headers.h \ soup-message.h \ soup-method.h \ soup-misc.h \ - soup-parser.h \ - soup-serializer.h \ + soup-ntlm.h \ soup-server-auth.h \ soup-server.h \ soup-socket.h \ soup-uri.h -lib_LTLIBRARIES = libsoup.la +lib_LTLIBRARIES = libsoup-2.0.la -libsoup_la_LDFLAGS = -version-info $(SOUP_CURRENT):$(SOUP_REVISION):$(SOUP_AGE) +libsoup_2_0_la_LDFLAGS = \ + -version-info $(SOUP_CURRENT):$(SOUP_REVISION):$(SOUP_AGE) -libsoup_la_LIBADD = \ +libsoup_2_0_la_LIBADD = \ $(GLIB_LIBS) \ - $(XML_LIBS) \ $(NSS_LIBS) -libsoup_la_SOURCES = \ +libsoup_2_0_la_SOURCES = \ md5-utils.h \ md5-utils.c \ soup-auth.h \ soup-auth.c \ soup-context.c \ - soup-dav.c \ - soup-dav-server.c \ - soup-env.c \ soup-error.c \ - soup-fault.c \ soup-headers.c \ soup-message.c \ soup-method.c \ soup-misc.c \ soup-nss.h \ soup-nss.c \ - soup-ntlm.h \ soup-ntlm.c \ - soup-parser.c \ soup-private.h \ soup-queue.h \ soup-queue.c \ - soup-serializer.c \ soup-server.c \ soup-server-auth.c \ soup-socket.c \ @@ -78,5 +64,19 @@ libsoup_la_SOURCES = \ soup-transfer.c \ soup-uri.c -EXTRA_DIST = +noinst_PROGRAMS = libsoup-ssl-proxy + +libsoup_ssl_proxy_LDADD = \ + $(LINK_STATIC) \ + $(OPENSSL_LIBS) \ + $(GLIB_LIBS) \ + $(LINK_DYNAMIC) + +libsoup_ssl_proxy_SOURCES = \ + soup-openssl.h \ + soup-openssl.c \ + soup-ssl-proxy.c +install-exec-hook: + $(mkinstalldirs) $(DESTDIR)$(bindir) + $(INSTALL_PROGRAM) libsoup-ssl-proxy $(DESTDIR)$(bindir)/$(SSL_PROXY_NAME) diff --git a/libsoup/soup-auth.c b/libsoup/soup-auth.c index dd282925..2b3b22d4 100644 --- a/libsoup/soup-auth.c +++ b/libsoup/soup-auth.c @@ -14,14 +14,7 @@ #include <config.h> #endif -#ifdef HAVE_UNISTD_H #include <unistd.h> -#endif - -#ifdef SOUP_WIN32 -#include <process.h> -#endif - #include <string.h> #include <stdlib.h> #include <glib.h> @@ -46,12 +39,6 @@ typedef struct { gchar *token; } SoupAuthBasic; -static gboolean -basic_compare_func (SoupAuth *a, SoupAuth *b) -{ - return FALSE; -} - static char * basic_auth_func (SoupAuth *auth, SoupMessage *message) { @@ -105,7 +92,6 @@ soup_auth_new_basic (void) auth = (SoupAuth *) basic; auth->type = SOUP_AUTH_TYPE_BASIC; - auth->compare_func = basic_compare_func; auth->parse_func = basic_parse_func; auth->init_func = basic_init_func; auth->auth_func = basic_auth_func; @@ -140,7 +126,6 @@ typedef struct { char *nonce; QOPType qop_options; AlgorithmType algorithm; - gboolean stale; /* These are generated by the client */ char *cnonce; @@ -148,12 +133,6 @@ typedef struct { QOPType qop; } SoupAuthDigest; -static gboolean -digest_compare_func (SoupAuth *a, SoupAuth *b) -{ - return ((SoupAuthDigest *) a)->stale; -} - static void digest_hex (guchar *digest, guchar hex[33]) { @@ -285,6 +264,7 @@ digest_auth_func (SoupAuth *auth, SoupMessage *message) url, response); + g_free (response); g_free (url); g_free (nc); @@ -369,15 +349,6 @@ digest_parse_func (SoupAuth *auth, const char *header) g_free (tmp); - tmp = soup_header_param_copy_token (tokens, "stale"); - - if (tmp && g_strcasecmp (tmp, "true") == 0) - digest->stale = TRUE; - else - digest->stale = FALSE; - - g_free (tmp); - tmp = soup_header_param_copy_token (tokens, "algorithm"); digest->algorithm = decode_algorithm (tmp); g_free (tmp); @@ -447,7 +418,6 @@ soup_auth_new_digest (void) auth = (SoupAuth *) digest; auth->type = SOUP_AUTH_TYPE_DIGEST; - auth->compare_func = digest_compare_func; auth->parse_func = digest_parse_func; auth->init_func = digest_init_func; auth->auth_func = digest_auth_func; @@ -462,6 +432,8 @@ soup_auth_new_digest (void) /* We're just going to do qop=auth for now */ digest->qop = QOP_AUTH; + g_free (bgen); + return auth; } @@ -474,15 +446,8 @@ typedef struct { SoupAuth auth; gchar *response; gchar *header; - gboolean completed; } SoupAuthNTLM; -static gboolean -ntlm_compare_func (SoupAuth *a, SoupAuth *b) -{ - return !((SoupAuthNTLM *)b)->completed; -} - /* * SoupAuthNTLMs are one time use. Just return the response, and set our * reference to NULL so future requests do not include this header. @@ -530,41 +495,42 @@ ntlm_parse (SoupAuth *sa, const char *header) g_strstrip (auth->header); } -/* - * FIXME: Because NTLM is a two step process, we parse the host and domain out - * of the context's uri twice. This is because there is no way to reparse - * a new header with an existing SoupAuth, so a new one is created for - * each negotiation step. - */ static void ntlm_init (SoupAuth *sa, const SoupUri *uri) { SoupAuthNTLM *auth = (SoupAuthNTLM *) sa; - gchar *host, *domain; - - host = ntlm_get_authmech_token (uri, "host="); - domain = ntlm_get_authmech_token (uri, "domain="); if (strlen (auth->header) < sizeof ("NTLM")) auth->response = soup_ntlm_request (); else { - gchar lm_hash [21], nt_hash [21]; - - soup_ntlm_lanmanager_hash (uri->passwd, lm_hash); - soup_ntlm_nt_hash (uri->passwd, nt_hash); - - auth->response = - soup_ntlm_response (auth->header, - uri->user, - (gchar *) &lm_hash, - (gchar *) &nt_hash, - host, - domain); - auth->completed = TRUE; - } + gchar *host, *domain, *nonce; + + host = ntlm_get_authmech_token (uri, "host="); + domain = ntlm_get_authmech_token (uri, "domain="); + + if (!soup_ntlm_parse_challenge (auth->header, + &nonce, + domain ? NULL : &domain)) + auth->response = NULL; + else { + auth->response = + soup_ntlm_response (nonce, + uri->user, + uri->passwd, + host, + domain); + g_free (nonce); + } - g_free (host); - g_free (domain); + g_free (host); + g_free (domain); + + /* Set this now so that if the server returns 401, + * soup will fail instead of looping (since that + * probably means the password was incorrect). + */ + sa->status = SOUP_AUTH_STATUS_SUCCESSFUL; + } g_free (auth->header); auth->header = NULL; @@ -587,7 +553,6 @@ ntlm_new (void) auth = g_new0 (SoupAuthNTLM, 1); auth->auth.type = SOUP_AUTH_TYPE_NTLM; - auth->auth.compare_func = ntlm_compare_func; auth->auth.parse_func = ntlm_parse; auth->auth.init_func = ntlm_init; auth->auth.auth_func = ntlm_auth; @@ -626,6 +591,33 @@ soup_auth_lookup (SoupContext *ctx) } void +soup_auth_invalidate (SoupAuth *auth, SoupContext *ctx) +{ + SoupHost *server; + const SoupUri *uri; + SoupAuth *old_auth; + char *old_path; + + g_return_if_fail (ctx != NULL); + g_return_if_fail (auth != NULL); + + server = ctx->server; + + if (!server->valid_auths) + return; + + uri = soup_context_get_uri (ctx); + if (g_hash_table_lookup_extended (server->valid_auths, + uri->path, + (gpointer *) &old_path, + (gpointer *) &old_auth)) { + g_hash_table_remove (server->valid_auths, old_path); + g_free (old_path); + soup_auth_free (old_auth); + } +} + +void soup_auth_set_context (SoupAuth *auth, SoupContext *ctx) { SoupHost *server; @@ -647,6 +639,9 @@ soup_auth_set_context (SoupAuth *auth, SoupContext *ctx) uri->path, (gpointer *) &old_path, (gpointer *) &old_auth)) { + if (auth == old_auth) + return; + g_hash_table_remove (server->valid_auths, old_path); g_free (old_path); soup_auth_free (old_auth); @@ -673,7 +668,8 @@ static AuthScheme known_auth_schemes [] = { }; SoupAuth * -soup_auth_new_from_header_list (const GSList *vals) +soup_auth_new_from_header_list (const SoupUri *uri, + const GSList *vals) { gchar *header = NULL; AuthScheme *scheme = NULL, *iter; @@ -682,9 +678,14 @@ soup_auth_new_from_header_list (const GSList *vals) g_return_val_if_fail (vals != NULL, NULL); while (vals) { - for (iter = known_auth_schemes; iter->scheme; iter++) { - gchar *tryheader = vals->data; + gchar *tryheader = vals->data; + for (iter = known_auth_schemes; iter->scheme; iter++) { + if (uri->authmech && + g_strncasecmp (uri->authmech, + iter->scheme, + strlen (iter->scheme)) != 0) + continue; if (!g_strncasecmp (tryheader, iter->scheme, strlen (iter->scheme))) { @@ -706,8 +707,7 @@ soup_auth_new_from_header_list (const GSList *vals) auth = scheme->ctor (); if (!auth) return NULL; - if (!auth->compare_func || - !auth->parse_func || + if (!auth->parse_func || !auth->init_func || !auth->auth_func || !auth->free_func) @@ -744,18 +744,3 @@ soup_auth_free (SoupAuth *auth) g_free (auth->realm); auth->free_func (auth); } - -gboolean -soup_auth_invalidates_prior (SoupAuth *new_auth, SoupAuth *old_auth) -{ - g_return_val_if_fail (new_auth != NULL, FALSE); - g_return_val_if_fail (old_auth != NULL, TRUE); - - if (new_auth == old_auth) - return FALSE; - - if (new_auth->type != old_auth->type) - return TRUE; - - return new_auth->compare_func (new_auth, old_auth); -} diff --git a/libsoup/soup-auth.h b/libsoup/soup-auth.h index 75a49459..f1634539 100644 --- a/libsoup/soup-auth.h +++ b/libsoup/soup-auth.h @@ -15,13 +15,22 @@ #include <libsoup/soup-message.h> #include <libsoup/soup-misc.h> -typedef struct _SoupAuth SoupAuth; +typedef enum _SoupAuthStatus SoupAuthStatus; +typedef struct _SoupAuth SoupAuth; + +enum _SoupAuthStatus { + SOUP_AUTH_STATUS_INVALID = 0, + SOUP_AUTH_STATUS_PENDING, + SOUP_AUTH_STATUS_FAILED, + SOUP_AUTH_STATUS_SUCCESSFUL +}; + struct _SoupAuth { SoupAuthType type; gchar *realm; - gboolean (*compare_func) (SoupAuth *a, - SoupAuth *b); + SoupAuthStatus status; + SoupMessage *controlling_msg; void (*parse_func) (SoupAuth *auth, const gchar *header); @@ -40,7 +49,11 @@ SoupAuth *soup_auth_lookup (SoupContext *ctx); void soup_auth_set_context (SoupAuth *auth, SoupContext *ctx); -SoupAuth *soup_auth_new_from_header_list (const GSList *header); +void soup_auth_invalidate (SoupAuth *auth, + SoupContext *ctx); + +SoupAuth *soup_auth_new_from_header_list (const SoupUri *uri, + const GSList *header); void soup_auth_initialize (SoupAuth *auth, const SoupUri *uri); @@ -50,7 +63,4 @@ void soup_auth_free (SoupAuth *auth); gchar *soup_auth_authorize (SoupAuth *auth, SoupMessage *msg); -gboolean soup_auth_invalidates_prior (SoupAuth *new_auth, - SoupAuth *old_auth); - #endif /* SOUP_AUTH_H */ diff --git a/libsoup/soup-context.c b/libsoup/soup-context.c index 28d2c5f3..bd21d69d 100644 --- a/libsoup/soup-context.c +++ b/libsoup/soup-context.c @@ -1,6 +1,6 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * soup-context.c: Asyncronous Callback-based SOAP Request Queue. + * soup-context.c: Asyncronous Callback-based HTTP Request Queue. * * Authors: * Alex Graveley (alex@helixcode.com) @@ -12,10 +12,7 @@ #include <config.h> #endif -#ifdef HAVE_UNISTD_H #include <unistd.h> -#endif - #include <string.h> #include <stdlib.h> #include <glib.h> @@ -23,16 +20,9 @@ #include <fcntl.h> #include <sys/types.h> -#ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> -#endif - -#ifdef HAVE_NETINET_TCP_H #include <netinet/tcp.h> -#endif -#ifdef HAVE_NETINET_IN_H #include <netinet/in.h> -#endif #include "soup-auth.h" #include "soup-context.h" @@ -85,17 +75,31 @@ static guint soup_context_uri_hash (gconstpointer key) { const SoupUri *uri = key; - guint ret = 0; - - ret += uri->protocol; - ret += g_str_hash (uri->path ? uri->path : ""); - ret += g_str_hash (uri->querystring ? uri->querystring : ""); - ret += g_str_hash (uri->user ? uri->user : ""); - ret += g_str_hash (uri->passwd ? uri->passwd : ""); + guint ret; + + ret = uri->protocol; + if (uri->path) + ret += g_str_hash (uri->path); + if (uri->querystring) + ret += g_str_hash (uri->querystring); + if (uri->user) + ret += g_str_hash (uri->user); + if (uri->passwd) + ret += g_str_hash (uri->passwd); return ret; } +static inline gboolean +parts_equal (const char *one, const char *two) +{ + if (!one && !two) + return TRUE; + if (!one || !two) + return FALSE; + return !strcmp (one, two); +} + /** * soup_context_uri_equal: * @v1: a %SoupUri @@ -110,18 +114,18 @@ soup_context_uri_equal (gconstpointer v1, gconstpointer v2) const SoupUri *one = v1; const SoupUri *two = v2; - if (one->protocol == two->protocol && - !strcmp (one->path ? one->path : "", - two->path ? two->path : "") && - !strcmp (one->querystring ? one->querystring : "", - two->querystring ? two->querystring : "") && - !strcmp (one->user ? one->user : "", - two->user ? two->user : "") && - !strcmp (one->passwd ? one->passwd : "", - two->passwd ? two->passwd : "")) - return TRUE; + if (one->protocol != two->protocol) + return FALSE; + if (!parts_equal (one->path, two->path)) + return FALSE; + if (!parts_equal (one->user, two->user)) + return FALSE; + if (!parts_equal (one->passwd, two->passwd)) + return FALSE; + if (!parts_equal (one->querystring, two->querystring)) + return FALSE; - return FALSE; + return TRUE; } /** @@ -545,8 +549,10 @@ soup_context_cancel_connect (SoupConnectId tag) if (data->timeout_tag) g_source_remove (data->timeout_tag); - else if (data->connect_tag) + else if (data->connect_tag) { + connection_count--; soup_socket_connect_cancel (data->connect_tag); + } g_free (data); } @@ -590,14 +596,12 @@ soup_connection_release (SoupConnection *conn) static void soup_connection_setup_socket (GIOChannel *channel) { -#if TCP_NODELAY && !SOUP_WIN32 int yes = 1, flags = 0, fd = g_io_channel_unix_get_fd (channel); setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &yes, sizeof(yes)); flags = fcntl(fd, F_GETFL, 0); fcntl (fd, F_SETFL, flags | O_NONBLOCK); -#endif } /** @@ -628,7 +632,7 @@ soup_connection_get_iochannel (SoupConnection *conn) } /** - * soup_connection_set_keepalive: + * soup_connection_set_keep_alive: * @conn: a %SoupConnection. * @keep_alive: boolean keep-alive value. * @@ -642,7 +646,7 @@ soup_connection_set_keep_alive (SoupConnection *conn, gboolean keep_alive) } /** - * soup_connection_set_keepalive: + * soup_connection_is_keep_alive: * @conn: a %SoupConnection. * * Returns the keep-alive flag for the %SoupConnection pointed to by diff --git a/libsoup/soup-context.h b/libsoup/soup-context.h index c10fe217..e0b008aa 100644 --- a/libsoup/soup-context.h +++ b/libsoup/soup-context.h @@ -1,6 +1,6 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * soup-context.h: Asyncronous Callback-based SOAP Request Queue. + * soup-context.h: Asyncronous Callback-based HTTP Request Queue. * * Authors: * Alex Graveley (alex@helixcode.com) diff --git a/libsoup/soup-headers.c b/libsoup/soup-headers.c index 99cf232f..6924f392 100644 --- a/libsoup/soup-headers.c +++ b/libsoup/soup-headers.c @@ -1,6 +1,6 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * soup-headers.c: Asyncronous Callback-based SOAP Request Queue. + * soup-headers.c: Asyncronous Callback-based HTTP Request Queue. * * Authors: * Alex Graveley (alex@ximian.com) @@ -121,7 +121,7 @@ soup_headers_parse_request (gchar *str, guint http_major, http_minor; gchar method[16], path[1024]; - if (!str || !*str || len < sizeof ("GET / HTTP/0.0\r\n\r\n")) + if (!str || !*str || len < sizeof ("GET / HTTP/0.0\r\n\r\n") - 1) goto THROW_MALFORMED_HEADER; if (sscanf (str, diff --git a/libsoup/soup-headers.h b/libsoup/soup-headers.h index 5f33480c..70aaa7ba 100644 --- a/libsoup/soup-headers.h +++ b/libsoup/soup-headers.h @@ -1,6 +1,6 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * soup-headers.h: Asyncronous Callback-based SOAP Request Queue. + * soup-headers.h: Asyncronous Callback-based HTTP Request Queue. * * Authors: * Alex Graveley (alex@ximian.com) diff --git a/libsoup/soup-message.c b/libsoup/soup-message.c index 654ee19c..16e87fce 100644 --- a/libsoup/soup-message.c +++ b/libsoup/soup-message.c @@ -1,6 +1,6 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * soup-message.c: Asyncronous Callback-based SOAP Request Queue. + * soup-message.c: Asyncronous Callback-based HTTP Request Queue. * * Authors: * Alex Graveley (alex@helixcode.com) @@ -17,18 +17,6 @@ #include "soup-queue.h" #include "soup-transfer.h" -typedef struct { - SoupHandlerEvent type; - gchar *name; - SoupHandlerWhen order; - SoupHandlerFilter filter; - SoupHandlerFn handler_cb; - gpointer user_data; - - SoupMessage *msg; - guint timeout_tag; -} SoupHandlerData; - /** * soup_message_new: * @context: a %SoupContext for the destination endpoint. @@ -193,6 +181,11 @@ soup_message_cleanup (SoupMessage *req) req->connection); req->priv->read_tag = 0; req->connection = NULL; + /* + * The buffer doesn't belong to us until the message is + * finished. + */ + req->response.owner = SOUP_BUFFER_STATIC; } if (req->priv->read_tag) { @@ -219,22 +212,6 @@ soup_message_cleanup (SoupMessage *req) } static void -handler_free (SoupHandlerData *data) -{ - if (data->filter.type == SOUP_FILTER_HEADER) - g_free ((gchar *) data->filter.data.header); - - if (data->timeout_tag) - g_source_remove (data->timeout_tag); - - data->msg->priv->content_handlers = - g_slist_remove (data->msg->priv->content_handlers, data); - - g_free (data->name); - g_free (data); -} - -static void finalize_message (SoupMessage *req) { if (req->context) @@ -251,10 +228,8 @@ finalize_message (SoupMessage *req) soup_message_clear_headers (req->response_headers); g_hash_table_destroy (req->response_headers); - while (req->priv->content_handlers) { - SoupHandlerData *data = req->priv->content_handlers->data; - handler_free (data); - } + g_slist_foreach (req->priv->content_handlers, (GFunc) g_free, NULL); + g_slist_free (req->priv->content_handlers); g_free ((gchar *) req->errorphrase); g_free (req->priv); @@ -322,6 +297,11 @@ void soup_message_cancel (SoupMessage *msg) { soup_message_set_error (msg, SOUP_ERROR_CANCELLED); + + /* Kill the connection as a safety measure */ + if (msg->connection) + soup_connection_set_keep_alive (msg->connection, FALSE); + soup_message_issue_callback (msg); } @@ -513,6 +493,122 @@ soup_message_foreach_remove_header (GHashTable *hash, } /** + * soup_message_set_request_header: + * @req: a %SoupMessage. + * @name: header name. + * @value: header value. + * + * ** DEPRECATED ** + * + * Adds a new transport header to be sent on an outgoing request. Passing a NULL + * @value will remove all headers with a name equal to @name. + */ +void +soup_message_set_request_header (SoupMessage *req, + const gchar *name, + const gchar *value) +{ + g_return_if_fail (req != NULL); + g_return_if_fail (name != NULL || name [0] != '\0'); + + g_warning ("soup_message_set_request_header is DEPRECATED. Use " + "soup_message_add_header, with msg->request_headers as " + "the first argument.\n"); + + soup_message_add_header (req->request_headers, name, value); +} + +/** + * soup_message_get_request_header: + * @req: a %SoupMessage. + * @name: header name. + * + * ** DEPRECATED ** + * + * Lookup the first transport request header with a key equal to @name. + * + * Return value: the header's value or NULL if not found. + */ +const gchar * +soup_message_get_request_header (SoupMessage *req, + const gchar *name) +{ + GSList *vals; + g_return_val_if_fail (req != NULL, NULL); + g_return_val_if_fail (name != NULL || name [0] != '\0', NULL); + + g_warning ("soup_message_get_request_header is DEPRECATED. Use " + "soup_message_get_header, with msg->request_headers as " + "the first argument.\n"); + + if (req->request_headers) { + vals = g_hash_table_lookup (req->request_headers, name); + if (vals) + return vals->data; + } + + return NULL; +} + +/** + * soup_message_set_response_header: + * @req: a %SoupMessage. + * @name: header name. + * @value: header value. + * + * ** DEPRECATED ** + * + * Adds a new transport header to be sent on an outgoing response. Passing a + * NULL @value will remove all headers with a name equal to @name. + */ +void +soup_message_set_response_header (SoupMessage *req, + const gchar *name, + const gchar *value) +{ + g_return_if_fail (req != NULL); + g_return_if_fail (name != NULL || name [0] != '\0'); + + g_warning ("soup_message_set_response_header is DEPRECATED. Use " + "soup_message_add_header, with msg->response_headers as " + "the first argument.\n"); + + soup_message_add_header (req->response_headers, name, value); +} + +/** + * soup_message_get_response_header: + * @req: a %SoupMessage. + * @name: header name. + * + * ** DEPRECATED ** + * + * Lookup the transport response header with a key equal to @name. + * + * Return value: the header's value or NULL if not found. + */ +const gchar * +soup_message_get_response_header (SoupMessage *req, + const gchar *name) +{ + GSList *vals; + g_return_val_if_fail (req != NULL, NULL); + g_return_val_if_fail (name != NULL || name [0] != '\0', NULL); + + g_warning ("soup_message_get_response_header is DEPRECATED. Use " + "soup_message_get_header, with msg->response_headers as " + "the first argument.\n"); + + if (req->response_headers) { + vals = g_hash_table_lookup (req->response_headers, name); + if (vals) + return vals->data; + } + + return NULL; +} + +/** * soup_message_queue: * @req: a %SoupMessage. * @callback: a %SoupCallbackFn which will be called after the message completes @@ -604,6 +700,7 @@ requeue_read_finished (const SoupDataBuffer *buf, if (!soup_connection_is_keep_alive (msg->connection)) requeue_read_error (FALSE, data); else { + g_free (data); msg->connection = NULL; soup_queue_message (msg, @@ -677,15 +774,56 @@ soup_message_send (SoupMessage *msg) return msg->errorclass; } -static SoupHandlerResult -authorize_handler (SoupMessage *msg, gpointer user_data) +static void +maybe_validate_auth (SoupMessage *msg, gpointer user_data) { gboolean proxy = GPOINTER_TO_INT (user_data); + int auth_failure; + SoupContext *ctx; + SoupAuth *auth; + + if (proxy) { + ctx = soup_get_proxy (); + auth_failure = SOUP_ERROR_PROXY_UNAUTHORIZED; /* 407 */ + } + else { + ctx = msg->context; + auth_failure = SOUP_ERROR_UNAUTHORIZED; /* 401 */ + } + + auth = soup_auth_lookup (ctx); + if (!auth) + return; + + if (msg->errorcode == auth_failure) { + /* Pass through */ + } + else if (msg->errorclass == SOUP_ERROR_CLASS_SERVER_ERROR) { + /* + * We have no way of knowing whether our auth is any good + * anymore, so just invalidate it and start from the + * beginning next time. + */ + soup_auth_invalidate (auth, ctx); + } + else { + auth->status = SOUP_AUTH_STATUS_SUCCESSFUL; + auth->controlling_msg = NULL; + } +} /* maybe_validate_auth */ + +static void +authorize_handler (SoupMessage *msg, gboolean proxy) +{ const GSList *vals; - SoupAuth *auth, *old_auth; + SoupAuth *auth; SoupContext *ctx; const SoupUri *uri; + if (msg->connection->auth && + msg->connection->auth->status == SOUP_AUTH_STATUS_SUCCESSFUL) + goto THROW_CANT_AUTHENTICATE; + ctx = proxy ? soup_get_proxy () : msg->context; uri = soup_context_get_uri (ctx); @@ -695,18 +833,59 @@ authorize_handler (SoupMessage *msg, gpointer user_data) "WWW-Authenticate"); if (!vals) goto THROW_CANT_AUTHENTICATE; - auth = soup_auth_new_from_header_list (vals); + auth = soup_auth_lookup (ctx); + if (auth) { + g_assert (auth->status != SOUP_AUTH_STATUS_INVALID); + + if (auth->status == SOUP_AUTH_STATUS_PENDING) { + if (auth->controlling_msg == msg) { + auth->status = SOUP_AUTH_STATUS_FAILED; + goto THROW_CANT_AUTHENTICATE; + } + else { + soup_message_requeue (msg); + return; + } + } + else if (auth->status == SOUP_AUTH_STATUS_FAILED || + auth->status == SOUP_AUTH_STATUS_SUCCESSFUL) { + /* + * We've failed previously, but we'll give it + * another go, or we've been successful + * previously, but it's not working anymore. + * + * Invalidate the auth, so it's removed from the + * hash and try it again as if we never had it + * in the first place. + */ + soup_auth_invalidate (auth, ctx); + soup_message_requeue (msg); + return; + } + } + if (!auth) { - soup_message_set_error_full ( - msg, - proxy ? - SOUP_ERROR_CANT_AUTHENTICATE_PROXY : - SOUP_ERROR_CANT_AUTHENTICATE, - proxy ? - "Unknown authentication scheme required by " - "proxy" : - "Unknown authentication scheme required"); - return SOUP_HANDLER_RESTART; + auth = soup_auth_new_from_header_list (uri, vals); + + if (!auth) { + soup_message_set_error_full ( + msg, + proxy ? + SOUP_ERROR_CANT_AUTHENTICATE_PROXY : + SOUP_ERROR_CANT_AUTHENTICATE, + proxy ? + "Unknown authentication scheme " + "required by proxy" : + "Unknown authentication scheme " + "required"); + return; + } + + auth->status = SOUP_AUTH_STATUS_PENDING; + auth->controlling_msg = msg; + soup_message_add_handler (msg, SOUP_HANDLER_PRE_BODY, + maybe_validate_auth, + GINT_TO_POINTER (proxy)); } /* @@ -724,47 +903,38 @@ authorize_handler (SoupMessage *msg, gpointer user_data) } /* - * Initialize with auth data (possibly returned from auth callback). + * Initialize with auth data (possibly returned from + * auth callback). */ soup_auth_initialize (auth, uri); - if (auth->type == SOUP_AUTH_TYPE_NTLM) - old_auth = msg->connection->auth; - else - old_auth = soup_auth_lookup (ctx); - - if (old_auth) { - if (!soup_auth_invalidates_prior (auth, old_auth)) { - soup_auth_free (auth); - goto THROW_CANT_AUTHENTICATE; - } - } - if (auth->type == SOUP_AUTH_TYPE_NTLM) { - if (old_auth) + SoupAuth *old_auth = msg->connection->auth; + + if (old_auth) soup_auth_free (old_auth); msg->connection->auth = auth; } else soup_auth_set_context (auth, ctx); - return SOUP_HANDLER_RESEND; + soup_message_requeue (msg); + + return; THROW_CANT_AUTHENTICATE: soup_message_set_error (msg, proxy ? SOUP_ERROR_CANT_AUTHENTICATE_PROXY : SOUP_ERROR_CANT_AUTHENTICATE); - return SOUP_HANDLER_RESTART; } -static SoupHandlerResult +static void redirect_handler (SoupMessage *msg, gpointer user_data) { const gchar *new_loc; if (msg->errorclass != SOUP_ERROR_CLASS_REDIRECT || - msg->priv->msg_flags & SOUP_MESSAGE_NO_REDIRECT) - return SOUP_HANDLER_CONTINUE; + msg->priv->msg_flags & SOUP_MESSAGE_NO_REDIRECT) return; new_loc = soup_message_get_header (msg->response_headers, "Location"); @@ -798,141 +968,96 @@ redirect_handler (SoupMessage *msg, gpointer user_data) soup_message_set_context (msg, new_ctx); soup_context_unref (new_ctx); - return SOUP_HANDLER_RESEND; + soup_message_requeue (msg); } - return SOUP_HANDLER_CONTINUE; + return; INVALID_REDIRECT: soup_message_set_error_full (msg, SOUP_ERROR_MALFORMED, "Invalid Redirect URL"); - return SOUP_HANDLER_RESTART; } +typedef enum { + RESPONSE_HEADER_HANDLER = 1, + RESPONSE_ERROR_CODE_HANDLER, + RESPONSE_ERROR_CLASS_HANDLER +} SoupHandlerKind; + +typedef struct { + SoupHandlerType type; + SoupCallbackFn handler_cb; + gpointer user_data; + + SoupHandlerKind kind; + union { + guint errorcode; + SoupErrorClass errorclass; + const gchar *header; + } data; +} SoupHandlerData; + static SoupHandlerData global_handlers [] = { /* * Handle redirect response codes 300, 301, 302, 303, and 305. */ { - SOUP_HANDLER_HEADERS, - "redirect", - 0, - { - SOUP_FILTER_HEADER, - { - (guint) "Location" - }, - }, + SOUP_HANDLER_PRE_BODY, redirect_handler, NULL, + RESPONSE_HEADER_HANDLER, + { (guint) "Location" } }, /* * Handle authorization. */ { - SOUP_HANDLER_HEADERS, - "authenticate", - 0, - { - SOUP_FILTER_ERROR_CODE, - { - 401 - }, - }, - authorize_handler, + SOUP_HANDLER_PRE_BODY, + (SoupCallbackFn) authorize_handler, GINT_TO_POINTER (FALSE), + RESPONSE_ERROR_CODE_HANDLER, + { 401 } }, /* * Handle proxy authorization. */ { - SOUP_HANDLER_HEADERS, - "proxy-authenticate", - 0, - { - SOUP_FILTER_ERROR_CODE, - { - 407 - }, - }, - authorize_handler, + SOUP_HANDLER_PRE_BODY, + (SoupCallbackFn) authorize_handler, GINT_TO_POINTER (TRUE), + RESPONSE_ERROR_CODE_HANDLER, + { 407 } }, { 0 } }; -static inline SoupHandlerResult -run_handler (SoupMessage *msg, - SoupHandlerEvent invoke_type, - SoupHandlerEvent when, - SoupHandlerData *data) +static inline void +run_handler (SoupMessage *msg, + SoupHandlerType invoke_type, + SoupHandlerData *data) { - SoupHandlerResult result; + if (data->type != invoke_type) return; - if (data->type != invoke_type || data->order != when) - return SOUP_HANDLER_CONTINUE; - - switch (data->filter.type) { - case SOUP_FILTER_HEADER: + switch (data->kind) { + case RESPONSE_HEADER_HANDLER: if (!soup_message_get_header (msg->response_headers, - data->filter.data.header)) - return SOUP_HANDLER_CONTINUE; - break; - case SOUP_FILTER_ERROR_CODE: - if (msg->errorcode != data->filter.data.errorcode) - return SOUP_HANDLER_CONTINUE; - break; - case SOUP_FILTER_ERROR_CLASS: - if (msg->errorclass != data->filter.data.errorclass) - return SOUP_HANDLER_CONTINUE; - break; - case SOUP_FILTER_TIMEOUT: - return SOUP_HANDLER_CONTINUE; - default: - break; - } - - result = (*data->handler_cb) (msg, data->user_data); - - switch (result) { - case SOUP_HANDLER_STOP: - if (invoke_type == SOUP_HANDLER_FINISHED && - msg->errorclass != SOUP_ERROR_CLASS_INFORMATIONAL) - soup_message_issue_callback (msg); + data->data.header)) + return; break; - case SOUP_HANDLER_KILL: - soup_message_issue_callback (msg); + case RESPONSE_ERROR_CODE_HANDLER: + if (msg->errorcode != data->data.errorcode) return; break; - case SOUP_HANDLER_RESEND: - if (msg->status != SOUP_STATUS_QUEUED) - soup_message_queue (msg, - msg->priv->callback, - msg->priv->user_data); + case RESPONSE_ERROR_CLASS_HANDLER: + if (msg->errorclass != data->data.errorclass) return; break; default: - if (msg->status == SOUP_STATUS_QUEUED) - result = SOUP_HANDLER_RESEND; break; } - return result; + (*data->handler_cb) (msg, data->user_data); } -#define PROCESS_HANDLER_RESULT(result) ({ \ - switch (result) { \ - case SOUP_HANDLER_STOP: \ - return FALSE; \ - case SOUP_HANDLER_KILL: \ - case SOUP_HANDLER_RESEND: \ - return TRUE; \ - case SOUP_HANDLER_RESTART: \ - goto RESTART; \ - default: \ - break; \ - } \ -}) - /* * Run each handler with matching criteria (first per-message then global * handlers). If a handler requeues a message, we stop processing and terminate @@ -945,55 +1070,34 @@ run_handler (SoupMessage *msg, * processing. */ gboolean -soup_message_run_handlers (SoupMessage *msg, SoupHandlerEvent invoke_type) +soup_message_run_handlers (SoupMessage *msg, SoupHandlerType invoke_type) { GSList *list; SoupHandlerData *data; - SoupHandlerResult result; g_return_val_if_fail (msg != NULL, FALSE); - RESTART: - /* - * Pre-Global handlers - */ for (list = msg->priv->content_handlers; list; list = list->next) { data = list->data; - result = run_handler (msg, - invoke_type, - SOUP_HANDLER_FIRST, - data); - PROCESS_HANDLER_RESULT (result); + + run_handler (msg, invoke_type, data); + + if (msg->status == SOUP_STATUS_QUEUED || + msg->status == SOUP_STATUS_CONNECTING) return TRUE; } - /* - * Global handlers - */ for (data = global_handlers; data->type; data++) { - result = run_handler (msg, - invoke_type, - 0, - data); - PROCESS_HANDLER_RESULT (result); - } + run_handler (msg, invoke_type, data); - /* - * Post-Global handlers - */ - for (list = msg->priv->content_handlers; list; list = list->next) { - data = list->data; - result = run_handler (msg, - invoke_type, - SOUP_HANDLER_LAST, - data); - PROCESS_HANDLER_RESULT (result); + if (msg->status == SOUP_STATUS_QUEUED || + msg->status == SOUP_STATUS_CONNECTING) return TRUE; } /* - * Issue final callback if the invoke_type is FINISHED and the error + * Issue final callback if the invoke_type is POST_BODY and the error * class is not INFORMATIONAL. */ - if (invoke_type == SOUP_HANDLER_FINISHED && + if (invoke_type == SOUP_HANDLER_POST_BODY && msg->errorclass != SOUP_ERROR_CLASS_INFORMATIONAL) { soup_message_issue_callback (msg); return TRUE; @@ -1002,201 +1106,146 @@ soup_message_run_handlers (SoupMessage *msg, SoupHandlerEvent invoke_type) return FALSE; } -static gboolean -timeout_handler (gpointer user_data) +static void +add_handler (SoupMessage *msg, + SoupHandlerType type, + SoupCallbackFn handler_cb, + gpointer user_data, + SoupHandlerKind kind, + const gchar *header, + guint errorcode, + guint errorclass) { - SoupHandlerData *data = user_data; - SoupMessage *msg = data->msg; - SoupHandlerResult result; - - switch (data->type) { - case SOUP_HANDLER_PREPARE: - if (msg->status >= SOUP_STATUS_SENDING_REQUEST) - goto REMOVE_SOURCE; - case SOUP_HANDLER_HEADERS: - case SOUP_HANDLER_DATA: - if (msg->status >= SOUP_STATUS_READING_RESPONSE && - g_hash_table_size (msg->response_headers) > 0) - goto REMOVE_SOURCE; - case SOUP_HANDLER_FINISHED: - if (msg->status == SOUP_STATUS_FINISHED) - goto REMOVE_SOURCE; - } + SoupHandlerData *data; - result = (*data->handler_cb) (msg, data->user_data); + data = g_new0 (SoupHandlerData, 1); + data->type = type; + data->handler_cb = handler_cb; + data->user_data = user_data; + data->kind = kind; - switch (result) { - case SOUP_HANDLER_KILL: - soup_message_cancel (msg); + switch (kind) { + case RESPONSE_HEADER_HANDLER: + data->data.header = header; break; - case SOUP_HANDLER_RESEND: - soup_message_queue (msg, - msg->priv->callback, - msg->priv->user_data); + case RESPONSE_ERROR_CODE_HANDLER: + data->data.errorcode = errorcode; + break; + case RESPONSE_ERROR_CLASS_HANDLER: + data->data.errorclass = errorclass; break; default: break; } - REMOVE_SOURCE: - data->timeout_tag = 0; - return FALSE; + msg->priv->content_handlers = + g_slist_append (msg->priv->content_handlers, data); } void -soup_message_add_handler_full (SoupMessage *msg, - const gchar *name, - SoupHandlerEvent type, - SoupHandlerWhen order, - SoupHandlerFilter *filter, - SoupHandlerFn handler_cb, - gpointer user_data) +soup_message_add_header_handler (SoupMessage *msg, + const gchar *header, + SoupHandlerType type, + SoupCallbackFn handler_cb, + gpointer user_data) { - SoupHandlerData *data; - g_return_if_fail (msg != NULL); - g_return_if_fail (type != 0); - g_return_if_fail (order != 0); + g_return_if_fail (header != NULL); g_return_if_fail (handler_cb != NULL); - data = g_new0 (SoupHandlerData, 1); - data->type = type; - data->handler_cb = handler_cb; - data->user_data = user_data; - data->name = g_strdup (name); - data->order = order; - data->msg = msg; - - if (filter) { - data->filter.type = filter->type; - - switch (filter->type) { - case SOUP_FILTER_HEADER: - data->filter.data.header = - g_strdup (filter->data.header); - break; - case SOUP_FILTER_ERROR_CODE: - data->filter.data.errorcode = filter->data.errorcode; - break; - case SOUP_FILTER_ERROR_CLASS: - data->filter.data.errorclass = filter->data.errorclass; - break; - case SOUP_FILTER_TIMEOUT: - data->filter.data.timeout = filter->data.timeout; - data->timeout_tag = - g_timeout_add (filter->data.timeout * 1000, - timeout_handler, - data); - break; - default: - break; - } - } - - msg->priv->content_handlers = - g_slist_append (msg->priv->content_handlers, data); + add_handler (msg, + type, + handler_cb, + user_data, + RESPONSE_HEADER_HANDLER, + header, + 0, + 0); } void -soup_message_add_handler (SoupMessage *msg, - SoupHandlerEvent type, - SoupHandlerFilter *filter, - SoupHandlerFn handler_cb, - gpointer user_data) +soup_message_add_error_code_handler (SoupMessage *msg, + guint errorcode, + SoupHandlerType type, + SoupCallbackFn handler_cb, + gpointer user_data) { g_return_if_fail (msg != NULL); - g_return_if_fail (type != 0); + g_return_if_fail (errorcode != 0); g_return_if_fail (handler_cb != NULL); - soup_message_add_handler_full (msg, - NULL, - type, - SOUP_HANDLER_LAST, - filter, - handler_cb, - user_data); -} - -GSList * -soup_message_list_handlers (SoupMessage *msg) -{ - GSList *ret = NULL, *list; - - g_return_val_if_fail (msg != NULL, NULL); - - for (list = msg->priv->content_handlers; list; list = list->next) { - SoupHandlerData *data = list->data; - if (data->name) - ret = g_slist_append (ret, data->name); - } - - return ret; + add_handler (msg, + type, + handler_cb, + user_data, + RESPONSE_ERROR_CODE_HANDLER, + NULL, + errorcode, + 0); } void -soup_message_remove_handler (SoupMessage *msg, - gchar *name) +soup_message_add_error_class_handler (SoupMessage *msg, + SoupErrorClass errorclass, + SoupHandlerType type, + SoupCallbackFn handler_cb, + gpointer user_data) { - GSList *iter; - g_return_if_fail (msg != NULL); - g_return_if_fail (name != NULL); - - iter = msg->priv->content_handlers; - while (iter) { - SoupHandlerData *data = iter->data; - - if (data->name && !g_strcasecmp (data->name, name)) { - handler_free (data); - break; - } + g_return_if_fail (errorclass != 0); + g_return_if_fail (handler_cb != NULL); - iter = iter->next; - } + add_handler (msg, + type, + handler_cb, + user_data, + RESPONSE_ERROR_CLASS_HANDLER, + NULL, + 0, + errorclass); } void -soup_message_remove_handler_by_func (SoupMessage *msg, - SoupHandlerFn handler_cb) +soup_message_add_handler (SoupMessage *msg, + SoupHandlerType type, + SoupCallbackFn handler_cb, + gpointer user_data) { - GSList *iter; - g_return_if_fail (msg != NULL); g_return_if_fail (handler_cb != NULL); - iter = msg->priv->content_handlers; - while (iter) { - SoupHandlerData *data = iter->data; - - if (data->handler_cb == handler_cb) { - handler_free (data); - break; - } - - iter = iter->next; - } + add_handler (msg, + type, + handler_cb, + user_data, + 0, + NULL, + 0, + 0); } -void -soup_message_remove_handler_by_func_and_data (SoupMessage *msg, - SoupHandlerFn handler_cb, - gpointer user_data) +void +soup_message_remove_handler (SoupMessage *msg, + SoupHandlerType type, + SoupCallbackFn handler_cb, + gpointer user_data) { - GSList *iter; - - g_return_if_fail (msg != NULL); - g_return_if_fail (handler_cb != NULL); + GSList *iter = msg->priv->content_handlers; - iter = msg->priv->content_handlers; while (iter) { SoupHandlerData *data = iter->data; - if (data->handler_cb == handler_cb && - data->user_data == user_data) { - handler_free (data); + if (data->handler_cb == handler_cb && + data->user_data == user_data && + data->type == type) { + msg->priv->content_handlers = + g_slist_remove_link ( + msg->priv->content_handlers, + iter); + g_free (data); break; } - + iter = iter->next; } } diff --git a/libsoup/soup-message.h b/libsoup/soup-message.h index 631da19d..c46c6e94 100644 --- a/libsoup/soup-message.h +++ b/libsoup/soup-message.h @@ -1,6 +1,6 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * soup-message.h: Asyncronous Callback-based SOAP Request Queue. + * soup-message.h: Asyncronous Callback-based HTTP Request Queue. * * Authors: * Alex Graveley (alex@ximian.com) @@ -173,103 +173,39 @@ guint soup_message_get_flags (SoupMessage *msg); * Handler Registration */ typedef enum { - SOUP_HANDLER_PREPARE = 0, - SOUP_HANDLER_HEADERS, - SOUP_HANDLER_DATA, - SOUP_HANDLER_FINISHED, -} SoupHandlerEvent; - -typedef enum { - SOUP_FILTER_HEADER = (1 << 0), - SOUP_FILTER_ERROR_CODE = (1 << 1), - SOUP_FILTER_ERROR_CLASS = (1 << 2), - SOUP_FILTER_TIMEOUT = (1 << 3), -} SoupHandlerFilterType; - -typedef struct { - gint type; - - union { - guint errorcode; - SoupErrorClass errorclass; - const gchar *header; - guint timeout; - } data; -} SoupHandlerFilter; - -typedef enum { - /* - * Continue processing as normal. - */ - SOUP_HANDLER_CONTINUE, - - /* - * Do not process further handlers. Continue receiving data. - */ - SOUP_HANDLER_STOP, - - /* - * do not process further handlers. Stop receiving data and - * issue final callback. - */ - SOUP_HANDLER_KILL, - - /* - * Restart handler processing. This should be returned if a - * handler changes the message's errorcode. - */ - SOUP_HANDLER_RESTART, - - /* - * Requeue the request immediately. Stop processing handlers - * and do not issue final callback. - */ - SOUP_HANDLER_RESEND -} SoupHandlerResult; - -typedef SoupHandlerResult (*SoupHandlerFn) (SoupMessage *req, - gpointer user_data); + SOUP_HANDLER_PRE_BODY = 1, + SOUP_HANDLER_BODY_CHUNK, + SOUP_HANDLER_POST_BODY +} SoupHandlerType; void soup_message_add_handler (SoupMessage *msg, - SoupHandlerEvent type, - SoupHandlerFilter *filter, - SoupHandlerFn handler_cb, + SoupHandlerType type, + SoupCallbackFn handler_cb, gpointer user_data); -typedef enum { - /* - * Run before global handlers and previously registered message - * handlers. - */ - SOUP_HANDLER_FIRST, - - /* - * Run after global handlers and previously registered message - * handlers. - */ - SOUP_HANDLER_LAST -} SoupHandlerWhen; +void soup_message_add_header_handler (SoupMessage *msg, + const gchar *header, + SoupHandlerType type, + SoupCallbackFn handler_cb, + gpointer user_data); -void soup_message_add_handler_full (SoupMessage *msg, - const gchar *name, - SoupHandlerEvent type, - SoupHandlerWhen order, - SoupHandlerFilter *filter, - SoupHandlerFn handler_cb, +void soup_message_add_error_code_handler ( + SoupMessage *msg, + guint errorcode, + SoupHandlerType type, + SoupCallbackFn handler_cb, gpointer user_data); -GSList *soup_message_list_handlers (SoupMessage *msg); +void soup_message_add_error_class_handler ( + SoupMessage *msg, + SoupErrorClass errorclass, + SoupHandlerType type, + SoupCallbackFn handler_cb, + gpointer user_data); void soup_message_remove_handler (SoupMessage *msg, - gchar *name); - -void soup_message_remove_handler_by_func ( - SoupMessage *msg, - SoupHandlerFn handler_cb); - -void soup_message_remove_handler_by_func_and_data ( - SoupMessage *msg, - SoupHandlerFn handler_cb, + SoupHandlerType type, + SoupCallbackFn handler_cb, gpointer user_data); /* @@ -286,4 +222,24 @@ void soup_message_set_handler_error (SoupMessage *msg, guint errcode, const gchar *errphrase); +/** DEPRECATED API **/ + +/** DEPRECATED **/ +void soup_message_set_request_header (SoupMessage *req, + const gchar *name, + const gchar *value); + +/** DEPRECATED **/ +const gchar *soup_message_get_request_header (SoupMessage *req, + const gchar *name); + +/** DEPRECATED **/ +void soup_message_set_response_header (SoupMessage *req, + const gchar *name, + const gchar *value); + +/** DEPRECATED **/ +const gchar *soup_message_get_response_header (SoupMessage *req, + const gchar *name); + #endif /*SOUP_MESSAGE_H*/ diff --git a/libsoup/soup-misc.c b/libsoup/soup-misc.c index 1310fe5c..aa7765c4 100644 --- a/libsoup/soup-misc.c +++ b/libsoup/soup-misc.c @@ -687,6 +687,11 @@ soup_shutdown () soup_queue_shutdown (); } +static char *ssl_ca_file = NULL; +static char *ssl_ca_dir = NULL; +static char *ssl_cert_file = NULL; +static char *ssl_key_file = NULL; + /** * soup_set_ca_file: * @ca_file: the path to a CA file @@ -695,9 +700,11 @@ soup_shutdown () * peers. */ void -soup_set_ssl_ca_file (gchar *ca_file) +soup_set_ssl_ca_file (const gchar *ca_file) { - putenv (g_strdup_printf ("HTTPS_CA_FILE=%s", ca_file)); + g_free (ssl_ca_file); + + ssl_ca_file = g_strdup (ca_file); } /** @@ -708,9 +715,11 @@ soup_set_ssl_ca_file (gchar *ca_file) * peers. */ void -soup_set_ssl_ca_dir (gchar *ca_dir) +soup_set_ssl_ca_dir (const gchar *ca_dir) { - putenv (g_strdup_printf ("HTTPS_CA_DIR=%s", ca_dir)); + g_free (ssl_ca_dir); + + ssl_ca_dir = g_strdup (ca_dir); } /** @@ -719,13 +728,58 @@ soup_set_ssl_ca_dir (gchar *ca_dir) * @key_file: the file containing the SSL private key * * Specify a SSL client certificate to be used for client - * authentication with the SOAP server + * authentication with the HTTP server */ void -soup_set_ssl_cert_files (gchar *cert_file, gchar *key_file) +soup_set_ssl_cert_files (const gchar *cert_file, const gchar *key_file) { - putenv (g_strdup_printf ("HTTPS_CERT_FILE=%s", cert_file)); - putenv (g_strdup_printf ("HTTPS_KEY_FILE=%s", key_file)); + g_free (ssl_cert_file); + g_free (ssl_key_file); + + ssl_cert_file = g_strdup (cert_file); + ssl_key_file = g_strdup (key_file); +} + +/** + * soup_get_ca_file: + * + * Return value: A file containing CA certificates to be used to verify + * peers. + */ +const char * +soup_get_ssl_ca_file (void) +{ + return ssl_ca_file; +} + +/** + * soup_get_ca_dir + * + * Return value: A directory containing CA certificates to be used to verify + * peers. + */ +const char * +soup_get_ssl_ca_dir (void) +{ + return ssl_ca_dir; +} + +/** + * soup_get_ssl_cert_files + * @cert_file: the file containing the SSL client certificate + * @key_file: the file containing the SSL private key + * + * Specify a SSL client certificate to be used for client + * authentication with the HTTP server + */ +void +soup_get_ssl_cert_files (const gchar **cert_file, const gchar **key_file) +{ + if (cert_file) + *cert_file = ssl_cert_file; + + if (key_file) + *key_file = ssl_key_file; } SoupAuthorizeFn soup_auth_fn = NULL; diff --git a/libsoup/soup-misc.h b/libsoup/soup-misc.h index be80993b..ba3aa8c5 100644 --- a/libsoup/soup-misc.h +++ b/libsoup/soup-misc.h @@ -42,12 +42,17 @@ SoupSecurityPolicy soup_get_security_policy (void); /* SSL setup routines */ -void soup_set_ssl_ca_file (gchar *ca_file); +void soup_set_ssl_ca_file (const gchar *ca_file); -void soup_set_ssl_ca_dir (gchar *ca_dir); +void soup_set_ssl_ca_dir (const gchar *ca_dir); -void soup_set_ssl_cert_files (gchar *cert_file, - gchar *key_file); +void soup_set_ssl_cert_files (const gchar *cert_file, + const gchar *key_file); + +const char *soup_get_ssl_ca_file (void); +const char *soup_get_ssl_ca_dir (void); +void soup_get_ssl_cert_files (const gchar **cert_file, + const gchar **key_file); /* Authentication callback */ diff --git a/libsoup/soup-nss.c b/libsoup/soup-nss.c index edadbd93..a9517528 100644 --- a/libsoup/soup-nss.c +++ b/libsoup/soup-nss.c @@ -1,6 +1,6 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * soup-nss.c: Asyncronous Callback-based SOAP Request Queue. + * soup-nss.c: Asyncronous Callback-based HTTP Request Queue. * * Authors: * Alex Graveley (alex@ximian.com) @@ -295,7 +295,7 @@ soup_nss_bad_cert (void *data, PRFileDesc *fd) } GIOChannel * -soup_nss_get_iochannel (GIOChannel *sock) +soup_nss_get_iochannel (GIOChannel *sock, SoupSSLType type) { SoupNSSChannel *chan; GIOChannel *gchan; @@ -322,7 +322,10 @@ soup_nss_get_iochannel (GIOChannel *sock) } SSL_OptionSet (fdesc, SSL_SECURITY, PR_TRUE); - SSL_OptionSet (fdesc, SSL_HANDSHAKE_AS_CLIENT, PR_TRUE); + if (type == SOUP_SSL_TYPE_CLIENT) + SSL_OptionSet (fdesc, SSL_HANDSHAKE_AS_CLIENT, PR_TRUE); + else + SSL_OptionSet (fdesc, SSL_HANDSHAKE_AS_SERVER, PR_TRUE); SSL_BadCertHook (fdesc, soup_nss_bad_cert, NULL); if (SSL_ResetHandshake (fdesc, PR_FALSE) == PR_FAILURE) { diff --git a/libsoup/soup-nss.h b/libsoup/soup-nss.h index 1aaa0a45..99ac3fe6 100644 --- a/libsoup/soup-nss.h +++ b/libsoup/soup-nss.h @@ -1,6 +1,6 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * soup-nss.h: Asyncronous Callback-based SOAP Request Queue. + * soup-nss.h: Asyncronous Callback-based HTTP Request Queue. * * Authors: * Alex Graveley (alex@ximian.com) @@ -13,8 +13,9 @@ #include <glib.h> #include <libsoup/soup-misc.h> +#include <libsoup/soup-ssl.h> -GIOChannel *soup_nss_get_iochannel (GIOChannel *sock); +GIOChannel *soup_nss_get_iochannel (GIOChannel *sock, SoupSSLType type); void soup_nss_set_security_policy (SoupSecurityPolicy policy); diff --git a/libsoup/soup-ntlm.c b/libsoup/soup-ntlm.c index 64f809fe..734c7eec 100644 --- a/libsoup/soup-ntlm.c +++ b/libsoup/soup-ntlm.c @@ -44,7 +44,7 @@ static void calc_response (const guchar *key, "\x00\x00\x00\x00\x00" void -soup_ntlm_lanmanager_hash (const char *password, char hash[21]) +soup_ntlm_lanmanager_hash (const char *password, guchar hash[21]) { guchar lm_password [15]; DES_KS ks; @@ -66,7 +66,7 @@ soup_ntlm_lanmanager_hash (const char *password, char hash[21]) } void -soup_ntlm_nt_hash (const char *password, char hash[21]) +soup_ntlm_nt_hash (const char *password, guchar hash[21]) { unsigned char *buf, *p; @@ -90,13 +90,12 @@ typedef struct { guchar zero_pad[2]; } NTLMString; -#define NTLM_CHALLENGE_NONCE_OFFSET 24 -#define NTLM_CHALLENGE_NONCE_LENGTH 8 -#define NTLM_CHALLENGE_DOMAIN_OFFSET 48 -#define NTLM_CHALLENGE_DOMAIN_LEN_OFFSET 44 +#define NTLM_CHALLENGE_NONCE_OFFSET 24 +#define NTLM_CHALLENGE_NONCE_LENGTH 8 +#define NTLM_CHALLENGE_DOMAIN_STRING_OFFSET 12 #define NTLM_RESPONSE_HEADER "NTLMSSP\x00\x03\x00\x00\x00" -#define NTLM_RESPONSE_FLAGS "\x82\x01" +#define NTLM_RESPONSE_FLAGS 0x8202 typedef struct { guchar header[12]; @@ -106,25 +105,16 @@ typedef struct { NTLMString domain; NTLMString user; NTLMString host; + NTLMString session_key; - guint16 msg_len; - guchar zero_pad[2]; - - guchar flags[2]; - guchar zero_pad2[2]; + guint32 flags; } NTLMResponse; -#if G_BYTE_ORDER == G_BIG_ENDIAN -#define LE16(x) (((x & 0xFF) << 8) | ((x >> 8) & 0xFF)) -#else -#define LE16(x) x -#endif - static void ntlm_set_string (NTLMString *string, int *offset, int len) { - string->offset = LE16 (*offset); - string->length = string->length2 = LE16 (len); + string->offset = GUINT16_TO_LE (*offset); + string->length = string->length2 = GUINT16_TO_LE (len); *offset += len; } @@ -134,53 +124,82 @@ soup_ntlm_request (void) return g_strdup ("NTLM TlRMTVNTUAABAAAABoIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAA"); } -char * -soup_ntlm_response (const char *challenge, - const char *user, - const char *lm_hash, - const char *nt_hash, - const char *host, - const char *domain) +gboolean +soup_ntlm_parse_challenge (const char *challenge, + char **nonce, + char **default_domain) { - int hlen, dlen, ulen, offset, decodelen; - guchar lm_resp[24], nt_resp[24], *nonce; - NTLMResponse resp; + int clen, decodelen; + NTLMString domain; char *chall; - unsigned char *out, *p; int state, save; if (strncmp (challenge, "NTLM ", 5) != 0) - return NULL; + return FALSE; decodelen = strlen (challenge) - 5; chall = g_malloc (decodelen); state = save = 0; - soup_base64_decode_step ((guchar *) challenge + 5, - decodelen, - chall, - &state, - &save); + clen = soup_base64_decode_step ((guchar *) challenge + 5, + decodelen, + chall, + &state, + &save); + + if (clen < NTLM_CHALLENGE_DOMAIN_STRING_OFFSET || + clen < NTLM_CHALLENGE_NONCE_OFFSET + NTLM_CHALLENGE_NONCE_LENGTH) { + g_free (chall); + return FALSE; + } + + if (default_domain) { + memcpy (&domain, chall + NTLM_CHALLENGE_DOMAIN_STRING_OFFSET, sizeof (domain)); + domain.length = GUINT16_FROM_LE (domain.length); + domain.offset = GUINT16_FROM_LE (domain.offset); + + if (clen < domain.length + domain.offset) { + g_free (chall); + return FALSE; + } + + *default_domain = g_strndup (chall + domain.offset, domain.length); + } + + if (nonce) { + *nonce = g_memdup (chall + NTLM_CHALLENGE_NONCE_OFFSET, + NTLM_CHALLENGE_NONCE_LENGTH); + } - nonce = chall + NTLM_CHALLENGE_NONCE_OFFSET; - nonce [NTLM_CHALLENGE_NONCE_LENGTH] = '\0'; + g_free (chall); + return TRUE; +} - calc_response (lm_hash, nonce, lm_resp); - calc_response (nt_hash, nonce, nt_resp); +char * +soup_ntlm_response (const char *nonce, + const char *user, + const char *password, + const char *host, + const char *domain) +{ + int hlen, dlen, ulen, offset; + guchar hash[21], lm_resp[24], nt_resp[24]; + NTLMResponse resp; + unsigned char *out, *p; + int state, save; + + soup_ntlm_lanmanager_hash (password, hash); + calc_response (hash, nonce, lm_resp); + soup_ntlm_nt_hash (password, hash); + calc_response (hash, nonce, nt_resp); memset (&resp, 0, sizeof (resp)); memcpy (resp.header, NTLM_RESPONSE_HEADER, sizeof (resp.header)); - memcpy (resp.flags, NTLM_RESPONSE_FLAGS, sizeof (resp.flags)); + resp.flags = GUINT32_TO_LE (NTLM_RESPONSE_FLAGS); offset = sizeof (resp); - if (domain) - dlen = strlen (domain); - else { - /* Grab the default domain from the challenge */ - domain = chall + NTLM_CHALLENGE_DOMAIN_OFFSET; - dlen = atoi (chall + NTLM_CHALLENGE_DOMAIN_LEN_OFFSET); - } + dlen = strlen (domain); ntlm_set_string (&resp.domain, &offset, dlen); ulen = strlen (user); ntlm_set_string (&resp.user, &offset, ulen); @@ -235,14 +254,10 @@ soup_ntlm_response (const char *challenge, &state, &save); *p = '\0'; - g_free (chall); return out; } -#define KEYBITS(k,s) \ - (((k[(s)/8] << ((s)%8)) & 0xFF) | (k[(s)/8+1] >> (8-(s)%8))) - /* DES utils */ /* Set up a key schedule based on a 56bit key */ static void @@ -251,15 +266,22 @@ setup_schedule (const guchar *key_56, DES_KS ks) guchar key[8]; int i, c, bit; - for (i = 0; i < 8; i++) { - key [i] = KEYBITS (key_56, i * 7); + key[0] = (key_56[0]) ; + key[1] = (key_56[1] >> 1) | ((key_56[0] << 7) & 0xFF); + key[2] = (key_56[2] >> 2) | ((key_56[1] << 6) & 0xFF); + key[3] = (key_56[3] >> 3) | ((key_56[2] << 5) & 0xFF); + key[4] = (key_56[4] >> 4) | ((key_56[3] << 4) & 0xFF); + key[5] = (key_56[5] >> 5) | ((key_56[4] << 3) & 0xFF); + key[6] = (key_56[6] >> 6) | ((key_56[5] << 2) & 0xFF); + key[7] = ((key_56[6] << 1) & 0xFF); - /* Fix parity */ + /* Fix parity */ + for (i = 0; i < 8; i++) { for (c = bit = 0; bit < 8; bit++) - if (key [i] & (1 << bit)) + if (key[i] & (1 << bit)) c++; if (!(c & 1)) - key [i] ^= 0x01; + key[i] ^= 0x01; } deskey (ks, key, 0); @@ -410,134 +432,134 @@ md4sum (const unsigned char *in, int nbytes, unsigned char digest[16]) /* Public domain DES implementation from Phil Karn */ static unsigned long Spbox[8][64] = { - 0x01010400,0x00000000,0x00010000,0x01010404, - 0x01010004,0x00010404,0x00000004,0x00010000, - 0x00000400,0x01010400,0x01010404,0x00000400, - 0x01000404,0x01010004,0x01000000,0x00000004, - 0x00000404,0x01000400,0x01000400,0x00010400, - 0x00010400,0x01010000,0x01010000,0x01000404, - 0x00010004,0x01000004,0x01000004,0x00010004, - 0x00000000,0x00000404,0x00010404,0x01000000, - 0x00010000,0x01010404,0x00000004,0x01010000, - 0x01010400,0x01000000,0x01000000,0x00000400, - 0x01010004,0x00010000,0x00010400,0x01000004, - 0x00000400,0x00000004,0x01000404,0x00010404, - 0x01010404,0x00010004,0x01010000,0x01000404, - 0x01000004,0x00000404,0x00010404,0x01010400, - 0x00000404,0x01000400,0x01000400,0x00000000, - 0x00010004,0x00010400,0x00000000,0x01010004, - 0x80108020,0x80008000,0x00008000,0x00108020, - 0x00100000,0x00000020,0x80100020,0x80008020, - 0x80000020,0x80108020,0x80108000,0x80000000, - 0x80008000,0x00100000,0x00000020,0x80100020, - 0x00108000,0x00100020,0x80008020,0x00000000, - 0x80000000,0x00008000,0x00108020,0x80100000, - 0x00100020,0x80000020,0x00000000,0x00108000, - 0x00008020,0x80108000,0x80100000,0x00008020, - 0x00000000,0x00108020,0x80100020,0x00100000, - 0x80008020,0x80100000,0x80108000,0x00008000, - 0x80100000,0x80008000,0x00000020,0x80108020, - 0x00108020,0x00000020,0x00008000,0x80000000, - 0x00008020,0x80108000,0x00100000,0x80000020, - 0x00100020,0x80008020,0x80000020,0x00100020, - 0x00108000,0x00000000,0x80008000,0x00008020, - 0x80000000,0x80100020,0x80108020,0x00108000, - 0x00000208,0x08020200,0x00000000,0x08020008, - 0x08000200,0x00000000,0x00020208,0x08000200, - 0x00020008,0x08000008,0x08000008,0x00020000, - 0x08020208,0x00020008,0x08020000,0x00000208, - 0x08000000,0x00000008,0x08020200,0x00000200, - 0x00020200,0x08020000,0x08020008,0x00020208, - 0x08000208,0x00020200,0x00020000,0x08000208, - 0x00000008,0x08020208,0x00000200,0x08000000, - 0x08020200,0x08000000,0x00020008,0x00000208, - 0x00020000,0x08020200,0x08000200,0x00000000, - 0x00000200,0x00020008,0x08020208,0x08000200, - 0x08000008,0x00000200,0x00000000,0x08020008, - 0x08000208,0x00020000,0x08000000,0x08020208, - 0x00000008,0x00020208,0x00020200,0x08000008, - 0x08020000,0x08000208,0x00000208,0x08020000, - 0x00020208,0x00000008,0x08020008,0x00020200, - 0x00802001,0x00002081,0x00002081,0x00000080, - 0x00802080,0x00800081,0x00800001,0x00002001, - 0x00000000,0x00802000,0x00802000,0x00802081, - 0x00000081,0x00000000,0x00800080,0x00800001, - 0x00000001,0x00002000,0x00800000,0x00802001, - 0x00000080,0x00800000,0x00002001,0x00002080, - 0x00800081,0x00000001,0x00002080,0x00800080, - 0x00002000,0x00802080,0x00802081,0x00000081, - 0x00800080,0x00800001,0x00802000,0x00802081, - 0x00000081,0x00000000,0x00000000,0x00802000, - 0x00002080,0x00800080,0x00800081,0x00000001, - 0x00802001,0x00002081,0x00002081,0x00000080, - 0x00802081,0x00000081,0x00000001,0x00002000, - 0x00800001,0x00002001,0x00802080,0x00800081, - 0x00002001,0x00002080,0x00800000,0x00802001, - 0x00000080,0x00800000,0x00002000,0x00802080, - 0x00000100,0x02080100,0x02080000,0x42000100, - 0x00080000,0x00000100,0x40000000,0x02080000, - 0x40080100,0x00080000,0x02000100,0x40080100, - 0x42000100,0x42080000,0x00080100,0x40000000, - 0x02000000,0x40080000,0x40080000,0x00000000, - 0x40000100,0x42080100,0x42080100,0x02000100, - 0x42080000,0x40000100,0x00000000,0x42000000, - 0x02080100,0x02000000,0x42000000,0x00080100, - 0x00080000,0x42000100,0x00000100,0x02000000, - 0x40000000,0x02080000,0x42000100,0x40080100, - 0x02000100,0x40000000,0x42080000,0x02080100, - 0x40080100,0x00000100,0x02000000,0x42080000, - 0x42080100,0x00080100,0x42000000,0x42080100, - 0x02080000,0x00000000,0x40080000,0x42000000, - 0x00080100,0x02000100,0x40000100,0x00080000, - 0x00000000,0x40080000,0x02080100,0x40000100, - 0x20000010,0x20400000,0x00004000,0x20404010, - 0x20400000,0x00000010,0x20404010,0x00400000, - 0x20004000,0x00404010,0x00400000,0x20000010, - 0x00400010,0x20004000,0x20000000,0x00004010, - 0x00000000,0x00400010,0x20004010,0x00004000, - 0x00404000,0x20004010,0x00000010,0x20400010, - 0x20400010,0x00000000,0x00404010,0x20404000, - 0x00004010,0x00404000,0x20404000,0x20000000, - 0x20004000,0x00000010,0x20400010,0x00404000, - 0x20404010,0x00400000,0x00004010,0x20000010, - 0x00400000,0x20004000,0x20000000,0x00004010, - 0x20000010,0x20404010,0x00404000,0x20400000, - 0x00404010,0x20404000,0x00000000,0x20400010, - 0x00000010,0x00004000,0x20400000,0x00404010, - 0x00004000,0x00400010,0x20004010,0x00000000, - 0x20404000,0x20000000,0x00400010,0x20004010, - 0x00200000,0x04200002,0x04000802,0x00000000, - 0x00000800,0x04000802,0x00200802,0x04200800, - 0x04200802,0x00200000,0x00000000,0x04000002, - 0x00000002,0x04000000,0x04200002,0x00000802, - 0x04000800,0x00200802,0x00200002,0x04000800, - 0x04000002,0x04200000,0x04200800,0x00200002, - 0x04200000,0x00000800,0x00000802,0x04200802, - 0x00200800,0x00000002,0x04000000,0x00200800, - 0x04000000,0x00200800,0x00200000,0x04000802, - 0x04000802,0x04200002,0x04200002,0x00000002, - 0x00200002,0x04000000,0x04000800,0x00200000, - 0x04200800,0x00000802,0x00200802,0x04200800, - 0x00000802,0x04000002,0x04200802,0x04200000, - 0x00200800,0x00000000,0x00000002,0x04200802, - 0x00000000,0x00200802,0x04200000,0x00000800, - 0x04000002,0x04000800,0x00000800,0x00200002, - 0x10001040,0x00001000,0x00040000,0x10041040, - 0x10000000,0x10001040,0x00000040,0x10000000, - 0x00040040,0x10040000,0x10041040,0x00041000, - 0x10041000,0x00041040,0x00001000,0x00000040, - 0x10040000,0x10000040,0x10001000,0x00001040, - 0x00041000,0x00040040,0x10040040,0x10041000, - 0x00001040,0x00000000,0x00000000,0x10040040, - 0x10000040,0x10001000,0x00041040,0x00040000, - 0x00041040,0x00040000,0x10041000,0x00001000, - 0x00000040,0x10040040,0x00001000,0x00041040, - 0x10001000,0x00000040,0x10000040,0x10040000, - 0x10040040,0x10000000,0x00040000,0x10001040, - 0x00000000,0x10041040,0x00040040,0x10000040, - 0x10040000,0x10001000,0x10001040,0x00000000, - 0x10041040,0x00041000,0x00041000,0x00001040, - 0x00001040,0x00040040,0x10000000,0x10041000, + { 0x01010400,0x00000000,0x00010000,0x01010404, + 0x01010004,0x00010404,0x00000004,0x00010000, + 0x00000400,0x01010400,0x01010404,0x00000400, + 0x01000404,0x01010004,0x01000000,0x00000004, + 0x00000404,0x01000400,0x01000400,0x00010400, + 0x00010400,0x01010000,0x01010000,0x01000404, + 0x00010004,0x01000004,0x01000004,0x00010004, + 0x00000000,0x00000404,0x00010404,0x01000000, + 0x00010000,0x01010404,0x00000004,0x01010000, + 0x01010400,0x01000000,0x01000000,0x00000400, + 0x01010004,0x00010000,0x00010400,0x01000004, + 0x00000400,0x00000004,0x01000404,0x00010404, + 0x01010404,0x00010004,0x01010000,0x01000404, + 0x01000004,0x00000404,0x00010404,0x01010400, + 0x00000404,0x01000400,0x01000400,0x00000000, + 0x00010004,0x00010400,0x00000000,0x01010004 }, + { 0x80108020,0x80008000,0x00008000,0x00108020, + 0x00100000,0x00000020,0x80100020,0x80008020, + 0x80000020,0x80108020,0x80108000,0x80000000, + 0x80008000,0x00100000,0x00000020,0x80100020, + 0x00108000,0x00100020,0x80008020,0x00000000, + 0x80000000,0x00008000,0x00108020,0x80100000, + 0x00100020,0x80000020,0x00000000,0x00108000, + 0x00008020,0x80108000,0x80100000,0x00008020, + 0x00000000,0x00108020,0x80100020,0x00100000, + 0x80008020,0x80100000,0x80108000,0x00008000, + 0x80100000,0x80008000,0x00000020,0x80108020, + 0x00108020,0x00000020,0x00008000,0x80000000, + 0x00008020,0x80108000,0x00100000,0x80000020, + 0x00100020,0x80008020,0x80000020,0x00100020, + 0x00108000,0x00000000,0x80008000,0x00008020, + 0x80000000,0x80100020,0x80108020,0x00108000 }, + { 0x00000208,0x08020200,0x00000000,0x08020008, + 0x08000200,0x00000000,0x00020208,0x08000200, + 0x00020008,0x08000008,0x08000008,0x00020000, + 0x08020208,0x00020008,0x08020000,0x00000208, + 0x08000000,0x00000008,0x08020200,0x00000200, + 0x00020200,0x08020000,0x08020008,0x00020208, + 0x08000208,0x00020200,0x00020000,0x08000208, + 0x00000008,0x08020208,0x00000200,0x08000000, + 0x08020200,0x08000000,0x00020008,0x00000208, + 0x00020000,0x08020200,0x08000200,0x00000000, + 0x00000200,0x00020008,0x08020208,0x08000200, + 0x08000008,0x00000200,0x00000000,0x08020008, + 0x08000208,0x00020000,0x08000000,0x08020208, + 0x00000008,0x00020208,0x00020200,0x08000008, + 0x08020000,0x08000208,0x00000208,0x08020000, + 0x00020208,0x00000008,0x08020008,0x00020200 }, + { 0x00802001,0x00002081,0x00002081,0x00000080, + 0x00802080,0x00800081,0x00800001,0x00002001, + 0x00000000,0x00802000,0x00802000,0x00802081, + 0x00000081,0x00000000,0x00800080,0x00800001, + 0x00000001,0x00002000,0x00800000,0x00802001, + 0x00000080,0x00800000,0x00002001,0x00002080, + 0x00800081,0x00000001,0x00002080,0x00800080, + 0x00002000,0x00802080,0x00802081,0x00000081, + 0x00800080,0x00800001,0x00802000,0x00802081, + 0x00000081,0x00000000,0x00000000,0x00802000, + 0x00002080,0x00800080,0x00800081,0x00000001, + 0x00802001,0x00002081,0x00002081,0x00000080, + 0x00802081,0x00000081,0x00000001,0x00002000, + 0x00800001,0x00002001,0x00802080,0x00800081, + 0x00002001,0x00002080,0x00800000,0x00802001, + 0x00000080,0x00800000,0x00002000,0x00802080 }, + { 0x00000100,0x02080100,0x02080000,0x42000100, + 0x00080000,0x00000100,0x40000000,0x02080000, + 0x40080100,0x00080000,0x02000100,0x40080100, + 0x42000100,0x42080000,0x00080100,0x40000000, + 0x02000000,0x40080000,0x40080000,0x00000000, + 0x40000100,0x42080100,0x42080100,0x02000100, + 0x42080000,0x40000100,0x00000000,0x42000000, + 0x02080100,0x02000000,0x42000000,0x00080100, + 0x00080000,0x42000100,0x00000100,0x02000000, + 0x40000000,0x02080000,0x42000100,0x40080100, + 0x02000100,0x40000000,0x42080000,0x02080100, + 0x40080100,0x00000100,0x02000000,0x42080000, + 0x42080100,0x00080100,0x42000000,0x42080100, + 0x02080000,0x00000000,0x40080000,0x42000000, + 0x00080100,0x02000100,0x40000100,0x00080000, + 0x00000000,0x40080000,0x02080100,0x40000100 }, + { 0x20000010,0x20400000,0x00004000,0x20404010, + 0x20400000,0x00000010,0x20404010,0x00400000, + 0x20004000,0x00404010,0x00400000,0x20000010, + 0x00400010,0x20004000,0x20000000,0x00004010, + 0x00000000,0x00400010,0x20004010,0x00004000, + 0x00404000,0x20004010,0x00000010,0x20400010, + 0x20400010,0x00000000,0x00404010,0x20404000, + 0x00004010,0x00404000,0x20404000,0x20000000, + 0x20004000,0x00000010,0x20400010,0x00404000, + 0x20404010,0x00400000,0x00004010,0x20000010, + 0x00400000,0x20004000,0x20000000,0x00004010, + 0x20000010,0x20404010,0x00404000,0x20400000, + 0x00404010,0x20404000,0x00000000,0x20400010, + 0x00000010,0x00004000,0x20400000,0x00404010, + 0x00004000,0x00400010,0x20004010,0x00000000, + 0x20404000,0x20000000,0x00400010,0x20004010 }, + { 0x00200000,0x04200002,0x04000802,0x00000000, + 0x00000800,0x04000802,0x00200802,0x04200800, + 0x04200802,0x00200000,0x00000000,0x04000002, + 0x00000002,0x04000000,0x04200002,0x00000802, + 0x04000800,0x00200802,0x00200002,0x04000800, + 0x04000002,0x04200000,0x04200800,0x00200002, + 0x04200000,0x00000800,0x00000802,0x04200802, + 0x00200800,0x00000002,0x04000000,0x00200800, + 0x04000000,0x00200800,0x00200000,0x04000802, + 0x04000802,0x04200002,0x04200002,0x00000002, + 0x00200002,0x04000000,0x04000800,0x00200000, + 0x04200800,0x00000802,0x00200802,0x04200800, + 0x00000802,0x04000002,0x04200802,0x04200000, + 0x00200800,0x00000000,0x00000002,0x04200802, + 0x00000000,0x00200802,0x04200000,0x00000800, + 0x04000002,0x04000800,0x00000800,0x00200002 }, + { 0x10001040,0x00001000,0x00040000,0x10041040, + 0x10000000,0x10001040,0x00000040,0x10000000, + 0x00040040,0x10040000,0x10041040,0x00041000, + 0x10041000,0x00041040,0x00001000,0x00000040, + 0x10040000,0x10000040,0x10001000,0x00001040, + 0x00041000,0x00040040,0x10040040,0x10041000, + 0x00001040,0x00000000,0x00000000,0x10040040, + 0x10000040,0x10001000,0x00041040,0x00040000, + 0x00041040,0x00040000,0x10041000,0x00001000, + 0x00000040,0x10040040,0x00001000,0x00041040, + 0x10001000,0x00000040,0x10000040,0x10040000, + 0x10040040,0x10000000,0x00040000,0x10001040, + 0x00000000,0x10041040,0x00040040,0x10000040, + 0x10040000,0x10001000,0x10001040,0x00000000, + 0x10041040,0x00041000,0x00041000,0x00001040, + 0x00001040,0x00040040,0x10000000,0x10041000 } }; #undef F diff --git a/libsoup/soup-ntlm.h b/libsoup/soup-ntlm.h index 3149805a..5b35f429 100644 --- a/libsoup/soup-ntlm.h +++ b/libsoup/soup-ntlm.h @@ -13,19 +13,22 @@ #include <glib.h> -void soup_ntlm_lanmanager_hash (const char *password, - char hash[21]); +void soup_ntlm_lanmanager_hash (const char *password, + guchar hash[21]); -void soup_ntlm_nt_hash (const char *password, - char hash[21]); +void soup_ntlm_nt_hash (const char *password, + guchar hash[21]); -char *soup_ntlm_request (void); +char *soup_ntlm_request (void); -char *soup_ntlm_response (const char *challenge, - const char *user, - const char *lm_hash, - const char *nt_hash, - const char *host, - const char *domain); +gboolean soup_ntlm_parse_challenge (const char *challenge, + char **nonce, + char **default_domain); + +char *soup_ntlm_response (const char *nonce, + const char *user, + const char *password, + const char *host, + const char *domain); #endif /* NTLM_H */ diff --git a/libsoup/soup-openssl.c b/libsoup/soup-openssl.c index d8c8eac9..015cbf50 100644 --- a/libsoup/soup-openssl.c +++ b/libsoup/soup-openssl.c @@ -14,10 +14,7 @@ #ifdef HAVE_OPENSSL_SSL_H -#ifdef HAVE_UNISTD_H #include <unistd.h> -#endif - #include <glib.h> #include <sys/time.h> @@ -27,6 +24,8 @@ #include "soup-openssl.h" +static gboolean server_mode = FALSE; + typedef struct { GIOChannel channel; gint fd; @@ -34,11 +33,21 @@ typedef struct { SSL *ssl; } SoupOpenSSLChannel; -static GIOError +static void +soup_openssl_free (GIOChannel *channel) +{ + SoupOpenSSLChannel *chan = (SoupOpenSSLChannel *) channel; + g_io_channel_unref (chan->real_sock); + SSL_free (chan->ssl); + g_free (chan); +} + +static GIOStatus soup_openssl_read (GIOChannel *channel, gchar *buf, guint count, - guint *bytes_read) + guint *bytes_read, + GError **err) { SoupOpenSSLChannel *chan = (SoupOpenSSLChannel *) channel; gint result; @@ -49,27 +58,32 @@ soup_openssl_read (GIOChannel *channel, /* This occurs when a re-handshake is required */ *bytes_read = 0; if (SSL_get_error (chan->ssl, result) == SSL_ERROR_WANT_READ) - return G_IO_ERROR_AGAIN; + return G_IO_STATUS_AGAIN; switch (errno) { case EINVAL: +#if 0 return G_IO_ERROR_INVAL; +#else + return G_IO_STATUS_ERROR; +#endif case EAGAIN: case EINTR: - return G_IO_ERROR_AGAIN; + return G_IO_STATUS_AGAIN; default: - return G_IO_ERROR_UNKNOWN; + return G_IO_STATUS_ERROR; } } else { *bytes_read = result; - return G_IO_ERROR_NONE; + return G_IO_STATUS_NORMAL; } } -static GIOError +static GIOStatus soup_openssl_write (GIOChannel *channel, - gchar *buf, - guint count, - guint *bytes_written) + const gchar *buf, + gsize count, + gsize *bytes_written, + GError **err) { SoupOpenSSLChannel *chan = (SoupOpenSSLChannel *) channel; gint result; @@ -78,119 +92,183 @@ soup_openssl_write (GIOChannel *channel, if (result < 0) { *bytes_written = 0; - if (SSL_get_error (chan->ssl, result) == SSL_ERROR_WANT_READ) - return G_IO_ERROR_AGAIN; + if (SSL_get_error (chan->ssl, result) == SSL_ERROR_WANT_WRITE) + return G_IO_STATUS_AGAIN; switch (errno) { case EINVAL: +#if 0 return G_IO_ERROR_INVAL; +#else + return G_IO_STATUS_ERROR; +#endif case EAGAIN: case EINTR: - return G_IO_ERROR_AGAIN; + return G_IO_STATUS_AGAIN; default: - return G_IO_ERROR_UNKNOWN; + return G_IO_STATUS_ERROR; } } else { *bytes_written = result; - return G_IO_ERROR_NONE; + + return (result > 0) ? G_IO_STATUS_NORMAL : G_IO_STATUS_EOF; } } -static GIOError -soup_openssl_seek (GIOChannel *channel, gint offset, GSeekType type) +static GIOStatus +soup_openssl_seek (GIOChannel *channel, + gint64 offset, + GSeekType type, + GError **err) { SoupOpenSSLChannel *chan = (SoupOpenSSLChannel *) channel; - return g_io_channel_seek (chan->real_sock, offset, type); + GIOError e; + + e = g_io_channel_seek (chan->real_sock, offset, type); + + if (e != G_IO_ERROR_NONE) + return G_IO_STATUS_ERROR; + else + return G_IO_STATUS_NORMAL; } -static void -soup_openssl_close (GIOChannel *channel) +static GIOStatus +soup_openssl_close (GIOChannel *channel, + GError **err) { SoupOpenSSLChannel *chan = (SoupOpenSSLChannel *) channel; g_io_channel_close (chan->real_sock); + + return G_IO_STATUS_NORMAL; } -static void -soup_openssl_free (GIOChannel *channel) +typedef struct { + GSource source; + GPollFD pollfd; + GIOChannel *channel; + GIOCondition condition; +} SoupOpenSSLWatch; + +static gboolean +soup_openssl_prepare (GSource *source, + gint *timeout) { - SoupOpenSSLChannel *chan = (SoupOpenSSLChannel *) channel; - g_io_channel_unref (chan->real_sock); - SSL_free (chan->ssl); - g_free (chan); + SoupOpenSSLWatch *watch = (SoupOpenSSLWatch *) source; + GIOCondition buffer_condition = g_io_channel_get_buffer_condition ( + watch->channel); + + *timeout = -1; + + /* Only return TRUE here if _all_ bits in watch->condition will be set + */ + return ((watch->condition & buffer_condition) == watch->condition); } -#if 0 +static gboolean +soup_openssl_check (GSource *source) +{ + SoupOpenSSLWatch *watch = (SoupOpenSSLWatch *) source; + GIOCondition buffer_condition = g_io_channel_get_buffer_condition ( + watch->channel); + GIOCondition poll_condition = watch->pollfd.revents; -/* Commented out until we can figure out why SSL_pending always fails */ + return ((poll_condition | buffer_condition) & watch->condition); +} -typedef struct { - GIOFunc func; - gpointer user_data; -} SoupOpenSSLReadData; - -static gboolean -soup_openssl_read_cb (GIOChannel *channel, - GIOCondition condition, - gpointer user_data) +static gboolean +soup_openssl_dispatch (GSource *source, + GSourceFunc callback, + gpointer user_data) { - SoupOpenSSLChannel *chan = (SoupOpenSSLChannel *) channel; - SoupOpenSSLReadData *data = user_data; + GIOFunc func = (GIOFunc) callback; + SoupOpenSSLWatch *watch = (SoupOpenSSLWatch *) source; + SoupOpenSSLChannel *chan = (SoupOpenSSLChannel *) watch->channel; + GIOCondition buffer_condition = g_io_channel_get_buffer_condition ( + watch->channel); + GIOCondition cond; + + if (!func) { + g_warning ("IO watch dispatched without callback\n" + "You must call g_source_connect()."); + return FALSE; + } + + cond = (watch->pollfd.revents | buffer_condition) & watch->condition; - if (condition & G_IO_IN) { - if (SSL_pending (chan->ssl) && - !(*data->func) (channel, condition, data->user_data)) { - g_free (data); + if (cond & G_IO_IN) { + do { + if (!(*func) (watch->channel, cond, user_data)) return FALSE; - } + } while (SSL_pending (chan->ssl)); + return TRUE; - } else return (*data->func) (channel, condition, data->user_data); + } else + return (*func) (watch->channel, cond, user_data); +} + +static void +soup_openssl_finalize (GSource *source) +{ + SoupOpenSSLWatch *watch = (SoupOpenSSLWatch *) source; + + g_io_channel_unref (watch->channel); } -static guint -soup_openssl_add_watch (GIOChannel *channel, - gint priority, - GIOCondition condition, - GIOFunc func, - gpointer user_data, - GDestroyNotify notify) +/* All of these functions were basically cut-and-pasted from glib */ +GSourceFuncs soup_openssl_watch_funcs = { + soup_openssl_prepare, + soup_openssl_check, + soup_openssl_dispatch, + soup_openssl_finalize +}; + +static GSource * +soup_openssl_create_watch (GIOChannel *channel, + GIOCondition condition) { SoupOpenSSLChannel *chan = (SoupOpenSSLChannel *) channel; if (condition & G_IO_IN) { - SoupOpenSSLReadData *data = g_new0 (SoupOpenSSLReadData, 1); - data->func = func; - data->user_data = user_data; - - return chan->real_sock->funcs->io_add_watch (channel, - priority, - condition, - soup_openssl_read_cb, - data, - notify); - } else return chan->real_sock->funcs->io_add_watch (channel, - priority, - condition, - func, - user_data, - notify); + GSource *source; + SoupOpenSSLWatch *watch; + + source = g_source_new (&soup_openssl_watch_funcs, + sizeof (SoupOpenSSLWatch)); + watch = (SoupOpenSSLWatch *) source; + + watch->channel = channel; + g_io_channel_ref (channel); + + watch->condition = condition; + + watch->pollfd.fd = chan->fd; + watch->pollfd.events = condition; + + g_source_add_poll (source, &watch->pollfd); + + return source; + } + else { + return chan->real_sock->funcs->io_create_watch (channel, + condition); + } } -#endif /* 0 */ +static GIOStatus +soup_openssl_set_flags (GIOChannel *channel, + GIOFlags flags, + GError **err) +{ + SoupOpenSSLChannel *chan = (SoupOpenSSLChannel *) channel; -static guint -soup_openssl_add_watch (GIOChannel *channel, - gint priority, - GIOCondition condition, - GIOFunc func, - gpointer user_data, - GDestroyNotify notify) + return chan->real_sock->funcs->io_set_flags (channel, flags, err); +} + +static GIOFlags +soup_openssl_get_flags (GIOChannel *channel) { SoupOpenSSLChannel *chan = (SoupOpenSSLChannel *) channel; - return chan->real_sock->funcs->io_add_watch (channel, - priority, - condition, - func, - user_data, - notify); + + return chan->real_sock->funcs->io_get_flags (channel); } GIOFuncs soup_openssl_channel_funcs = { @@ -198,8 +276,10 @@ GIOFuncs soup_openssl_channel_funcs = { soup_openssl_write, soup_openssl_seek, soup_openssl_close, - soup_openssl_add_watch, + soup_openssl_create_watch, soup_openssl_free, + soup_openssl_set_flags, + soup_openssl_get_flags }; static SSL_CTX *ssl_context = NULL; @@ -258,7 +338,7 @@ soup_openssl_get_iochannel (GIOChannel *sock) g_return_val_if_fail (sock != NULL, NULL); - if (!ssl_context && !soup_openssl_init ()) + if (!ssl_context && !soup_openssl_init (server_mode)) goto THROW_CREATE_ERROR; if (!soup_openssl_seed ()) @@ -283,12 +363,13 @@ soup_openssl_get_iochannel (GIOChannel *sock) goto THROW_CREATE_ERROR; } - if (!SSL_use_RSAPrivateKey_file (ssl, ckey_file, 1)) { + if (!SSL_use_RSAPrivateKey_file (ssl, ckey_file, SSL_FILETYPE_PEM)) { g_warning ("Unable to use private key file."); + ERR_print_errors_fp(stderr); goto THROW_CREATE_ERROR; } - if (!SSL_use_certificate_file (ssl, ccert_file, 1)) { + if (!SSL_use_certificate_file (ssl, ccert_file, SSL_FILETYPE_PEM)) { g_warning ("Unable to use certificate file."); goto THROW_CREATE_ERROR; } @@ -307,25 +388,31 @@ soup_openssl_get_iochannel (GIOChannel *sock) goto THROW_CREATE_ERROR; } - while (1) { - err = SSL_connect (ssl); - switch (SSL_get_error (ssl, err)) { - case SSL_ERROR_NONE: - break; - case SSL_ERROR_WANT_READ: - case SSL_ERROR_WANT_WRITE: - { - fd_set readfds; - FD_ZERO (&readfds); - FD_SET (sockfd, &readfds); - select (1, &readfds, NULL, NULL, NULL); - continue; + do { + fd_set ssl_fdset; + + if (server_mode) + err = SSL_accept (ssl); + else + err = SSL_connect (ssl); + + err = SSL_get_error (ssl, err); + + if (err == SSL_ERROR_WANT_READ) { + FD_ZERO (&ssl_fdset); + FD_SET (sockfd, &ssl_fdset); + select (sockfd + 1, &ssl_fdset, NULL, NULL, NULL); } - default: + else if (err == SSL_ERROR_WANT_WRITE) { + FD_ZERO (&ssl_fdset); + FD_SET (sockfd, &ssl_fdset); + select (sockfd + 1, NULL, &ssl_fdset, NULL, NULL); + } + else if (err != SSL_ERROR_NONE) { g_warning ("Could not establish secure connection."); goto THROW_CREATE_ERROR; } - } + } while (err != SSL_ERROR_NONE); bits = SSL_get_cipher_bits (ssl, &alg_bits); if (bits == 0) { @@ -333,12 +420,15 @@ soup_openssl_get_iochannel (GIOChannel *sock) goto THROW_CREATE_ERROR; } - cert = SSL_get_peer_certificate (ssl); - if (!cert) { - g_warning ("Server certificate unavailable"); - goto THROW_CREATE_ERROR; + if (!server_mode) { + cert = SSL_get_peer_certificate (ssl); + if (!cert) { + g_warning ("Server certificate unavailable"); + goto THROW_CREATE_ERROR; + } + else + X509_free (cert); } - X509_free (cert); chan = g_new0 (SoupOpenSSLChannel, 1); chan->fd = sockfd; @@ -356,8 +446,17 @@ soup_openssl_get_iochannel (GIOChannel *sock) return NULL; } +static int +verify_cb (int verified, X509_STORE_CTX *x509_ctx) +{ + if (!verified) + g_warning ("Unable to verify server's CA"); + + return verified; +} + gboolean -soup_openssl_init (void) +soup_openssl_init (gboolean server) { static gchar *ssl_ca_file = NULL; static gchar *ssl_ca_dir = NULL; @@ -365,7 +464,13 @@ soup_openssl_init (void) SSL_library_init (); SSL_load_error_strings (); - ssl_context = SSL_CTX_new (SSLv23_client_method ()); + server_mode = server; + + if (server_mode) + ssl_context = SSL_CTX_new (SSLv23_server_method ()); + else + ssl_context = SSL_CTX_new (SSLv23_client_method ()); + if (!ssl_context) { g_warning ("Unable to initialize OpenSSL library"); return FALSE; @@ -380,7 +485,7 @@ soup_openssl_init (void) SSL_CTX_load_verify_locations (ssl_context, ssl_ca_file, ssl_ca_dir); - SSL_CTX_set_verify (ssl_context, SSL_VERIFY_PEER, NULL); + SSL_CTX_set_verify (ssl_context, SSL_VERIFY_PEER, verify_cb); } return TRUE; diff --git a/libsoup/soup-openssl.h b/libsoup/soup-openssl.h index 2a00983b..dbcd25a7 100644 --- a/libsoup/soup-openssl.h +++ b/libsoup/soup-openssl.h @@ -18,6 +18,6 @@ GIOChannel *soup_openssl_get_iochannel (GIOChannel *sock); void soup_openssl_set_security_policy (SoupSecurityPolicy policy); -gboolean soup_openssl_init (void); +gboolean soup_openssl_init (gboolean server_mode); #endif /* SOUP_OPENSSL_H */ diff --git a/libsoup/soup-private.h b/libsoup/soup-private.h index 55005081..f31e979c 100644 --- a/libsoup/soup-private.h +++ b/libsoup/soup-private.h @@ -1,6 +1,6 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * soup-private.h: Asyncronous Callback-based SOAP Request Queue. + * soup-private.h: Asyncronous Callback-based HTTP Request Queue. * * Authors: * Alex Graveley (alex@helixcode.com) @@ -13,46 +13,16 @@ * extraneous circumstances. */ -#ifndef SOAP_PRIVATE_H -#define SOAP_PRIVATE_H 1 +#ifndef SOUP_PRIVATE_H +#define SOUP_PRIVATE_H 1 #ifdef HAVE_CONFIG_H #include <config.h> #endif -#ifdef SOUP_WIN32 -# include <malloc.h> -# define alloca _alloca -#else -# ifdef HAVE_ALLOCA_H -# include <alloca.h> -# else -# ifdef _AIX -# pragma alloca -# else -# ifndef alloca /* predefined by HP cc +Olibcalls */ - char *alloca (); -# endif -# endif -# endif -#endif - #include <sys/types.h> - -#ifdef HAVE_NETINET_IN_H #include <netinet/in.h> -#endif - -#ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> -#endif - -#ifdef SOUP_WIN32 -#define VERSION "Win/0.7.99" -#include <windows.h> -#include <winbase.h> -#include <winuser.h> -#endif #include <libsoup/soup-auth.h> #include <libsoup/soup-context.h> @@ -137,6 +107,8 @@ struct _SoupMessagePrivate { guint write_tag; guint timeout_tag; + guint retries; + SoupCallbackFn callback; gpointer user_data; @@ -156,7 +128,7 @@ struct _SoupMessagePrivate { void soup_message_issue_callback (SoupMessage *req); gboolean soup_message_run_handlers (SoupMessage *msg, - SoupHandlerEvent invoke_type); + SoupHandlerType invoke_type); void soup_message_cleanup (SoupMessage *req); diff --git a/libsoup/soup-queue.c b/libsoup/soup-queue.c index 365a582a..e0153657 100644 --- a/libsoup/soup-queue.c +++ b/libsoup/soup-queue.c @@ -1,6 +1,6 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * soup-queue.c: Asyncronous Callback-based SOAP Request Queue. + * soup-queue.c: Asyncronous Callback-based HTTP Request Queue. * * Authors: * Alex Graveley (alex@helixcode.com) @@ -79,9 +79,19 @@ soup_queue_error_cb (gboolean body_started, gpointer user_data) case SOUP_STATUS_SENDING_REQUEST: if (!body_started) { /* - * FIXME: Use exponential backoff here + * This can easily happen if we are using the OpenSSL + * out-of-process proxy and we couldn't establish an + * SSL connection. */ - soup_message_requeue (req); + if (req->priv->retries >= 3) { + soup_message_set_error ( + req, + SOUP_ERROR_CANT_CONNECT); + soup_message_issue_callback (req); + } else { + req->priv->retries++; + soup_message_requeue (req); + } } else { soup_message_set_error (req, SOUP_ERROR_IO); soup_message_issue_callback (req); @@ -198,7 +208,7 @@ soup_queue_read_headers_cb (const GString *headers, } SUCCESS_CONTINUE: - soup_message_run_handlers (req, SOUP_HANDLER_HEADERS); + soup_message_run_handlers (req, SOUP_HANDLER_PRE_BODY); return SOUP_TRANSFER_CONTINUE; THROW_MALFORMED_HEADER: @@ -217,7 +227,7 @@ soup_queue_read_chunk_cb (const SoupDataBuffer *data, req->response.length = data->length; req->response.body = data->body; - soup_message_run_handlers (req, SOUP_HANDLER_DATA); + soup_message_run_handlers (req, SOUP_HANDLER_BODY_CHUNK); return SOUP_TRANSFER_CONTINUE; } @@ -255,7 +265,7 @@ soup_queue_read_done_cb (const SoupDataBuffer *data, req->priv->read_tag = 0; } - soup_message_run_handlers (req, SOUP_HANDLER_FINISHED); + soup_message_run_handlers (req, SOUP_HANDLER_POST_BODY); } static void @@ -497,7 +507,7 @@ start_request (SoupContext *ctx, SoupMessage *req) req->status = SOUP_STATUS_SENDING_REQUEST; } -static SoupHandlerResult +static void proxy_https_connect_cb (SoupMessage *msg, gpointer user_data) { gboolean *ret = user_data; @@ -516,8 +526,6 @@ proxy_https_connect_cb (SoupMessage *msg, gpointer user_data) *ret = TRUE; } - - return SOUP_HANDLER_CONTINUE; } static gboolean @@ -538,8 +546,7 @@ proxy_https_connect (SoupContext *proxy, connect_msg = soup_message_new (dest_ctx, SOUP_METHOD_CONNECT); connect_msg->connection = conn; soup_message_add_handler (connect_msg, - SOUP_HANDLER_FINISHED, - NULL, + SOUP_HANDLER_POST_BODY, proxy_https_connect_cb, &ret); soup_message_send (connect_msg); diff --git a/libsoup/soup-queue.h b/libsoup/soup-queue.h index 30ba5d3f..0def1f44 100644 --- a/libsoup/soup-queue.h +++ b/libsoup/soup-queue.h @@ -1,6 +1,6 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * soup-queue.h: Asyncronous Callback-based SOAP Request Queue. + * soup-queue.h: Asyncronous Callback-based HTTP Request Queue. * * Authors: * Alex Graveley (alex@ximian.com) diff --git a/libsoup/soup-server.c b/libsoup/soup-server.c index 82c4179a..fe689ad0 100644 --- a/libsoup/soup-server.c +++ b/libsoup/soup-server.c @@ -1,6 +1,6 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * soup-server.c: Asyncronous Callback-based SOAP Request Queue. + * soup-server.c: Asyncronous Callback-based HTTP Request Queue. * * Authors: * Alex Graveley (alex@ximian.com) @@ -16,9 +16,7 @@ #include <config.h> #endif -#ifdef HAVE_UNISTD_H #include <unistd.h> -#endif #ifdef HAVE_SYS_FILIO_H #include <sys/filio.h> @@ -28,12 +26,6 @@ #include <sys/ioctl.h> #endif -#ifdef SOUP_WIN32 -#define ioctl ioctlsocket
-#define STDIN_FILENO 0
-#define STDOUT_FILENO 1 -#endif - extern char **environ; #include <string.h> @@ -200,6 +192,33 @@ static gboolean start_another_request (GIOChannel *serv_chan, GIOCondition condition, gpointer user_data); +static gboolean +check_close_connection (SoupMessage *msg) +{ + const char *connection_hdr; + gboolean close_connection; + + connection_hdr = soup_message_get_header (msg->request_headers, + "Connection"); + + if (msg->priv->http_version == SOUP_HTTP_1_0) { + if (connection_hdr && g_strcasecmp (connection_hdr, + "keep-alive") == 0) + close_connection = FALSE; + else + close_connection = TRUE; + } + else { + if (connection_hdr && g_strcasecmp (connection_hdr, + "close") == 0) + close_connection = TRUE; + else + close_connection = FALSE; + } + + return close_connection; +} /* check_close_connection */ + static void destroy_message (SoupMessage *msg) { @@ -208,18 +227,24 @@ destroy_message (SoupMessage *msg) SoupServerMessage *server_msg = msg->priv->server_msg; if (server_sock) { - if (server_msg && msg->priv->http_version == SOUP_HTTP_1_0) - /* - * Close the socket if we are using HTTP/1.0 and - * did not specify a Content-Length response header. - */ + GIOChannel *chan; + + chan = soup_socket_get_iochannel (server_sock); + + /* + * Close the socket if we're using HTTP/1.0 and + * "Connection: keep-alive" isn't specified, or if we're + * using HTTP/1.1 and "Connection: close" was specified. + */ + if (check_close_connection (msg)) { + g_io_channel_close (chan); soup_socket_unref (server_sock); + } else { /* * Listen for another request on this connection */ ServerConnectData *data; - GIOChannel *chan; data = g_new0 (ServerConnectData, 1); data->server = msg->priv->server; @@ -413,6 +438,85 @@ get_server_sockname (gint fd) return host; } +static void +write_header (gchar *key, gchar *value, GString *ret) +{ + g_string_sprintfa (ret, "%s: %s\r\n", key, value); +} + +static GString * +get_response_header (SoupMessage *req, + gboolean status_line, + SoupTransferEncoding encoding) +{ + GString *ret = g_string_new (NULL); + + if (status_line) + g_string_sprintfa (ret, + "HTTP/1.1 %d %s\r\n", + req->errorcode, + req->errorphrase); + else + g_string_sprintfa (ret, + "Status: %d %s\r\n", + req->errorcode, + req->errorphrase); + + if (encoding == SOUP_TRANSFER_CONTENT_LENGTH) + g_string_sprintfa (ret, + "Content-Length: %d\r\n", + req->response.length); + else if (encoding == SOUP_TRANSFER_CHUNKED) + g_string_append (ret, "Transfer-Encoding: chunked\r\n"); + + soup_message_foreach_header (req->response_headers, + (GHFunc) write_header, + ret); + + g_string_append (ret, "\r\n"); + + return ret; +} + +static inline void +set_response_error (SoupMessage *req, + guint code, + gchar *phrase, + gchar *body) +{ + if (phrase) + soup_message_set_error_full (req, code, phrase); + else + soup_message_set_error (req, code); + + req->response.owner = SOUP_BUFFER_STATIC; + req->response.body = body; + req->response.length = body ? strlen (req->response.body) : 0; +} + +static void +issue_bad_request (SoupMessage *msg) +{ + GString *header; + GIOChannel *channel; + + set_response_error (msg, SOUP_ERROR_BAD_REQUEST, NULL, NULL); + + header = get_response_header (msg, + FALSE, + SOUP_TRANSFER_CONTENT_LENGTH); + + channel = soup_socket_get_iochannel (msg->priv->server_sock); + + msg->priv->write_tag = + soup_transfer_write_simple (channel, + header, + &msg->response, + write_done_cb, + error_cb, + msg); +} /* issue_bad_request */ + static SoupTransferDone read_headers_cb (const GString *headers, SoupTransferEncoding *encoding, @@ -473,17 +577,7 @@ read_headers_cb (const GString *headers, req_host = soup_message_get_header (msg->request_headers, "Host"); - if (req_host) { - url = - g_strdup_printf ( - "%s%s:%d%s", - server->proto == SOUP_PROTOCOL_HTTPS ? - "https://" : - "http://", - req_host, - server->port, - req_path); - } else if (*req_path != '/') { + if (*req_path != '/') { /* * Check for absolute URI */ @@ -495,6 +589,16 @@ read_headers_cb (const GString *headers, soup_uri_free (absolute); } else goto THROW_MALFORMED_HEADER; + } else if (req_host) { + url = + g_strdup_printf ( + "%s%s:%d%s", + server->proto == SOUP_PROTOCOL_HTTPS ? + "https://" : + "http://", + req_host, + server->port, + req_path); } else { /* * No Host header, no AbsoluteUri @@ -531,65 +635,9 @@ read_headers_cb (const GString *headers, THROW_MALFORMED_HEADER: g_free (req_path); - destroy_message (msg); - - return SOUP_TRANSFER_END; -} - -static void -write_header (gchar *key, gchar *value, GString *ret) -{ - g_string_sprintfa (ret, "%s: %s\r\n", key, value); -} - -static GString * -get_response_header (SoupMessage *req, - gboolean status_line, - SoupTransferEncoding encoding) -{ - GString *ret = g_string_new (NULL); - - if (status_line) - g_string_sprintfa (ret, - "HTTP/1.1 %d %s\r\n", - req->errorcode, - req->errorphrase); - else - g_string_sprintfa (ret, - "Status: %d %s\r\n", - req->errorcode, - req->errorphrase); + issue_bad_request(msg); - if (encoding == SOUP_TRANSFER_CONTENT_LENGTH) - g_string_sprintfa (ret, - "Content-Length: %d\r\n", - req->response.length); - else if (encoding == SOUP_TRANSFER_CHUNKED) - g_string_append (ret, "Transfer-Encoding: chunked\r\n"); - - soup_message_foreach_header (req->response_headers, - (GHFunc) write_header, - ret); - - g_string_append (ret, "\r\n"); - - return ret; -} - -static inline void -set_response_error (SoupMessage *req, - guint code, - gchar *phrase, - gchar *body) -{ - if (phrase) - soup_message_set_error_full (req, code, phrase); - else - soup_message_set_error (req, code); - - req->response.owner = SOUP_BUFFER_STATIC; - req->response.body = body; - req->response.length = body ? strlen (req->response.body) : 0; + return SOUP_TRANSFER_CONTINUE; } static void @@ -792,19 +840,6 @@ read_done_cb (const SoupDataBuffer *data, req->priv->read_tag = 0; - /* FIXME: Do this in soap handler - action = soup_message_get_header (req->request_headers, "SOAPAction"); - if (!action) { - g_print ("No SOAPAction found in request.\n"); - set_response_error ( - req, - 403, - "Missing SOAPAction", - "The required SOAPAction header was not supplied."); - goto START_WRITE; - } - */ - call_handler (req, data, soup_context_get_uri (req->context)->path); channel = soup_socket_get_iochannel (server_sock); @@ -860,6 +895,7 @@ message_new (SoupServer *server) */ msg = soup_message_new (NULL, NULL); if (msg) { + msg->method = NULL; msg->priv->server = server; soup_server_ref (server); } @@ -926,7 +962,7 @@ conn_accept (GIOChannel *serv_chan, chan = soup_socket_get_iochannel (sock); if (server->proto == SOUP_PROTOCOL_HTTPS) { - chan = soup_ssl_get_iochannel (chan); + chan = soup_ssl_get_server_iochannel (chan); g_io_channel_unref (sock->iochannel); g_io_channel_ref (chan); sock->iochannel = chan; @@ -1156,6 +1192,33 @@ soup_server_get_handler (SoupServer *server, const gchar *path) return server->default_handler; } +SoupAddress * +soup_server_context_get_client_address (SoupServerContext *context) +{ + SoupSocket *socket; + SoupAddress *address; + + g_return_val_if_fail (context != NULL, NULL); + + socket = context->msg->priv->server_sock; + address = soup_socket_get_address (socket); + + return address; +} + +gchar * +soup_server_context_get_client_host (SoupServerContext *context) +{ + gchar *host; + SoupAddress *address; + + address = soup_server_context_get_client_address (context); + host = g_strdup (soup_address_get_canonical_name (address)); + soup_address_unref (address); + + return host; +} + static SoupServerAuthContext * auth_context_copy (SoupServerAuthContext *auth_ctx) { diff --git a/libsoup/soup-server.h b/libsoup/soup-server.h index 9245381a..c4bb6285 100644 --- a/libsoup/soup-server.h +++ b/libsoup/soup-server.h @@ -1,6 +1,6 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * soup-server.h: Asyncronous Callback-based SOAP Request Queue. + * soup-server.h: Asyncronous Callback-based HTTP Request Queue. * * Authors: * Alex Graveley (alex@helixcode.com) @@ -15,6 +15,7 @@ #include <libsoup/soup-message.h> #include <libsoup/soup-method.h> #include <libsoup/soup-misc.h> +#include <libsoup/soup-socket.h> #include <libsoup/soup-uri.h> #include <libsoup/soup-server-auth.h> @@ -82,6 +83,12 @@ SoupServerHandler *soup_server_get_handler (SoupServer *serv, GSList *soup_server_list_handlers (SoupServer *serv); +/* Functions for accessing information about the specific connection */ + +SoupAddress *soup_server_context_get_client_address (SoupServerContext *context); + +gchar *soup_server_context_get_client_host (SoupServerContext *context); + /* * Apache/soup-httpd module initializtion * Implement soup_server_init() in your shared library. diff --git a/libsoup/soup-socket-unix.c b/libsoup/soup-socket-unix.c index a46fecc8..c5dd86ba 100644 --- a/libsoup/soup-socket-unix.c +++ b/libsoup/soup-socket-unix.c @@ -36,7 +36,6 @@ #include "soup-socket.h" #include <netdb.h> -#include <resolv.h> #include <unistd.h> #include <arpa/inet.h> #include <arpa/nameser.h> @@ -69,6 +68,11 @@ # endif #endif +/* this generally causes problems, so remove from build atm */ +#ifdef SOUP_PTRACE_ATTACH +#undef SOUP_PTRACE_ATTACH +#endif + #ifndef socklen_t #define socklen_t size_t #endif @@ -192,7 +196,7 @@ soup_gethostbyname(const char* hostname, g_free(buf); } #else -#ifdef HAVE_GET_HOSTBYNAME_R_SOLARIS +#ifdef HAVE_GETHOSTBYNAME_R_SOLARIS { struct hostent result; size_t len; @@ -348,7 +352,7 @@ soup_gethostbyaddr (const char* addr, size_t length, int type) g_free(buf); } #else -#ifdef HAVE_GET_HOSTBYNAME_R_SOLARIS +#ifdef HAVE_GETHOSTBYNAME_R_SOLARIS { struct hostent result; size_t len; diff --git a/libsoup/soup-socket.c b/libsoup/soup-socket.c index 4b733205..0b51ce30 100644 --- a/libsoup/soup-socket.c +++ b/libsoup/soup-socket.c @@ -22,17 +22,9 @@ #include "soup-private.h" #include "soup-socket.h" -#ifdef SOUP_WIN32 -# define socklen_t gint32 -# define SOUP_CLOSE_SOCKET(fd) closesocket(fd) -# define SOUP_SOCKET_IOCHANNEL_NEW(fd) g_io_channel_win32_new_socket(fd) -#else -# include <unistd.h> -# ifndef socklen_t -# define socklen_t size_t -# endif -# define SOUP_CLOSE_SOCKET(fd) close(fd) -# define SOUP_SOCKET_IOCHANNEL_NEW(fd) g_io_channel_unix_new(fd) +#include <unistd.h> +#ifndef socklen_t +# define socklen_t size_t #endif #ifndef INET_ADDRSTRLEN @@ -315,8 +307,6 @@ soup_socket_connect_tcp_cb (SoupSocket* socket, SoupSocketConnectFn func = state->func; gpointer user_data = state->data; - g_free (state); - if (status == SOUP_SOCKET_NEW_STATUS_OK) (*func) (socket, SOUP_SOCKET_CONNECT_ERROR_NONE, @@ -325,6 +315,9 @@ soup_socket_connect_tcp_cb (SoupSocket* socket, (*func) (NULL, SOUP_SOCKET_CONNECT_ERROR_NETWORK, user_data); + + if (state->tcp_id) + g_free (state); } static void @@ -335,31 +328,23 @@ soup_socket_connect_inetaddr_cb (SoupAddress* inetaddr, SoupSocketConnectState* state = (SoupSocketConnectState*) data; if (status == SOUP_ADDRESS_STATUS_OK) { - gpointer tcp_id; - - state->inetaddr_id = NULL; - - tcp_id = soup_socket_new (inetaddr, - soup_socket_connect_tcp_cb, - state); - /* - * NOTE: soup_socket_new can fail immediately and call our - * callback which will delete the state. - */ - if (tcp_id) - state->tcp_id = tcp_id; - + state->tcp_id = soup_socket_new (inetaddr, + soup_socket_connect_tcp_cb, + state); soup_address_unref (inetaddr); } else { SoupSocketConnectFn func = state->func; gpointer user_data = state->data; - g_free (state); - (*func) (NULL, SOUP_SOCKET_CONNECT_ERROR_ADDR_RESOLVE, user_data); } + + if (state->inetaddr_id && !state->tcp_id) + g_free (state); + else + state->inetaddr_id = NULL; } /** @@ -377,8 +362,8 @@ soup_socket_connect_inetaddr_cb (SoupAddress* inetaddr, * returns. It will call the callback if there is a failure. * * Returns: ID of the connection which can be used with - * soup_socket_connect_cancel() to cancel it; NULL on - * failure. + * soup_socket_connect_cancel() to cancel it; NULL if it succeeds + * or fails immediately. **/ SoupSocketConnectId soup_socket_connect (const gchar* hostname, @@ -388,7 +373,6 @@ soup_socket_connect (const gchar* hostname, { SoupSocketConnectState* state; SoupAddress *cached_addr; - gpointer addr_id, tcp_id; g_return_val_if_fail (hostname != NULL, NULL); g_return_val_if_fail (func != NULL, NULL); @@ -400,35 +384,26 @@ soup_socket_connect (const gchar* hostname, /* Check if a cached version of the address already exists */ cached_addr = soup_address_lookup_in_cache (hostname, port); if (cached_addr) { - tcp_id = soup_socket_new (cached_addr, - soup_socket_connect_tcp_cb, - state); + state->tcp_id = soup_socket_new (cached_addr, + soup_socket_connect_tcp_cb, + state); soup_address_unref (cached_addr); - - /* - * NOTE: soup_socket_new can fail immediately and call our - * callback which will delete the state. - */ - if (tcp_id) { - state->tcp_id = tcp_id; - return state; - } else - return NULL; } else { - addr_id = soup_address_new (hostname, - port, - soup_socket_connect_inetaddr_cb, - state); - - /* - * NOTE: soup_address_new can fail immediately and call our - * callback which will delete the state. + state->inetaddr_id = soup_address_new (hostname, + port, + soup_socket_connect_inetaddr_cb, + state); + /* NOTE: soup_address_new could succeed immediately + * and call our callback, in which case state->inetaddr_id + * will be NULL but state->tcp_id may be set. */ - if (addr_id) { - state->inetaddr_id = addr_id; - return state; - } else - return NULL; + } + + if (state->tcp_id || state->inetaddr_id) + return state; + else { + g_free (state); + return NULL; } } @@ -532,7 +507,7 @@ soup_socket_unref (SoupSocket* s) --s->ref_count; if (s->ref_count == 0) { - SOUP_CLOSE_SOCKET (s->sockfd); + close (s->sockfd); if (s->addr) soup_address_unref (s->addr); if (s->iochannel) g_io_channel_unref (s->iochannel); @@ -567,7 +542,7 @@ soup_socket_get_iochannel (SoupSocket* socket) g_return_val_if_fail (socket != NULL, NULL); if (socket->iochannel == NULL) - socket->iochannel = SOUP_SOCKET_IOCHANNEL_NEW (socket->sockfd); + socket->iochannel = g_io_channel_unix_new (socket->sockfd); g_io_channel_ref (socket->iochannel); @@ -631,6 +606,8 @@ soup_socket_server_new (const gint port) SoupSocket* s; struct sockaddr_in* sa_in; socklen_t socklen; + const int on = 1; + gint flags; /* Create socket */ s = g_new0 (SoupSocket, 1); @@ -650,32 +627,21 @@ soup_socket_server_new (const gint port) sa_in->sin_addr.s_addr = g_htonl (INADDR_ANY); sa_in->sin_port = g_htons (port); - /* - * For Unix, set REUSEADDR and NONBLOCK. - * For Windows, set NONBLOCK during accept. - */ -#ifndef SOUP_WIN32 - { - const int on = 1; - gint flags; - - /* Set REUSEADDR so we can reuse the port */ - if (setsockopt (s->sockfd, - SOL_SOCKET, - SO_REUSEADDR, - &on, - sizeof (on)) != 0) - g_warning("Can't set reuse on tcp socket\n"); - - /* Get the flags (should all be 0?) */ - flags = fcntl (s->sockfd, F_GETFL, 0); - if (flags == -1) goto SETUP_ERROR; - - /* Make the socket non-blocking */ - if (fcntl (s->sockfd, F_SETFL, flags | O_NONBLOCK) == -1) - goto SETUP_ERROR; - } -#endif + /* Set REUSEADDR so we can reuse the port */ + if (setsockopt (s->sockfd, + SOL_SOCKET, + SO_REUSEADDR, + &on, + sizeof (on)) != 0) + g_warning("Can't set reuse on tcp socket\n"); + + /* Get the flags (should all be 0?) */ + flags = fcntl (s->sockfd, F_GETFL, 0); + if (flags == -1) goto SETUP_ERROR; + + /* Make the socket non-blocking */ + if (fcntl (s->sockfd, F_SETFL, flags | O_NONBLOCK) == -1) + goto SETUP_ERROR; /* Bind */ if (bind (s->sockfd, &s->addr->sa, sizeof (s->addr->sa)) != 0) @@ -691,7 +657,7 @@ soup_socket_server_new (const gint port) return s; SETUP_ERROR: - SOUP_CLOSE_SOCKET (s->sockfd); + close (s->sockfd); g_free (s->addr); g_free (s); return NULL; diff --git a/libsoup/soup-socket.h b/libsoup/soup-socket.h index a190ecfb..e9d942c5 100644 --- a/libsoup/soup-socket.h +++ b/libsoup/soup-socket.h @@ -1,6 +1,6 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * soup-socket.c: ronous Callback-based SOAP Request Queue. + * soup-socket.c: ronous Callback-based HTTP Request Queue. * * Authors: * David Helder (dhelder@umich.edu) diff --git a/libsoup/soup-socks.c b/libsoup/soup-socks.c index 623be186..22948590 100644 --- a/libsoup/soup-socks.c +++ b/libsoup/soup-socks.c @@ -1,6 +1,6 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * soup-queue.c: Asyncronous Callback-based SOAP Request Queue. + * soup-queue.c: Asyncronous Callback-based HTTP Request Queue. * * Authors: * Alex Graveley (alex@helixcode.com) diff --git a/libsoup/soup-socks.h b/libsoup/soup-socks.h index a1d84616..e602cfa0 100644 --- a/libsoup/soup-socks.h +++ b/libsoup/soup-socks.h @@ -1,6 +1,6 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * soup-socks.h: Asyncronous Callback-based SOAP Request Queue. + * soup-socks.h: Asyncronous Callback-based HTTP Request Queue. * * Authors: * Alex Graveley (alex@helixcode.com) diff --git a/libsoup/soup-ssl-proxy.c b/libsoup/soup-ssl-proxy.c index 5d94066a..e161acce 100644 --- a/libsoup/soup-ssl-proxy.c +++ b/libsoup/soup-ssl-proxy.c @@ -12,10 +12,7 @@ #include <config.h> #endif -#ifdef HAVE_UNISTD_H #include <unistd.h> -#endif - #include <fcntl.h> #include <stdlib.h> #include <errno.h> @@ -33,6 +30,8 @@ static gint ssl_library = 0; /* -1 = fail, 1 = openssl */ static SoupSecurityPolicy ssl_security_level = SOUP_SECURITY_DOMESTIC; +static gboolean server_mode = FALSE; + static GMainLoop *loop; static void @@ -58,7 +57,8 @@ soup_ssl_proxy_init (void) ssl_library = -1; #ifdef HAVE_OPENSSL_SSL_H - if (ssl_library == -1) ssl_library = soup_openssl_init () ? 1 : -1; + if (ssl_library == -1) + ssl_library = soup_openssl_init (server_mode) ? 1 : -1; #endif if (ssl_library == -1) return; @@ -115,7 +115,8 @@ soup_ssl_proxy_readwrite (GIOChannel *iochannel, write_total += bytes_written; } - if (condition & (G_IO_HUP | G_IO_ERR)) goto FINISH; + if (condition & G_IO_ERR) + goto FINISH; return TRUE; @@ -131,6 +132,11 @@ main (int argc, char** argv) GIOChannel *read_chan, *write_chan, *sock_chan; int sockfd, secpol, flags; + if (getenv ("SOUP_PROXY_DELAY")) { + g_warning ("Proxy delay set: sleeping for 20 seconds"); + sleep (20); + } + loop = g_main_new (FALSE); env = getenv ("SOCKFD"); @@ -148,6 +154,10 @@ main (int argc, char** argv) secpol = atoi (env); soup_ssl_proxy_set_security_policy (secpol); + env = getenv ("IS_SERVER"); + if (env) + server_mode = TRUE; + read_chan = g_io_channel_unix_new (STDIN_FILENO); if (!read_chan) g_error ("Unable to open STDIN"); @@ -156,13 +166,13 @@ main (int argc, char** argv) if (!write_chan) g_error ("Unable to open STDOUT"); - /* Block on socket write */ + /* We use select. All fds should block. */ flags = fcntl(sockfd, F_GETFL, 0); fcntl (sockfd, F_SETFL, flags & ~O_NONBLOCK); - - /* Don't block on STDIN read */ flags = fcntl(STDIN_FILENO, F_GETFL, 0); - fcntl (STDIN_FILENO, F_SETFL, flags | O_NONBLOCK); + fcntl (STDIN_FILENO, F_SETFL, flags & ~O_NONBLOCK); + flags = fcntl(STDOUT_FILENO, F_GETFL, 0); + fcntl (STDOUT_FILENO, F_SETFL, flags & ~O_NONBLOCK); sock_chan = g_io_channel_unix_new (sockfd); sock_chan = soup_ssl_proxy_get_iochannel (sock_chan); @@ -170,12 +180,12 @@ main (int argc, char** argv) g_error ("Unable to establish SSL connection"); g_io_add_watch (read_chan, - G_IO_IN | G_IO_HUP | G_IO_ERR, + G_IO_IN | G_IO_PRI | G_IO_ERR, (GIOFunc) soup_ssl_proxy_readwrite, sock_chan); g_io_add_watch (sock_chan, - G_IO_IN | G_IO_HUP | G_IO_ERR, + G_IO_IN | G_IO_PRI | G_IO_ERR, (GIOFunc) soup_ssl_proxy_readwrite, write_chan); diff --git a/libsoup/soup-ssl.c b/libsoup/soup-ssl.c index 05302cad..63adb338 100644 --- a/libsoup/soup-ssl.c +++ b/libsoup/soup-ssl.c @@ -1,6 +1,6 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * soup-queue.c: Asyncronous Callback-based SOAP Request Queue. + * soup-queue.c: Asyncronous Callback-based HTTP Request Queue. * * Authors: * Alex Graveley (alex@ximian.com) @@ -12,21 +12,12 @@ #include <config.h> #endif -#ifdef HAVE_UNISTD_H #include <unistd.h> -#endif - -#ifdef HAVE_SYS_WAIT_H +#include <sys/types.h> #include <sys/wait.h> -#endif - -#ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> -#endif - #include <stdlib.h> #include <stdio.h> -#include <sys/types.h> #include <errno.h> #include <fcntl.h> @@ -34,23 +25,14 @@ #include "soup-nss.h" #include "soup-misc.h" -#ifdef SOUP_WIN32 - -GIOChannel * -soup_ssl_get_iochannel (GIOChannel *sock) -{ - return NULL; -} - -#else /* SOUP_WIN32 */ #ifdef HAVE_NSS GIOChannel * -soup_ssl_get_iochannel (GIOChannel *sock) +soup_ssl_get_iochannel_real (GIOChannel *sock, SoupSSLType type) { g_return_val_if_fail (sock != NULL, NULL); - return soup_nss_get_iochannel (sock); + return soup_nss_get_iochannel (sock, type); } #else /* HAVE_NSS */ @@ -63,13 +45,14 @@ soup_ssl_hup_waitpid (GIOChannel *source, GIOCondition condition, gpointer ppid) return FALSE; } -GIOChannel * -soup_ssl_get_iochannel (GIOChannel *sock) +static GIOChannel * +soup_ssl_get_iochannel_real (GIOChannel *sock, SoupSSLType type) { GIOChannel *new_chan; int sock_fd; int pid; int pair[2], flags; + const char *cert_file, *key_file; g_return_val_if_fail (sock != NULL, NULL); @@ -101,6 +84,31 @@ soup_ssl_get_iochannel (GIOChannel *sock) putenv (g_strdup_printf ("SECURITY_POLICY=%d", soup_get_security_policy ())); + if (type == SOUP_SSL_TYPE_SERVER) + putenv ("IS_SERVER=1"); + + if (soup_get_ssl_ca_file ()) { + putenv (g_strdup_printf ("HTTPS_CA_FILE=%s", + soup_get_ssl_ca_file ())); + } + + if (soup_get_ssl_ca_dir ()) { + putenv (g_strdup_printf ("HTTPS_CA_DIR=%s", + soup_get_ssl_ca_dir ())); + } + + soup_get_ssl_cert_files (&cert_file, &key_file); + + if (cert_file) { + putenv (g_strdup_printf ("HTTPS_CERT_FILE=%s", + cert_file)); + } + + if (key_file) { + putenv (g_strdup_printf ("HTTPS_KEY_FILE=%s", + key_file)); + } + execl (BINDIR G_DIR_SEPARATOR_S SSL_PROXY_NAME, BINDIR G_DIR_SEPARATOR_S SSL_PROXY_NAME, NULL); @@ -116,11 +124,9 @@ soup_ssl_get_iochannel (GIOChannel *sock) fcntl (pair [1], F_SETFL, flags | O_NONBLOCK); new_chan = g_io_channel_unix_new (pair [1]); - g_io_add_watch (new_chan, G_IO_HUP, + g_io_add_watch (new_chan, G_IO_HUP | G_IO_ERR | G_IO_NVAL, soup_ssl_hup_waitpid, GINT_TO_POINTER (pid)); - /* FIXME: Why is this needed?? */ - g_io_channel_ref (new_chan); return new_chan; ERROR: @@ -132,4 +138,15 @@ soup_ssl_get_iochannel (GIOChannel *sock) } #endif /* HAVE_NSS */ -#endif /* SOUP_WIN32 */ + +GIOChannel * +soup_ssl_get_iochannel (GIOChannel *sock) +{ + return soup_ssl_get_iochannel_real (sock, SOUP_SSL_TYPE_CLIENT); +} + +GIOChannel * +soup_ssl_get_server_iochannel (GIOChannel *sock) +{ + return soup_ssl_get_iochannel_real (sock, SOUP_SSL_TYPE_SERVER); +} diff --git a/libsoup/soup-ssl.h b/libsoup/soup-ssl.h index 0cfd438b..9e398e48 100644 --- a/libsoup/soup-ssl.h +++ b/libsoup/soup-ssl.h @@ -1,6 +1,6 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * soup-queue.c: Asyncronous Callback-based SOAP Request Queue. + * soup-queue.c: Asyncronous Callback-based HTTP Request Queue. * * Authors: * Alex Graveley (alex@helixcode.com) @@ -13,6 +13,12 @@ #include <glib.h> +typedef enum { + SOUP_SSL_TYPE_CLIENT = 0, + SOUP_SSL_TYPE_SERVER +} SoupSSLType; + GIOChannel *soup_ssl_get_iochannel (GIOChannel *sock); +GIOChannel *soup_ssl_get_server_iochannel (GIOChannel *sock); #endif /* SOUP_SSL_H */ diff --git a/libsoup/soup-transfer.c b/libsoup/soup-transfer.c index 332cd7c0..fdbc4562 100644 --- a/libsoup/soup-transfer.c +++ b/libsoup/soup-transfer.c @@ -1,6 +1,6 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * soup-queue.c: Asyncronous Callback-based SOAP Request Queue. + * soup-queue.c: Asyncronous Callback-based HTTP Request Queue. * * Authors: * Alex Graveley (alex@helixcode.com) @@ -50,7 +50,7 @@ DUMP_WRITE (guchar *data, gint bytes_written) typedef struct { /* - * Length remaining to be downloaded of the current chunk data. + * Length of the current chunk data. */ guint len; @@ -219,34 +219,6 @@ remove_block_at_index (GByteArray *arr, gint offset, gint length) g_byte_array_set_size (arr, arr->len - length); } -/* - * Count number of hex digits, and convert to decimal. Store number of hex - * digits read in @width. - */ -static gint -decode_hex (const gchar *src, gint *width) -{ - gint new_len = 0, j; - - *width = 0; - - while (isxdigit (*src)) { - (*width)++; - src++; - } - src -= *width; - - for (j = *width - 1; j + 1; j--) { - if (isdigit (*src)) - new_len += (*src - 0x30) << (4*j); - else - new_len += (tolower (*src) - 0x57) << (4*j); - src++; - } - - return new_len; -} - static gboolean decode_chunk (SoupTransferChunkState *s, GByteArray *arr, @@ -259,73 +231,68 @@ decode_chunk (SoupTransferChunkState *s, while (TRUE) { gint new_len = 0; gint len = 0; - gchar *i = &arr->data [s->idx + s->len]; - - /* - * Not enough data to finish the chunk (and the smallest - * possible next chunk header), break - */ - if (s->idx + s->len + 5 > arr->len) - break; - /* - * Check for end of chunk header, otherwise break. Avoid - * trailing \r\n from previous chunk body if this is not the - * opening chunk. - */ if (s->len) { - if (soup_substring_index ( - i + 2, - arr->len - s->idx - s->len - 2, - "\r\n") <= 0) - break; - } else if (soup_substring_index (arr->data, - arr->len, - "\r\n") <= 0) + /* We're in the middle of a chunk. If we don't + * have the entire chunk and the trailing CRLF + * yet, read more. + */ + if (s->idx + s->len + 2 > arr->len) break; - /* - * Remove trailing \r\n after previous chunk body + /* + * Increment datalen and s->idx, and remove + * the trailing CRLF. + */ + s->idx += s->len; + *datalen += s->len; + remove_block_at_index (arr, s->idx, 2); + + /* + * Ready for the next chunk. + */ + s->len = 0; + } + + /* + * We're at the start of a new chunk. If we don't have + * the complete chunk header, wait for more. */ - if (s->len) - remove_block_at_index (arr, s->idx + s->len, 2); + len = soup_substring_index (&arr->data [s->idx], + arr->len - s->idx, + "\r\n"); + if (len < 0) + break; + len += 2; - new_len = decode_hex (i, &len); + new_len = strtol (&arr->data [s->idx], NULL, 16); g_assert (new_len >= 0); - /* - * Previous chunk is now processed, add its length to index and - * datalen. + /* + * If this is the final (zero-length) chunk, we need + * to have all of the trailing entity headers as well. */ - s->idx += s->len; - *datalen += s->len; + if (new_len == 0) { + len = soup_substring_index (&arr->data [s->idx], + arr->len - s->idx, + "\r\n\r\n"); + if (len < 0) + break; - /* - * Update length for next chunk's size - */ - s->len = new_len; - - /* - * FIXME: Add entity headers we find here to - * req->response_headers. - */ - len += soup_substring_index (&arr->data [s->idx + len], - arr->len - s->idx - len, - "\r\n"); + /* + * FIXME: Add entity headers we find here to + * req->response_headers. + */ - /* - * Zero-length chunk closes transfer. Include final \r\n after - * empty chunk. - */ - if (s->len == 0) { - len += 2; + len += 4; ret = TRUE; } /* - * Remove hexified length, entity headers, and trailing \r\n + * Remove chunk header and get ready for chunk data. */ - remove_block_at_index (arr, s->idx, len + 2); + remove_block_at_index (arr, s->idx, len); + s->len = new_len; } return ret; @@ -378,7 +345,8 @@ read_chunk (SoupReader *r, gboolean *cancelled) if (*cancelled) goto CANCELLED; /* - * If overwrite, remove datalen worth of data from start of buffer + * If overwrite, remove already-processed data from start + * of buffer */ if (r->overwrite_chunks) { remove_block_at_index (arr, 0, s->idx); diff --git a/libsoup/soup-transfer.h b/libsoup/soup-transfer.h index ba0d6af1..ab556b1d 100644 --- a/libsoup/soup-transfer.h +++ b/libsoup/soup-transfer.h @@ -1,6 +1,6 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * soup-queue.c: Asyncronous Callback-based SOAP Request Queue. + * soup-queue.c: Asyncronous Callback-based HTTP Request Queue. * * Authors: * Alex Graveley (alex@helixcode.com) diff --git a/libsoup/soup-uri.c b/libsoup/soup-uri.c index 970e2b4f..8d11f467 100644 --- a/libsoup/soup-uri.c +++ b/libsoup/soup-uri.c @@ -58,6 +58,7 @@ SoupKnownProtocols known_protocols [] = { { SOUP_PROTOCOL_SMTP, "mailto:", 25 }, { SOUP_PROTOCOL_SOCKS4, "socks4://", -1 }, { SOUP_PROTOCOL_SOCKS5, "socks5://", -1 }, + { SOUP_PROTOCOL_FILE, "file://", -1 }, { 0 } }; @@ -325,7 +326,10 @@ soup_uri_new (const gchar* uri_string) } /* Must have a protocol */ - if (!g_uri->protocol) return NULL; + if (!g_uri->protocol) { + g_free (g_uri); + return NULL; + } /* If there is an @ sign, look for user, authmech, and * password before it. diff --git a/libsoup/soup-uri.h b/libsoup/soup-uri.h index f7d297a4..c83952bf 100644 --- a/libsoup/soup-uri.h +++ b/libsoup/soup-uri.h @@ -34,7 +34,8 @@ typedef enum { SOUP_PROTOCOL_HTTPS, SOUP_PROTOCOL_SMTP, SOUP_PROTOCOL_SOCKS4, - SOUP_PROTOCOL_SOCKS5 + SOUP_PROTOCOL_SOCKS5, + SOUP_PROTOCOL_FILE } SoupProtocol; typedef struct { diff --git a/libsoup/soup.h b/libsoup/soup.h index bda95f1f..f5fc25e0 100644 --- a/libsoup/soup.h +++ b/libsoup/soup.h @@ -1,6 +1,6 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * soup.h: Asyncronous Callback-based SOAP Request Queue. + * soup.h: Asyncronous Callback-based HTTP Request Queue. * * Authors: * Alex Graveley (alex@helixcode.com) @@ -16,14 +16,8 @@ extern "C" { #endif #include <libsoup/soup-context.h> -#include <libsoup/soup-dav.h> -#include <libsoup/soup-dav-server.h> #include <libsoup/soup-message.h> #include <libsoup/soup-misc.h> -#include <libsoup/soup-fault.h> -#include <libsoup/soup-env.h> -#include <libsoup/soup-parser.h> -#include <libsoup/soup-serializer.h> #include <libsoup/soup-socket.h> #include <libsoup/soup-uri.h> diff --git a/soup-2.0.pc.in b/soup-2.0.pc.in index 3324fbf3..562e4996 100644 --- a/soup-2.0.pc.in +++ b/soup-2.0.pc.in @@ -3,9 +3,9 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ -Name: Soup -Description: a SOAP client library in C. +Name: libsoup +Description: a glib-based HTTP library Version: @VERSION@ -Requires: glib -Libs: -L${libdir} -lsoup @XML_LIBS@ -Cflags: -I${includedir}/soup @XML_CFLAGS@
\ No newline at end of file +Requires: glib-2.0 +Libs: -L${libdir} -lsoup-2.0 +Cflags: -I${includedir}/soup-2.0 |