platform/upstream/libsoup.git
21 years ago Beginnings of improved synchronous API support
Dan Winship [Tue, 9 Sep 2003 15:33:48 +0000 (15:33 +0000)]
Beginnings of improved synchronous API support

* libsoup/soup-dns.c: Simplify this by making it not automatically
return the result: force the caller to poll. (This isn't really a
performance issue: the results should come back quickly anyway.)
Also, make the cache thread-safe.
(soup_dns_entry_from_name): Was soup_gethostbyname
(soup_dns_entry_from_addr): Was soup_gethostbyaddr
(soup_dns_entry_check_lookup): Used to poll to see if DNS is done
(soup_dns_entry_get_hostent): Gets the hostent from an entry (and
blocks if it's not resolved yet).

* libsoup/soup-address.c: Update for soup-dns changes.
(soup_address_new): Don't automatically start resolving the
hostname now, since we don't know if the caller is going to want
it resolved synchronously or asynchronously.
(soup_address_resolve_async): Renamed from soup_address_resolve.
(soup_address_resolve_sync): New routine to do blocking
synchronous DNS.

* libsoup/soup-socket.c (soup_socket_connect): Now returns a
status value directly when connecting synchronously.
(soup_socket_client_new_async, soup_socket_client_new_sync):
Separate async/sync client socket functions.
(soup_socket_get_iochannel): Made static since it was not used
outside soup-socket.

* libsoup/soup-connection.c (soup_connection_new,
soup_connection_new_proxy, soup_connection_new_tunnel): Just set
up the data, don't actually start connecting.
(soup_connection_connect_async, soup_connection_connect_sync): New
async and sync SoupConnection connecting routines.
(soup_connection_get_socket): Remove this since it wasn't being
used.

* libsoup/soup-session.c (final_finished): Run the queue since a
connection is now freed up.
(run_queue): Update for soup_connection_new* changes.

* libsoup/soup-misc.c (soup_substring_index): Remove, since it
wasn't being used any more.

* libsoup/soup-private.h: Remove some prototypes for functions
that no longer exist.

* libsoup/soup-uri.c (soup_uri_copy_root): New utility function
(copies the protocol, host, and port of a SoupUri).

* tests/auth-test.c:
* tests/get.c:
* tests/simple-proxy.c: belatedly update for soup-session change

* tests/revserver.c: Handle each new connection in its own thread,
using synchronous SoupSocket calls.

21 years agoMove a bunch of logic here from soup-context. Now the session keeps track
Dan Winship [Fri, 5 Sep 2003 20:02:15 +0000 (20:02 +0000)]
Move a bunch of logic here from soup-context. Now the session keeps track

* libsoup/soup-session.c: Move a bunch of logic here from
soup-context. Now the session keeps track of hosts (instead of
having a global soup_hosts hash) and their connections.
(soup_session_new_with_proxy, soup_session_new_full): New session
constructors to specify a proxy or a proxy and connection limits
(send_request): Add Authorization and Proxy-Authorization headers
before sending off the request.
(soup_session_queue_message, et al): Improve the way this works.
There's no need to use timeouts to wait for connections to become
free; we *know* when they become free.

* libsoup/soup-private.h: Remove SoupHost and some other
no-longer-used stuff.

* libsoup/soup-misc.c (soup_set_proxy, soup_get_proxy,
soup_set_connection_limit, soup_set_connection_limit): Gone. These
are all per-session now.

* libsoup/soup-message.c: Remove all SoupContext references
(mostly replaced with SoupUri references)
(cleanup_message): priv->connect_tag and priv->connection are gone
now, so this was just soup_message_io_cancel(). So remove
cleanup_message and replace it with that everywhere.
(soup_message_disconnect): Gone.
(soup_message_set_uri): Replaces soup_message_set_context.
(soup_message_set_connection, soup_message_get_connection): Gone

* libsoup/soup-message-server-io.c (parse_request_headers):
s/soup_message_set_context/soup_message_set_uri/

* libsoup/soup-message-private.h (SoupMessagePrivate): Remove
connect_tag, context, and connection.

* libsoup/soup-message-client-io.c (encode_http_auth): Gone.

* libsoup/soup-context.c: Gone

* tests/auth-test.c (identify_auth): update for session/context
changes

21 years agoRenamed from soup-error.h, with types and defines renamed accordingly.
Dan Winship [Wed, 3 Sep 2003 14:00:24 +0000 (14:00 +0000)]
Renamed from soup-error.h, with types and defines renamed accordingly.

* libsoup/soup-status.h: Renamed from soup-error.h, with types
and defines renamed accordingly.

* libsoup/soup-message.h (SoupMessage): Rename errorcode to
status_code and errorphrase to reason_phrase. Remove errorclass.
(SOUP_MESSAGE_IS_ERROR): Remove this. You can't classify redirects
as being either "errors" or "not errors", so its semantics are
guaranteed to be wrong sometimes.

* libsoup/soup-message.c (soup_message_set_status,
soup_message_set_status_full): Renamed

* libsoup/soup-message-handlers.c
(soup_message_add_status_code_handler,
soup_message_add_status_class_handler): Rename.

* libsoup/soup-session.c (soup_session_send_message): Make this
return a status code rather than a status class.

* libsoup/soup-message-private.h (SoupMessagePrivate): Remove some
unrelated unused fields (retries, callback, user_data).

* ...: Updates

21 years agoFirst draft at the new object to maintain formerly-global state. (Not yet
Dan Winship [Tue, 2 Sep 2003 16:15:19 +0000 (16:15 +0000)]
First draft at the new object to maintain formerly-global state. (Not yet

* libsoup/soup-session.c: First draft at the new object to
maintain formerly-global state. (Not yet complete; still need to
get rid of SoupContext).

* libsoup/soup-message-queue.c: Data structure used by SoupSession

* libsoup/soup-queue.c: Gone. Mostly moved into soup-session, but
some bits went into soup-connection.

* libsoup/soup-connection.c (soup_connection_send_request): New,
to send a request on a connection. The connection updates its
internal state and then hands off to soup_message_send_request.
(request_done): Callback set up by soup_connection_send_request.
Marks the connection as no-longer-in-use, and disconnects it if
the message says to.
(soup_connection_set_in_use, soup_connection_mark_old): No longer
needed; the connection takes care of this itself now.
(soup_connection_new_proxy): New, to create a new connection that
is explicitly marked as being through an HTTP proxy.
(soup_connection_new_tunnel): New, to create a new HTTPS
connection through a proxy. (Includes the code to send the
CONNECT.)

* libsoup/soup-context.c (try_existing_connections): Don't need to
call soup_connection_set_in_use.
(try_create_connection): Use soup_connection_new,
soup_connection_new_proxy, or soup_connection_new_tunnel as
appropriate.

* libsoup/soup-message.c (soup_message_prepare): Replaces
queue_message.
(soup_message_queue, soup_message_requeue, soup_message_prepare):
Gone. This must be done via a SoupSession now.
(soup_message_set_connection): don't need to mark in_use/not
in_use. Also, msg->priv->socket is gone now.
(soup_message_get_socket): Gone.

* libsoup/soup-message-handlers.c (soup_message_run_handlers):
Remove references to global handlers.
(redirect_handler, authorize_handler): Moved to soup-session.c.

* libsoup/soup-misc.c (soup_shutdown): Gone; just unref the
session to shut down now.

* libsoup/soup.h: add soup-session.h

* libsoup/Makefile.am: updates

* tests/auth-test.c, tests/get.c, tests/simple-proxy.c: Use
SoupSession.

21 years agoMajor rewrite. There is now only a single IO state object (instead of one
Dan Winship [Fri, 29 Aug 2003 22:24:54 +0000 (22:24 +0000)]
Major rewrite. There is now only a single IO state object (instead of one

* libsoup/soup-message-io.c: Major rewrite. There is now only a
single IO state object (instead of one for reading and one for
writing), and the IO code handles switching back and forth between
reading and writing as appropriate (including handling the extra
switches needed for "Expect: 100-continue").
(soup_message_io_client, soup_message_io_server): The new entry
points.
(soup_message_io_cancel): If the caller cancels the IO when we
were expecting to read more data, disconnect the socket.

* libsoup/soup-message.h (SoupMessageFlags): add
SOUP_MESSAGE_EXPECT_CONTINUE, to indicate that the IO code should
do the special expect-continue handling.

* libsoup/soup-message.c: Move all the signal stuff here. Remove
the "done_reading" and "done_writing" signals and replace them
with a single "finished" signal. (A single signal. Say that 10
times fast!)
(soup_message_got_headers, etc): Functions to emit signals.
(got_headers, got_chunk, got_body): Default signal methods that
call soup_message_run_handlers.
(finished): Default signal method that replaces
soup_message_issue_callback.
([various]): s/soup_message_issue_callback/soup_message_finished/
(soup_message_requeue): There's no soup_message_set_read_callbacks
any more, so if the caller requeues while it's still reading, just
cancel the read.
(soup_message_add_chunk, soup_message_add_final_chunk,
soup_message_pop_chunk): Moved here from soup-server-message,
although we don't actually quite support using chunked encoding
for requests yet.

* libsoup/soup-server-message.c (soup_server_message_new): No
longer takes a socket argument.
(soup_server_message_add_chunk, soup_server_message_get_chunk):
Moved into SoupMessage.

* libsoup/soup-message-handlers.c (global_handlers): Make these
POST_BODY rather than PRE_BODY, so they won't mess up the IO
channel when the requeue the message.
(soup_message_run_handlers): Don't need to issue the message
callback from here any more.
(authorize_handler): Just leave the error as 401 or 407 (see
soup-error.h change)

* libsoup/soup-message-client-io.c (soup_message_send_request):
Replaces soup_message_write_request and
soup_message_read_response.

* libsoup/soup-message-server-io.c: Parallel to
soup-message-client-io.c, this defines the server-side header
handling.
(soup_message_read_request): Its entry point.

* libsoup/soup-server.c: Lots of code moved into
soup-message-server-io.c. Update for other changes.

* libsoup/soup-queue.c: Update for changes

* libsoup/soup-socket.c (read_from_network, soup_socket_write):
Don't call soup_socket_disconnect() on an error, just return
SOUP_SOCKET_ERROR. Otherwise soup_socket_disconnect() could emit
signals that will mess up the caller of the read/write function.

* libsoup/soup-connection.c (soup_connection_disconnect): When
disconnecting the socket, disconnect from its signals first to
prevent bad reentrancy.

* libsoup/soup-error.h: Kill off SOUP_ERROR_CANT_AUTHENTICATE and
SOUP_ERROR_CANT_AUTHENTICATE_PROXY, since they don't really say
anything that SOUP_ERROR_UNATHORIZED and
SOUP_ERROR_PROXY_UNAUTHORIZED don't say. (And now, all of the
"transport" errors actually are transport-related.)

* tests/auth-test.c (main): s/CANT_AUTHENTICATE/UNAUTHORIZED/

* tests/simple-proxy.c: Complicate this a bunch. In particular,
use SOUP_MESSAGE_OVERWRITE_CHUNKS and the GOT_CHUNK signal, and
pass the data back to the client in chunked format.

21 years agoNew header with typedefs, to avoid #include loops among other headers.
Dan Winship [Wed, 27 Aug 2003 13:13:30 +0000 (13:13 +0000)]
New header with typedefs, to avoid #include loops among other headers.

* libsoup/soup-types.h: New header with typedefs, to avoid
#include loops among other headers.

* libsoup/Makefile.am (libsoupinclude_HEADERS): add it

* libsoup/*.[ch], tests/*.c: Update for soup-types.h

21 years agoHigher-than-soup-message-io-level functions to do client-side IO. (Code
Dan Winship [Tue, 26 Aug 2003 20:09:59 +0000 (20:09 +0000)]
Higher-than-soup-message-io-level functions to do client-side IO. (Code

* libsoup/soup-message-client-io.c (soup_message_write_request,
soup_message_read_response): Higher-than-soup-message-io-level
functions to do client-side IO. (Code that used to be in
soup-queue.c)
(get_request_header_cb): Fix a bug in the generation of the Host:
header; need to include the port number if it's not the default.

* libsoup/soup-message-io.c (soup_message_write,
soup_message_write_simple): Take separate user_datas for the get_*
callbacks and the done callbacks.

* libsoup/soup-queue.c: Update to use soup_message_write_request
and soup_message_read_response.

* libsoup/soup-connection.c (soup_connection_new): Change the
prototype to take a SoupUri and a callback.

* libsoup/soup-context.c (try_create_connection,
soup_context_connect_cb): Update for soup_connection_new change.

* libsoup/soup-server.c (read_done_cb, issue_bad_request): Update
for soup_message_write changes

* libsoup/soup-uri.c (soup_uri_uses_default_port): new utility
function

21 years agoDefine SoupMessage signal stuff (READ_HEADERS, READ_CHUNK, READ_BODY,
Dan Winship [Tue, 26 Aug 2003 15:34:16 +0000 (15:34 +0000)]
Define SoupMessage signal stuff (READ_HEADERS, READ_CHUNK, READ_BODY,

* libsoup/soup-message-private.h: Define SoupMessage signal stuff
(READ_HEADERS, READ_CHUNK, READ_BODY, READ_ERROR, WROTE_HEADERS,
WROTE_CHUNK, WROTE_BODY, WRITE_ERROR).

* libsoup/soup-message.c (class_init): set up signals
(requeue_read_finished): Update for changes.

* libsoup/soup-message-io.c (soup_message_read): Split out
parse_headers_cb from read_headers_cb. Also add a SoupDataBuffer *
arg to say where to store the message body. Set up
read_headers_cb, read_chunk_cb, read_body_cb, and error_cb as
signal handlers.
(do_read): Call r->parse_headers_cb, then emit READ_HEADERS
(read_body_chunk): emit READ_CHUNK.
(issue_final_callback): Set r->body. emit READ_BODY.
(failed_read): emit READ_ERROR.
(soup_message_read_set_callbacks): Disconnect old signal handlers,
connect new ones.
(soup_message_read_cancel): Disconnect signal handlers.
(soup_message_write, soup_message_write_simple): Set up
wrote_body_cb and error_cb as signal handlers.
(do_write): emit WROTE_HEADERS and WROTE_CHUNK, even though
nothing currently ever listens for them. emit WROTE_BODY when
done.
(failed_write): emit WRITE_ERROR

* libsoup/soup-queue.c (soup_queue_parse_headers_cb,
soup_queue_read_headers_cb): Split this into two unequal chunks.
(read_header_cb only runs the pre-body handlers).
(soup_queue_read_chunk_cb, soup_queue_read_done_cb): Update
prototypes.
(soup_queue_write_done_cb): Update call to soup_message_read

* libsoup/soup-server.c (parse_headers_cb): Renamed from
read_headers_cb
(read_done_cb): Update prototype
(start_request): Update soup_message_read call.

21 years agoAdd a "user_data" arg, pass it to the callbacks.
Dan Winship [Mon, 25 Aug 2003 17:59:33 +0000 (17:59 +0000)]
Add a "user_data" arg, pass it to the callbacks.

* libsoup/soup-message-io.c (soup_message_read,
soup_message_write, soup_message_write_simple): Add a "user_data"
arg, pass it to the callbacks.

* libsoup/soup-message.c (soup_message_requeue,
requeue_read_finished, requeue_read_error): Update for that

* libsoup/soup-queue.c: Likewise

* libsoup/soup-server.c: Likewise

21 years agofix a doc comment
Dan Winship [Mon, 25 Aug 2003 14:07:55 +0000 (14:07 +0000)]
fix a doc comment

21 years agoTake a uri string instead of a context. Also, swap the args (so the method
Dan Winship [Mon, 25 Aug 2003 14:06:02 +0000 (14:06 +0000)]
Take a uri string instead of a context. Also, swap the args (so the method

* libsoup/soup-message.c (soup_message_new): Take a uri string
instead of a context. Also, swap the args (so the method comes
before the URI, just like in the protocol).
(soup_message_new_from_uri): Like soup_messgae_new, but takes a
SoupUri instead of a string
(soup_message_set_request, soup_message_set_response): Replace
soup_message_new_full.
(cleanup_message): Was soup_message_cleanup, but is static now.
(queue_message): Do the pre-queuing message cleanup here instead
of in soup_queue_message.
(soup_message_queue): Set the callback and user_data, then call
queue_message.
(requeue_read_error, requeue_read_finished, soup_message_requeue):
Use queue_message
(soup_message_get_uri): Replaces soup_message_get_context.

* libsoup/soup-message.h (SoupMessage): Remove msg->context. (It's
part of SoupMessagePrivate now)

* libsoup/soup-context.c: #include soup-message-private
(soup_context_from_uri): constify the uri arg.

* libsoup/soup-queue.c: Various context/uri fixes
(proxy_https_connect): Use soup_message_new_from_uri.
(soup_queue_message): Drastically simplified since most of the
work is in soup-messsage.c:queue_message() now

* libsoup/soup-auth-digest.c (compute_response,
get_authorization): Use soup_message_get_uri.

* libsoup/soup-server-auth.c (parse_digest): Likewise

* libsoup/soup-server.c (call_handler): Likewise

* tests/simple-httpd.c (server_callback): Likewise.

* tests/simple-proxy.c (server_callback): Likewise

* tests/get.c (got_url): Likewise.
(get_url): Update soup_message_new usage.

* tests/auth-test.c: #include soup-message-private. Update for
context changes and soup_message_new change.

21 years agoNew file containing SoupMessagePrivate and some other
Dan Winship [Fri, 22 Aug 2003 18:49:02 +0000 (18:49 +0000)]
New file containing SoupMessagePrivate and some other

* libsoup/soup-message-private.h: New file containing
SoupMessagePrivate and some other soup-message-internal
types/functions. Also includes the new, expanded SoupMessageStatus
enum.

* libsoup/soup-message-io.c: Replaces what used to be in
soup-transfer, but now all the interfaces take SoupMessages
instead of SoupReader/SoupWriter and deal with maintaining
msg->priv->{read,write}_state themselves. Fixes up all the
refcounting madness.

* libsoup/soup-message-handlers.c: Move the handler code here,
mostly unchanged. (But rename SoupHandlerType to SoupHandlerPhase
to make the distinction from SoupHandlerKind clearer.)

* libsoup/soup-message.c: Update for soup-message-io and new
SoupMessageStatus values. Remove handler code.
(soup_message_cleanup): Remove the hack to try to preserve the
connection if the message gets cleaned up before it finishes
reading. soup_message_requeue handles this in the requeuing case,
and there's no especially compelling reason to bother doing it in
any other case. (And the soup-message-io api doesn't support
having a read operation that's not connected to any message.)

* libsoup/soup-private.h: remove SoupMessagePrivate

* libsoup/soup-queue.c: Update for soup-message-io and new
SoupMessageStatus values.

* libsoup/soup-server-message.c: Likewise

* libsoup/soup-server.c: Likewise

* libsoup/soup-transfer.c: Gone (yay)

* libsoup/Makefile.am (libsoup_2_2_la_SOURCES): update

21 years agobelated fix to make this compile again
Dan Winship [Fri, 22 Aug 2003 16:36:47 +0000 (16:36 +0000)]
belated fix to make this compile again

21 years agoMake this a GObject. (Note that since SoupMessage was not refcounted
Dan Winship [Wed, 20 Aug 2003 17:49:59 +0000 (17:49 +0000)]
Make this a GObject. (Note that since SoupMessage was not refcounted

* libsoup/soup-message.c: Make this a GObject. (Note that since
SoupMessage was not refcounted before, it's not really refcounted
now either. TBF)
(soup_message_free): Gone, replaced by g_object_unref
(soup_message_copy, soup_message_foreach_remove_header): Remove
these, since neither was currently functional.
(soup_message_is_keepalive): New utility function to look at
HTTP version and request/response headers to decide if a message
indicates the connection should be kept alive.
(soup_message_set_connection, soup_message_get_connection): New
(soup_message_get_socket): New

* libsoup/soup-server-message.c: Make this a subclass of
SoupMessage.
(soup_server_message_new): Now takes a SoupServer and SoupSocket
(soup_server_message_get_server): New
(soup_server_message_set_encoding,
soup_server_message_get_encoding): Get/set whether the message
should be sent with content-length or chunked encoding
(soup_server_message_is_started, soup_server_message_is_finished):
Private member accessors.
(soup_server_message_add_chunk): Renamed from add_data
(soup_server_message_get_chunk): Pops a chunk from the list.
(soup_server_message_get_source): Gone

* libsoup/soup-server.c: Update for SoupServerMessage changes.
(error_cb, write_done_cb): All the cleanup stuff that used to be
here happens automatically by unreffing the message now.
(get_response_header): Remove some erroneous leftover CGI stuff
(issue_bad_request): add "Connection: close" to the response.
(read_headers_cb): clean this up a bit. Reject HTTP/1.1 messages
with no Host header as per RFC 2616.

* libsoup/soup-connection.c (soup_connection_start_ssl): Gone
(soup_connection_set_in_use): Let the caller set the connection to
"not in use" even after the socket has been disconnected.

* libsoup/soup-context.c: Use soup_message_get_connection

* libsoup/soup-headers.c (soup_headers_parse_request): Remove the
check on request length, since it was rejecting
"GET / HTTP/1.0\r\n\r\n", which is a valid complete request.

* libsoup/soup-queue.c: Use soup_message_get_connection and
soup_message_get_socket.
(soup_queue_read_done_cb): Use soup_message_is_keepalive
(proxy_https_connect_cb): Use soup_socket_start_ssl rather than
soup_connection_start_ssl

* libsoup/soup-socket.c (finalize): disconnect the GIOChannel
handlers if the socket hasn't been disconnected yet.

* libsoup/soup-transfer.c (soup_reader_read_body_chunk,
reader_read): Fix these so that reader_read will exit properly if
the read is cancelled.

* tests/auth-test.c (main): s/soup_message_free/g_object_unref/

* tests/simple-httpd.c (server_callback): set the message to
content-length encoding.
* tests/simple-proxy.c (server_callback): Likewise

21 years agoNew API for doing socket IO. Works both synchronously and asynchronously,
Dan Winship [Tue, 19 Aug 2003 19:04:09 +0000 (19:04 +0000)]
New API for doing socket IO. Works both synchronously and asynchronously,

* libsoup/soup-socket.c (soup_socket_read,
soup_socket_read_until, soup_socket_write): New API for doing
socket IO. Works both synchronously and asynchronously, and
buffers data to prevent the "100 Continue" problem.
(soup_socket_set_flag): Replaces formerly-private
soup_set_sockopts. (primarily to let the caller turn off
SOUP_SOCKET_FLAG_NONBLOCKING).

* libsoup/soup-transfer.c (soup_transfer_read,
soup_transfer_write, soup_transfer_write_simple): Take a
SoupSocket instead of a GIOChannel. Use the new socket IO api.
Changed the prototypes of some of the callbacks to be less
hackish.

* libsoup/soup-connection.c (soup_connection_get_socket): Replaces
soup_connection_get_iochannel.

* libsoup/soup-message.c: Fix up for soup-transfer changes

* libsoup/soup-queue.c: Likewise

* libsoup/soup-server.c: Likewise

* tests/revserver.c: A slightly more complicated replacement for
timeserver. (Does both reads and writes)

21 years agoRemove this. RC doesn't let you configure it, and no one has complained,
Dan Winship [Tue, 19 Aug 2003 17:35:57 +0000 (17:35 +0000)]
Remove this. RC doesn't let you configure it, and no one has complained,

* libsoup/soup-socks.[ch]: Remove this. RC doesn't let you
configure it, and no one has complained, and it looks like the
SOCKS5 auth code doesn't actually work anyway...

* libsoup/soup-queue.c (proxy_connect): Remove SOCKS code.

* libsoup/soup-uri.h: Remove SOUP_PROTOCOL_SOCKS4 and
SOUP_PROTOCOL_SOCKS5

* libsoup/soup-misc.c: Remove a references to SOCKS in a comment

* libsoup/Makefile.am (libsoup_2_2_la_SOURCES): remove
soup-socks.[ch]

21 years agoMake this a GObject. Remove SoupServerMessage code (to
Dan Winship [Tue, 19 Aug 2003 14:47:15 +0000 (14:47 +0000)]
Make this a GObject. Remove SoupServerMessage code (to

* libsoup/soup-server.c: Make this a GObject. Remove
SoupServerMessage code (to soup-server-message.c). Remove CGI
server code (for now?)
(soup_server_add_handler, soup_server_remove_handler): Rename
(from register/unregister) to make it clearer what they do.

* libsoup/soup-server-message.c: Moved out of soup-server.c

* libsoup/soup-private.h: Remove SoupServer def

* libsoup/Makefile.am (libsoupinclude_HEADERS,
libsoup_2_2_la_SOURCES): add soup-server-message.[ch]

* tests/simple-httpd.c:
* tests/simple-proxy.c: Update for SoupServer changes

21 years agoMake this more like a struct sockaddr again (like it used to be). In
Dan Winship [Mon, 18 Aug 2003 15:59:05 +0000 (15:59 +0000)]
Make this more like a struct sockaddr again (like it used to be). In

* libsoup/soup-address.c (SoupAddressPrivate): Make this more like
a struct sockaddr again (like it used to be). In particular, add
back the "port" field. Add a bunch of macros to try (and fail) to
simplify some of the code.
(soup_address_new): Now returns a SoupAddress directly rather than
a random handle, and the caller can just use g_object_unref to
cancel the lookup. Also, the callback now uses a
SoupKnownErrorCode rather than a special-purpose address-lookup
error code.
(soup_address_new_cancel): No longer needed.
(soup_address_new_sync): Removed
(soup_address_new_any): Replaces soup_address_ipv4_any and
soup_address_ipv6_any.
(soup_address_get_name, etc): Gone. Use soup_address_resolve()
now.
(soup_address_get_physical): Renamed from
soup_address_get_canonical_name.
(soup_address_get_sockaddr): Replaces soup_address_make_sockaddr()

* libsoup/soup-socket.c: Update for SoupAddress changes and make
similar changes here.
(soup_socket_new): Just creates a generic SoupSocket now.
(soup_socket_connect): Client setup
(soup_socket_listen): Server setup. Now also sets up an iochannel
listening for connects and emits a "new_connection" signal as they
come in.
(soup_socket_start_ssl): Turns on SSL.
(soup_socket_client_new, soup_socket_server_new): Utility
functions that wrap the above.
(soup_socket_new_cancel, soup_socket_new_sync): Gone
(soup_socket_server_accept, soup_socket_server_try_accept): No
longer needed.
(soup_socket_get_iochannel): No longer adds a ref when returning
the iochannel. Also, we set it to "close_on_unref" so that if a
caller adds a ref to it, the connection will actually remain open
even after the SoupSocket is destroyed.
(soup_socket_get_local_address, soup_socket_get_remote_address):
Let the caller get both of these.

* libsoup/soup-connection.c: Don't keep a private copy of the
socket's iochannel.
(soup_connection_new): Don't need to set socket options here.
SoupSocket does it.
(soup_connection_start_ssl): Just call soup_socket_start_ssl.
(soup_connection_get_iochannel): Just return the socket's
iochannel (and don't ref it)

* libsoup/soup-error.c: add SOUP_ERROR_CANT_RESOLVE and
SOUP_ERROR_CANT_RESOLVE_PROXY

* libsoup/soup-dns.c (soup_ntop): Make the address arg const.
Remove the "FIXME add a CANT_RESOLVE error" and return
SOUP_ERROR_CANT_RESOLVE instead.

* libsoup/soup-server.c: Update for socket/address changes. Don't
poke into SoupSocket's private fields.
(soup_server_run_async): Just connect to the socket's
"new_connection" signal.

* libsoup/soup-context.c (try_create_connection,
soup_context_connect_cb): Update for socket changes. Replace
SOUP_CONNECT_ERROR codes with plain SOUP_ERROR codes.

* libsoup/soup-misc.c (soup_signal_connect_once): Utility function
to connect to a signal handler and connect another function to
clean up the first signal handler after its first invocation.
(Lets us use signals to replace one-off callbacks.)

* libsoup/soup-private.h: Remove SoupSocketPrivate since it is
actually private now.
(struct _SoupServer): Remove accept_tag.

* libsoup/soup-queue.c (soup_queue_read_done_cb, start_request):
Don't unref the iochannel.
(soup_queue_connect_cb): Takes a SoupKnownErrorCode now.

* libsoup/soup-socks.c: Update for socket/address changes

* tests/simple-httpd.c (main):
s/SOUP_SERVER_ANY_PORT/SOUP_ADDRESS_ANY_PORT/
* tests/simple-proxy.c (main): Likewise

* tests/timeserver.c: Update for SoupSocket's "new_connection"
signal, and for SoupAddress changes.

21 years agoNew, split out from soup-context and made into a GObject.
Dan Winship [Thu, 14 Aug 2003 15:02:32 +0000 (15:02 +0000)]
New, split out from soup-context and made into a GObject.

* libsoup/soup-connection.c: New, split out from soup-context and
made into a GObject.
(soup_connection_disconnect): Disconnects the connection and emits
a signal. (Replaces the old "keep_alive" flag.)
(soup_connection_is_connected): Checks if the connection is still
connected
(connection_died): Just disconnect, rather than freeing the
connection. This way if anyone else is still referencing it they
won't end up with an invalid pointer.

* libsoup/soup-context.c: Make this a GObject, remove all the
SoupConnection code. Add an "ntlm_auths" field to SoupHost so that
SoupContext can keep track of connection auth stuff there without
SoupConnection needing to care. Various other updates.

* libsoup/soup-private.h: Remove SoupContext and SoupConnection
definitions.

* libsoup/*.c, tests/get.c: Update for context/connection changes

* libsoup/soup-socks.c (soup_connect_socks_proxy): Change the
definition to deal with the fact that there's no
soup_connection_get_context any more.

* libsoup/soup-queue.c (soup_queue_read_headers_cb): Don't deal
with connection persistence here.
(soup_queue_read_done_cb): Do it here instead. Disconnect the
connection when appropriate.
(proxy_connect, proxy_https_connect, proxy_https_connect_cb):
Reference-count the connection properly. (I think.)

* libsoup/soup-marshal.list: New, for SoupConnection's
"disconnected" signal.

* libsoup/Makefile.am: add rules to build soup-marshal.[ch]

* configure.in: Use AM_PATH_GLIB_2 rather than pkg-config, so that
GLIB_GENMARSHAL gets set too.

21 years agoAdd signal.h to solve the problem of building on Solaris 8
Antonio Xu [Thu, 14 Aug 2003 14:24:27 +0000 (14:24 +0000)]
Add signal.h to solve the problem of building on Solaris 8

2003-08-14  Antonio Xu <antonio.xu@sun.com>

Add signal.h to solve the problem of building on Solaris 8

21 years agoFix a spelling mistake.
Dan Winship [Thu, 14 Aug 2003 14:01:35 +0000 (14:01 +0000)]
Fix a spelling mistake.

* libsoup/soup-error.c: Fix a spelling mistake.

* libsoup/*.c: Fix use of @/%/#/() in gtk-doc comments

21 years agoMake this an abstract GObject. Tweak some of the interfaces around a
Dan Winship [Tue, 12 Aug 2003 18:00:14 +0000 (18:00 +0000)]
Make this an abstract GObject. Tweak some of the interfaces around a

* libsoup/soup-auth.c: Make this an abstract GObject. Tweak some
of the interfaces around a little bit.

* libsoup/soup-auth-basic.c: subclass for Basic auth

* libsoup/soup-auth-digest.c: subclass for Digest auth

* libsoup/soup-auth-ntlm.c: subclass for NTLM auth. Move all of
the code from soup-ntlm.c here, and make it private.

* libsoup/soup-ntlm.c: gone

* libsoup/soup-misc.h: Remove the definition of SoupAuthType from
here, and change the signature of SoupAuthorizeFn.

* libsoup/soup-context.c: Use g_object_unref to free auths, use
methods instead of directly access private fields.

* libsoup/soup-queue.c: Likewise

* libsoup/soup-server-auth.c (soup_server_auth_free): Remove all
NTLM references. We have no plans to implement server-side NTLM
auth.

* tests/auth-test.c (identify_auth): Update for auth api changes

21 years agoadd gobject-2.0 to the PKG_CHECK_MODULES call
Dan Winship [Tue, 12 Aug 2003 17:13:53 +0000 (17:13 +0000)]
add gobject-2.0 to the PKG_CHECK_MODULES call

* configure.in (GLIB): add gobject-2.0 to the PKG_CHECK_MODULES
call

* libsoup/soup-address.c: Make this a GObject.
(soup_address_ref, soup_address_unref): Gone.
(soup_address_copy): Gone. Wasn't being used anyway.

* libsoup/soup-dns.c: Move all of the DNS code and caching stuff
here from soup-address.c, so that soup-address doesn't need to
worry about trying to cache zero-ref addresses.

* libsoup/soup-socket.c: Make this a GObject. Use "guint"
consistently for port numbers.
(soup_socket_ref, soup_socket_unref): Gone.

* libsoup/soup-private.h: Change the SoupSocket definition to be
SoupSocketPrivate. (Still need to keep this here since soup-server
pokes around in its internals.)
(SOUP_MAKE_TYPE): Copied from gal's E_MAKE_TYPE.

* libsoup/soup-server.c (read_done_cb, write_done_cb): Unref the
reader/writer rather than leaking them.

* libsoup/*: Use GObject methods for socket/address refcounting

* tests/auth-test.c (main)
* tests/timeserver.c (main): Call g_type_init.

* tests/get.c (main): Call g_type_init.
(get_url, got_url): Fix some bugs that could make -r mode get into
infinite loops downloading the same files over and over. Plug some
memory leaks to make this more useful for valgrinding libsoup.

* tests/simple-httpd.c (main): Call g_type_init. Set up a signal
handler for SIGINT so we can exit cleanly, since valgrind won't
give a leak report if you don't. Plug a few memory leaks.

* tests/simple-proxy.c (main): Likewise

21 years ago Pull over some new test programs from the soup-refactoring branch,
Dan Winship [Tue, 12 Aug 2003 16:00:31 +0000 (16:00 +0000)]
Pull over some new test programs from the soup-refactoring branch,
along with the SoupUri changes they depend on.

* tests/simple-httpd.c: A really simple HTTP server, to test the
server code.

* tests/simple-proxy.c: An even simpler HTTP proxy

* tests/get.c: Add "-r" flag to recursively get files (thereby
testing multiple-connections-at-once code). Also good for setting
up a tree to use with simple-httpd.

* tests/timeserver.c (main): Fix a bug. (s/ipv6/ipv4/ in the
normal case)

* tests/uri-parsing.c: Regression test for the new soup-uri.c

* libsoup/soup-uri.c: Rewrite/update to conform to RFC 2396, and
pull in some optimizations from camel-url. Also, make SoupProtocol
a GQuark so we can still compare them with ==, but we can also
recognize any protocol.
(soup_uri_new_with_base): New, to merge base and relative URIs
(soup_uri_to_string): Update this. Change the "show_password" flag
(which we always passed FALSE for) to "just_path", for places that
want the path+query without the protocol, host, etc.

* libsoup/soup-queue.c (soup_get_request_header): Just use
soup_uri_to_string to generate the request URI.

* libsoup/soup-auth.c (compute_response, digest_auth_func): Use
"soup_uri_to_path (uri, TRUE)" rather than trying to reassemble
the URI by hand badly.
* libsoup/soup-server-auth.c (parse_digest): Likewise

* libsoup/soup-socks.c (soup_connect_socks_proxy): Change a
switch() to an series of if()s since SOUP_PROTOCOL_* aren't
constants any more.

* libsoup/soup-context.c (soup_context_uri_hash,
soup_context_uri_equal): s/querystring/query/

21 years agoUpdate for pc file rename
Dan Winship [Tue, 12 Aug 2003 14:12:25 +0000 (14:12 +0000)]
Update for pc file rename

* Makefile.am: Update for pc file rename

21 years agoBump API version to 2.2 and package version to 2.1.0. Remove NSS and
Dan Winship [Tue, 12 Aug 2003 14:08:26 +0000 (14:08 +0000)]
Bump API version to 2.2 and package version to 2.1.0. Remove NSS and

* configure.in: Bump API version to 2.2 and package version to
2.1.0. Remove NSS and OpenSSL checks and proxy-related config. Use
libgnutls-config to find GNUTLS.

* libsoup-2.2.pc.in: Update, and rename from soup-2.0.pc

* libsoup/Makefile.am: s/2.0/2.2/ everywhere. Remove NSS, OpenSSL,
and libsoup-ssl-proxy stuff.

* libsoup/soup-ssl-proxy.c
* libsoup/soup-nss.[ch]
* libsoup/soup-openssl.[ch]: gone

* libsoup/soup-ssl.c: remove NSS and OpenSSL bits

* tests/Makefile.am (get_LDADD, timeserver_LDADD,
auth_test_LDADD): Update libsoup version

21 years agoThese are all really SoupContext functions, so move them to soup-context.c libsoup-2-0-branch-base
Dan Winship [Mon, 11 Aug 2003 13:50:51 +0000 (13:50 +0000)]
These are all really SoupContext functions, so move them to soup-context.c

* libsoup/soup-auth.c (soup_auth_lookup, soup_auth_set_context,
soup_auth_invalidate): These are all really SoupContext functions,
so move them to soup-context.c (and rename them appropriately).
(soup_auth_get_protection_space): New method to get the
"protection space" of an auth (paths where it is valid).
(soup_auth_invalidate): New method to try to un-authenticate an
auth (so we can keep the domain info cached even if the auth info
is wrong).
(basic_pspace_func): Basic protection space is all directories
below the current one.
(basic_invalidate_func): Clear the encoded username/password
(digest_pspace_func): Digest protection space is either the whole
server, or "what the domain parameter says" (though we don't deal
with cross-host domains).
(digest_invalidate_func): Return FALSE; bad digest auth info isn't
cacheable.
(digest_parse_func, digest_free): Set/free domain parameter
(ntlm_pspace): NTLM protection space is always the whole server.
(ntlm_invalidate): Clear the auth state.
(soup_auth_new_ntlm): Make this non-static
(SoupAuth): Replace the quad-state "status" field with an
"authenticated" boolean.

* libsoup/soup-private.h (SoupHost): Replace the "valid_auths"
hash with separate "auth_realms" (path->realm) and "auths"
(realm->auth) hashes. Also add a "use_ntlm" flag.

* libsoup/soup-context.c (soup_context_unref): Update SoupHost
freeing code.
(connection_free): Don't the connection's auth, just free it.
(soup_context_lookup_auth): Formerly soup_auth_lookup, but now
does two-stage lookup (path->realm then realm->auth) and also
deals with NTLM hacks.
(soup_context_update_auth): Mostly formerly soup_auth_set_context,
but also large parts of authorize_handler. Updates the auth hashes
based on information from a 401 or 407 response. Does a better job
than authorize_handler did of not throwing away good information.
(soup_context_preauthenticate): New; fakes up auth info so that
requests will end up using authentication without the server
needing to return an error first.
(soup_context_authenticate_auth): Moved out of authorize_handler
so it can be used at request-sending time too, if we know that we
need it. (That way we can avoid requeuing the request if it isn't
going to be able to be authenticated.)
(soup_context_invalidate_auth): Sort of like the old
soup_auth_invalidate, but only destroys the auth data, while still
remembering the path->realm mapping.

* libsoup/soup-message.c (authorize_handler): Mostly moved into
soup_context_update_auth.
(maybe_validate_auth): Remove this; it was only useful because of
bugs elsewhere in the auth handling.

* libsoup/soup-queue.c (soup_encode_http_auth): Update for
soup_context_lookup_auth. If the returned auth isn't
authenticated, call soup_context_authenticate_auth() on it.

* tests/auth-test.c: New (from soup-refactoring branch). Tests
that the Basic/Digest auth code does the right thing. (TODO: find
a good way to add NTLM tests too.)

* tests/Makefile.am (check_PROGRAMS): add auth-test

21 years ago1.99.25 ("Potato and Leek Soup") LIBSOUP_1_99_25
Dan Winship [Tue, 29 Jul 2003 15:04:01 +0000 (15:04 +0000)]
1.99.25 ("Potato and Leek Soup")

* configure.in: 1.99.25 ("Potato and Leek Soup")

* libsoup/soup-message.c (requeue_read_finished,
release_connection): Free the passed-in body data. Otherwise the
response body ends up getting leaked on most 3xx and 4xx
responses.
(soup_message_cleanup): Remove a piece of code that didn't
actually do anything and its associated confused comment.

* libsoup/soup-auth.c (ntlm_free): plug an occasional NTLM auth leak

* libsoup/soup-context.c (connection_free): plug a non-occasional
NTLM auth leak.

21 years agoVersion 1.99.24 LIBSOUP_1_99_24
Joe Shaw [Thu, 26 Jun 2003 16:26:42 +0000 (16:26 +0000)]
Version 1.99.24

2003-06-26  Joe Shaw  <joe@ximian.com>

* configure.in: Version 1.99.24

21 years agoCheck pkgconfig for openssl, since 0.9.7 (a) uses it, and (b) depends on
Dan Winship [Tue, 24 Jun 2003 16:02:41 +0000 (16:02 +0000)]
Check pkgconfig for openssl, since 0.9.7 (a) uses it, and (b) depends on

* configure.in: Check pkgconfig for openssl, since 0.9.7 (a) uses
it, and (b) depends on lots of new things sometimes (like on RH9).

* libsoup/soup-openssl.c:
* libsoup/soup-ssl-proxy.c: Change #ifdef HAVE_OPENSSL_SSL_H to
just #ifdef HAVE_OPENSSL since the header check doesn't get run in
the pkgconfig case

21 years agounref the old read_tag before changing/clearing it.
Dan Winship [Mon, 23 Jun 2003 15:52:34 +0000 (15:52 +0000)]
unref the old read_tag before changing/clearing it.

        * libsoup/soup-queue.c (soup_queue_read_done_cb): unref the
        old read_tag before changing/clearing it.
        (soup_queue_write_done_cb): Likewise with the write_tag.

        * libsoup/soup-transfer.c (issue_final_callback): ref the reader
        around the stop+callback.
        (soup_transfer_write_cb): Likewise.

21 years agoadd a ref_count field. (soup_transfer_read, create_writer): Set initial
Dan Winship [Tue, 17 Jun 2003 12:24:12 +0000 (12:24 +0000)]
add a ref_count field. (soup_transfer_read, create_writer): Set initial

        * libsoup/soup-transfer.c (SoupReader, SoupWriter): add a
        ref_count field.
        (soup_transfer_read, create_writer): Set initial ref_count to 2
        (one for soup-transfer, one for the caller).
        (soup_transfer_read_ref, soup_transfer_read_unref): ref/unref a
        reader
        (soup_transfer_read_stop): Clears the GIOChannel callbacks and
        drops soup-transfer's ref.
        (soup_transfer_read_cancel): Now just a stop+unref
        (soup_transfer_write_ref, soup_transfer_write_unref,
        soup_transfer_write_stop, soup_transfer_write_cancel): Similarly.

        * libsoup/soup-message.c (soup_message_cleanup): when setting up
        the "finish reading" callbacks, unref the reader so it will be
        destroyed once it's done reading.
        (soup_message_requeue): Likewise.

        * libsoup/soup-queue.c (soup_queue_read_headers_cb): Update for
        prototype change (no longer returns a SoupTransferDone).
        (soup_queue_read_chunk_cb): Likewise.

        * libsoup/soup-server.c (read_headers_cb): Likewise

21 years agoChange all functions to take a SoupReader * or SoupWriter * instead of a
Dan Winship [Wed, 11 Jun 2003 18:11:31 +0000 (18:11 +0000)]
Change all functions to take a SoupReader * or SoupWriter * instead of a

        * libsoup/soup-transfer.c: Change all functions to take a
        SoupReader * or SoupWriter * instead of a guint.

        * libsoup/soup-private.h (SoupMessagePrivate): make read_tag and
        write_tag pointers instead of guints.

21 years agoremove #include for soup-nss.h LIBSOUP_1_99_23
Chris Toshok [Mon, 2 Jun 2003 20:47:19 +0000 (20:47 +0000)]
remove #include for soup-nss.h

2003-06-02  Chris Toshok  <toshok@ximian.com>

* libsoup/soup-ssl.c: remove #include for soup-nss.h

21 years agoremove NSS_CFLAGS. (libsoup_2_0_la_LIBADD): remove NSS_LIBS.
Chris Toshok [Mon, 2 Jun 2003 20:42:59 +0000 (20:42 +0000)]
remove NSS_CFLAGS. (libsoup_2_0_la_LIBADD): remove NSS_LIBS.

2003-06-02  Chris Toshok  <toshok@ximian.com>

* libsoup/Makefile.am (INCLUDES): remove NSS_CFLAGS.
(libsoup_2_0_la_LIBADD): remove NSS_LIBS.
(libsoup_2_0_la_SOURCES): remove soup-nss.[ch]

21 years agoBump version to 1.99.23.
Chris Toshok [Mon, 2 Jun 2003 20:18:55 +0000 (20:18 +0000)]
Bump version to 1.99.23.

2003-06-02  Chris Toshok  <toshok@ximian.com>

* configure.in: Bump version to 1.99.23.

21 years agoalways force a reconnect when there's an error with ssl connection. This
Chris Toshok [Mon, 2 Jun 2003 20:17:29 +0000 (20:17 +0000)]
always force a reconnect when there's an error with ssl connection. This

2003-05-30  Chris Toshok  <toshok@ximian.com>

* libsoup/soup-queue.c (soup_queue_error_cb): always force a
reconnect when there's an error with ssl connection.  This fixes
#43387, but it runs the risk of sending requests multiple times to
the exchange server, and it results in lots of shorter lived
connections and more forking (in the ssl proxy case), depending on
the length of the operation.

21 years ago1.99.22 (codename: French Onion Soup) LIBSOUP_1_99_22
Dan Winship [Wed, 21 May 2003 12:23:11 +0000 (12:23 +0000)]
1.99.22 (codename: French Onion Soup)

* configure.in: 1.99.22 (codename: French Onion Soup)

21 years agoClear the write_tag as well so we don't double-cancel it. #43395.
Dan Winship [Wed, 21 May 2003 05:01:51 +0000 (05:01 +0000)]
Clear the write_tag as well so we don't double-cancel it. #43395.

        * libsoup/soup-message.c (soup_message_requeue): Clear the
        write_tag as well so we don't double-cancel it. #43395.

        * libsoup/soup-queue.c (soup_queue_error_cb): The connection might
        be destroyed by the end of the func, so we have to call
        soup_connection_set_used at the beginning.

        * libsoup/soup-openssl.c (soup_openssl_read, soup_openssl_write):
        Call g_set_error() so that we don't SEGV immediately after
        returning G_IO_STATUS_ERROR.

21 years agofile soup-proxy-connection.c was initially added on branch soup-refactoring.
Dan Winship [Thu, 15 May 2003 13:27:07 +0000 (13:27 +0000)]
file soup-proxy-connection.c was initially added on branch soup-refactoring.

21 years agofile soup-proxy-connection.h was initially added on branch soup-refactoring.
Dan Winship [Thu, 15 May 2003 13:27:07 +0000 (13:27 +0000)]
file soup-proxy-connection.h was initially added on branch soup-refactoring.

21 years agoBump version to 1.99.21
Joe Shaw [Fri, 9 May 2003 16:34:44 +0000 (16:34 +0000)]
Bump version to 1.99.21

2003-05-08  Joe Shaw  <joe@ximian.com>

* configure.in: Bump version to 1.99.21

* libsoup/soup-queue.c (proxy_connect): If the proxy HTTPS
tunnelling fails, the other message which shares our same
connection will free it first, so set ours to NULL.

21 years agoIf the auth status is PENDING, return an NTLM request string. Otherwise
Dan Winship [Fri, 9 May 2003 15:25:33 +0000 (15:25 +0000)]
If the auth status is PENDING, return an NTLM request string. Otherwise

* libsoup/soup-auth.c (ntlm_auth): If the auth status is PENDING,
return an NTLM request string. Otherwise return the "response"
field (which should include the NTLM authenticate message)
(ntlm_init): Don't bother setting "response" to the NTLM request
string. Just leave it NULL in that case.

* libsoup/soup-message.c (authorize_handler): Never try to reuse
an NTLM auth returned from soup_auth_lookup. Only set the auth on
the connection when it's SOUP_AUTH_STATUS_SUCCESSFUL. Otherwise,
call soup_auth_set_context() on it just like for non-NTLM auth.
The net effect of all of this is that now we record when a context
needs NTLM auth just like with non-NTLM auth, so that that info
gets preserved across connections.
(soup_message_requeue): No longer need the hackery here to
preserve the connection auth state.

* libsoup/soup-context.c (soup_connection_set_in_use): New, to
toggle the connection's in_use flag, and set up the death watch
when it's not in use.
(connection_death): This is only hooked up when the connection is
not in use now, so don't need to check that. Should fix the
infinite connection_death loop.
(soup_connection_is_new): Keep a distinct "new" flag rather than
defining "new" as "has been released at least once".
(soup_connection_set_used): Mark a connection no-longer new.
(soup_context_connect_cb): Mark the connection as new. Don't set
up the death watch since it's in_use.
(try_existing_connections): Use soup_connection_set_in_use.
(soup_connection_release): Likewise

* libsoup/soup-message.c (requeue_read_finished): Call
soup_connection_set_used so that the connection isn't still
considered new when we send the message the second time.

* libsoup/soup-queue.c (soup_queue_error_cb): Call
soup_connection_set_used (assuming we don't close the connection)
(soup_queue_read_done_cb): Likewise.

* libsoup/soup-transfer.c (soup_transfer_read_cb): If we read
nothing, call soup_transfer_read_error_cb rather than just
cancelling, or else it will get cancelled again later.

21 years agoDon't put @OPENSSL_LIBS@ here; the library doesn't depend on them, only
Dan Winship [Wed, 7 May 2003 17:49:33 +0000 (17:49 +0000)]
Don't put @OPENSSL_LIBS@ here; the library doesn't depend on them, only

* soup-2.0.pc.in (Libs): Don't put @OPENSSL_LIBS@ here; the
library doesn't depend on them, only the proxy does. #42473

21 years agoChange the redirect handler to be a RESPONSE_ERROR_CLASS_HANDLER for
Dan Winship [Tue, 6 May 2003 13:00:52 +0000 (13:00 +0000)]
Change the redirect handler to be a RESPONSE_ERROR_CLASS_HANDLER for

* src/libsoup/soup-message.c (global_handlers): Change the
redirect handler to be a RESPONSE_ERROR_CLASS_HANDLER for
SOUP_ERROR_CLASS_REDIRECT rather than a RESPONSE_HEADER_HANDLER
for "Location" to get around the non-64-bit-clean union
initialization pointed out by Jeremy Katz <katzj@redhat.com>.
(redirect_handler): Update for that.

21 years ago1.99.20 LIBSOUP_1_99_20
Dan Winship [Tue, 29 Apr 2003 16:02:24 +0000 (16:02 +0000)]
1.99.20

        * configure.in: 1.99.20

        * libsoup/soup-transfer.c (soup_transfer_read_error_cb): Make sure
        we always call UNIGNORE_CANCEL. Might fix #41971

21 years ago1.99.19 (the all 1s and 9s release) LIBSOUP_1_99_19
Dan Winship [Mon, 28 Apr 2003 18:50:29 +0000 (18:50 +0000)]
1.99.19 (the all 1s and 9s release)

* configure.in: 1.99.19 (the all 1s and 9s release)

21 years agoif an old connection suddenly gets an io error while reading or writing,
Dan Winship [Fri, 25 Apr 2003 17:34:08 +0000 (17:34 +0000)]
if an old connection suddenly gets an io error while reading or writing,

        * libsoup/soup-queue.c (soup_queue_error_cb): if an old connection
        suddenly gets an io error while reading or writing, assume it's a
        timeout or something, close the connection, and requeue the
        message.

21 years agoDon't set up the soup-transfer callbacks to keep reading off the
Dan Winship [Thu, 24 Apr 2003 17:59:02 +0000 (17:59 +0000)]
Don't set up the soup-transfer callbacks to keep reading off the

        * libsoup/soup-message.c (soup_message_cleanup): Don't set up the
        soup-transfer callbacks to keep reading off the connection unless
        we're actually going to keep the connection around afterward.
        Otherwise we can just close it.

        * libsoup/soup-transfer.c: Re-kludge the awful IGNORE_CANCEL
        thingy so that it's possible to cancel a read from inside a
        callback so that the above change actually works instead of just
        crashing.

21 years agoUp version to 1.99.18 Line separator after GNUTLS_CFLAGS
Rodney Dawes [Mon, 21 Apr 2003 16:06:29 +0000 (16:06 +0000)]
Up version to 1.99.18 Line separator after GNUTLS_CFLAGS

2003-04-20  Rodney Dawes  <dobey@ximian.com>

* configure.in: Up version to 1.99.18
* libsoup/Makefile.am: Line separator after GNUTLS_CFLAGS

21 years agofile soup-proxy-auth-context.c was initially added on branch soup-refactoring.
Dan Winship [Mon, 21 Apr 2003 13:42:31 +0000 (13:42 +0000)]
file soup-proxy-auth-context.c was initially added on branch soup-refactoring.

21 years agofile soup-proxy-auth-context.h was initially added on branch soup-refactoring.
Dan Winship [Mon, 21 Apr 2003 13:42:31 +0000 (13:42 +0000)]
file soup-proxy-auth-context.h was initially added on branch soup-refactoring.

21 years agofile soup-www-auth-context.c was initially added on branch soup-refactoring.
Dan Winship [Mon, 21 Apr 2003 13:42:31 +0000 (13:42 +0000)]
file soup-www-auth-context.c was initially added on branch soup-refactoring.

21 years agofile soup-www-auth-context.h was initially added on branch soup-refactoring.
Dan Winship [Mon, 21 Apr 2003 13:42:31 +0000 (13:42 +0000)]
file soup-www-auth-context.h was initially added on branch soup-refactoring.

21 years agofile soup-auth-context.c was initially added on branch soup-refactoring.
Dan Winship [Mon, 21 Apr 2003 13:42:30 +0000 (13:42 +0000)]
file soup-auth-context.c was initially added on branch soup-refactoring.

21 years agofile soup-auth-context.h was initially added on branch soup-refactoring.
Dan Winship [Mon, 21 Apr 2003 13:42:30 +0000 (13:42 +0000)]
file soup-auth-context.h was initially added on branch soup-refactoring.

21 years agofile soup-server-cgi.c was initially added on branch soup-refactoring.
Dan Winship [Fri, 18 Apr 2003 20:39:10 +0000 (20:39 +0000)]
file soup-server-cgi.c was initially added on branch soup-refactoring.

21 years agofile soup-server-cgi.h was initially added on branch soup-refactoring.
Dan Winship [Fri, 18 Apr 2003 20:39:10 +0000 (20:39 +0000)]
file soup-server-cgi.h was initially added on branch soup-refactoring.

21 years agofile soup-server-tcp.c was initially added on branch soup-refactoring.
Dan Winship [Fri, 18 Apr 2003 20:39:10 +0000 (20:39 +0000)]
file soup-server-tcp.c was initially added on branch soup-refactoring.

21 years agofile soup-server-tcp.h was initially added on branch soup-refactoring.
Dan Winship [Fri, 18 Apr 2003 20:39:10 +0000 (20:39 +0000)]
file soup-server-tcp.h was initially added on branch soup-refactoring.

21 years agoNew function to close all idle connections. (Needed for #41117 or else
Dan Winship [Fri, 11 Apr 2003 17:02:29 +0000 (17:02 +0000)]
New function to close all idle connections. (Needed for #41117 or else

* libsoup/soup-context.c (soup_connection_purge_idle): New
function to close all idle connections. (Needed for #41117 or else
there's no way to force-discard NTLM authentication.)

* libsoup/soup-queue.c (soup_queue_shutdown): Use it

21 years agoproxy_https_connect_cb() might not get called if connecting to the proxy
Joe Shaw [Thu, 10 Apr 2003 21:48:37 +0000 (21:48 +0000)]
proxy_https_connect_cb() might not get called if connecting to the proxy

2003-04-10  Joe Shaw  <joe@ximian.com>

* libsoup/soup-queue.c (proxy_https_connect):
proxy_https_connect_cb() might not get called if connecting to the
proxy fails, and it causes us to double-free the connection.
Always set the message's connection to NULL before freeing it.

21 years ago*** empty log message ***
Joe Shaw [Thu, 10 Apr 2003 21:48:28 +0000 (21:48 +0000)]
*** empty log message ***

21 years ago1.99.17 LIBSOUP_1_99_17
Dan Winship [Wed, 9 Apr 2003 20:39:05 +0000 (20:39 +0000)]
1.99.17

* configure.in: 1.99.17

21 years agoRevert Joe's changes. We can't release the connection there because there
Dan Winship [Mon, 7 Apr 2003 20:55:31 +0000 (20:55 +0000)]
Revert Joe's changes. We can't release the connection there because there

        * libsoup/soup-context.c (connection_death): Revert Joe's changes.
        We can't release the connection there because there may be
        SoupMessages still pointing to it. (Needs to be revisited.)

21 years agoguard against EINTR error during waitpid
JP Rosevear [Thu, 3 Apr 2003 17:09:44 +0000 (17:09 +0000)]
guard against EINTR error during waitpid

2003-04-03  JP Rosevear  <jpr@ximian.com>

* libsoup/soup-ssl.c (soup_ssl_hup_waitpid): guard against
EINTR
error during waitpid

* libsoup/soup-address.c: ditto

21 years agoOnly drop the connection if we get an error condition on the channel.
Joe Shaw [Wed, 2 Apr 2003 22:41:23 +0000 (22:41 +0000)]
Only drop the connection if we get an error condition on the channel.

2003-04-02  Joe Shaw  <joe@ximian.com>

* libsoup/soup-context.c (connection_death): Only drop the
connection if we get an error condition on the channel.  Fixes a
double-free.

21 years agoJust call soup_connection_release() from here and return whether the
Joe Shaw [Wed, 2 Apr 2003 21:22:04 +0000 (21:22 +0000)]
Just call soup_connection_release() from here and return whether the

2003-04-02  Joe Shaw  <joe@ximian.com>

* libsoup/soup-context.c (connection_death): Just call
soup_connection_release() from here and return whether the
connection is in use.

21 years ago(soup_gnutls_close): loop on gnutls_bye in
Ian Peters [Mon, 31 Mar 2003 22:32:50 +0000 (22:32 +0000)]
(soup_gnutls_close): loop on gnutls_bye in
case of EAGAIN or EINTR, since shutting down an SSL connection
requires more than just closing a socket.

21 years agoIf the new context points to a different server from the old context, call
Dan Winship [Mon, 31 Mar 2003 15:32:39 +0000 (15:32 +0000)]
If the new context points to a different server from the old context, call

* libsoup/soup-message.c (soup_message_set_context): If the new
context points to a different server from the old context, call
soup_message_cleanup. Otherwise it tries to reuse the old
connection...

21 years agoBump up to 1.99.16 LIBSOUP_1_99_16
Joe Shaw [Tue, 25 Mar 2003 17:27:57 +0000 (17:27 +0000)]
Bump up to 1.99.16

2003-03-25  Joe Shaw  <joe@ximian.com>

* configure.in: Bump up to 1.99.16

21 years agoAdd SOUP_ERROR_SSL_FAILED which gives a slightly better error message on
Joe Shaw [Mon, 24 Mar 2003 15:39:02 +0000 (15:39 +0000)]
Add SOUP_ERROR_SSL_FAILED which gives a slightly better error message on

2003-03-24  Joe Shaw  <joe@ximian.com>

* soup-error.[ch]: Add SOUP_ERROR_SSL_FAILED which gives a
slightly better error message on various SSL failures than the
previous message.

* soup-queue.c (soup_queue_error_cb): Throw the
SOUP_ERROR_SSL_FAILED error when we fail an SSL handshake.

21 years agoUse non-deprecated g_main_loop_* calls throughout. (soup_server_unref):
Joe Shaw [Fri, 21 Mar 2003 22:18:09 +0000 (22:18 +0000)]
Use non-deprecated g_main_loop_* calls throughout. (soup_server_unref):

2003-03-21  Joe Shaw  <joe@ximian.com>

* soup-server.c: Use non-deprecated g_main_loop_* calls
throughout.
(soup_server_unref): Don't unref the main loop if it's NULL.
Fixes a glib warning.

21 years agocomment out NSS checks. The NSS code doesn't work and there are no current
Dan Winship [Tue, 18 Mar 2003 15:45:02 +0000 (15:45 +0000)]
comment out NSS checks. The NSS code doesn't work and there are no current

* configure.in: comment out NSS checks. The NSS code doesn't work
and there are no current plans to fix it.

* README (Features): Mention GnuTLS, remove NSS and the rest of
the "Planned Features" section.

* MAINTAINERS: remove Alex

21 years agoBump the timeout to 10 seconds (and get rid of the 3 tries) so we don't
Dan Winship [Tue, 18 Mar 2003 15:41:14 +0000 (15:41 +0000)]
Bump the timeout to 10 seconds (and get rid of the 3 tries) so we don't

* libsoup/soup-openssl.c (soup_openssl_get_iochannel): Bump the
timeout to 10 seconds (and get rid of the 3 tries) so we don't
fail to connect just because the server is slow/far away.

21 years agoBump up to 1.99.15. LIBSOUP_1_99_15
Joe Shaw [Mon, 17 Mar 2003 19:29:43 +0000 (19:29 +0000)]
Bump up to 1.99.15.

2003-03-17  Joe Shaw  <joe@ximian.com>

* configure.in: Bump up to 1.99.15.

21 years agobecause creating client credentials is
Ian Peters [Wed, 12 Mar 2003 16:03:16 +0000 (16:03 +0000)]
because creating client credentials is
expensive, keep the same one around as long as possible, only
recreating it if the ssl_ca_file changes.  Wrap
gnutls_certificate_credentials in a refcounted struct to avoid
freeing it while another established connection may potentially
need it (say, to rehandshake).

21 years agoadd ssl libs to defaults, since ssl doesn't use pkgconfig
Frank Belew (Myth) [Tue, 11 Mar 2003 20:40:49 +0000 (20:40 +0000)]
add ssl libs to defaults, since ssl doesn't use pkgconfig

* soup-2.0.pc.in: add ssl libs to defaults, since ssl doesn't
use pkgconfig

21 years agoBump up to 1.99.14.
Joe Shaw [Mon, 10 Mar 2003 23:40:37 +0000 (23:40 +0000)]
Bump up to 1.99.14.

2003-03-10  Joe Shaw  <joe@ximian.com>

* configure.in: Bump up to 1.99.14.

21 years agoAdd support for GnuTLS. Patch from Ian Peters.
Joe Shaw [Mon, 10 Mar 2003 22:44:02 +0000 (22:44 +0000)]
Add support for GnuTLS. Patch from Ian Peters.

2003-03-10  Joe Shaw  <joe@ximian.com>

* configure.in, libsoup/Makefile.am, libsoup/soup.gnutls.[ch],
libsoup/soup-ssl.c: Add support for GnuTLS.  Patch from Ian
Peters.

21 years agoBump up to 1.99.13.
Joe Shaw [Fri, 7 Mar 2003 23:02:26 +0000 (23:02 +0000)]
Bump up to 1.99.13.

2003-03-07  Joe Shaw  <joe@ximian.com>

* configure.in: Bump up to 1.99.13.

* libsoup/soup-context.c (soup_context_connect_cb): Add G_IO_IN to
the list of conditions to watch.  If the remote end hangs up the
connection, we'll get a successful read of 0 bytes, not a HUP.
The connection will have to be released by the point we check for
it in connection_death().

* libsoup/soup-queue.c (soup_queue_error_cb): Get rid of some
(apparently) errant resetting of the read and write tags.  I think
this might have been causing some reentrancy and crashes.

* libsoup/soup-socket.c (soup_socket_get_iochannel): Set the IO
channel to NULL encoding and not buffered.

* libsoup/soup-transfer.c (soup_transfer_read_cb): Remove some
incorrect comments.

21 years agoBump up to 1.99.12.
Joe Shaw [Fri, 28 Feb 2003 18:17:23 +0000 (18:17 +0000)]
Bump up to 1.99.12.

2003-02-28  Joe Shaw  <joe@ximian.com>

* configure.in: Bump up to 1.99.12.

* libsoup/soup-transfer.c (soup_transfer_read_cb): We can get a
header_len of 0 and a total_read of 0 in the case of a SIGPIPE; in
this case we probably don't want to call the error callback, we
just want to act like our transfer was cancelled.

21 years agoTry to apply some order to the iochannel refcounting...
Joe Shaw [Thu, 27 Feb 2003 22:12:46 +0000 (22:12 +0000)]
Try to apply some order to the iochannel refcounting...

2003-02-27  Joe Shaw  <joe@ximian.com>

Try to apply some order to the iochannel refcounting...

* configure.in: Bump up to 1.99.11.

* soup-context.c (soup_connection_get_iochannel): The connections
needs to own a reference to the iochannel!  If we're using HTTPS,
release the ref we get from soup_socket_get_iochannel and replace
it with the ref we get from soup_ssl_get_iochannel().  Then,
always ref the channel that we return (ugh, but that's the soup
way).
(connection_free): Release the connection's ref to the iochannel.

* soup-ssl.c (soup_ssl_get_iochannel_real): Ref the iochannel.
The reference we pass back will be owned by the connection.
(soup_ssl_hup_waitpid): Release our ref.

21 years agoBump up to 1.99.10.
Joe Shaw [Thu, 27 Feb 2003 18:53:25 +0000 (18:53 +0000)]
Bump up to 1.99.10.

2003-02-27  Joe Shaw  <joe@ximian.com>

* configure.in: Bump up to 1.99.10.

* soup-ssl.c (soup_ssl_get_iochannel_real): Ref the iochannel,
return to the status quo.  Sigh.

21 years agoBump up to 1.99.9.
Joe Shaw [Wed, 26 Feb 2003 21:03:30 +0000 (21:03 +0000)]
Bump up to 1.99.9.

2003-02-26  Joe Shaw  <joe@ximian.com>

* configure.in: Bump up to 1.99.9.

* soup-ssl.c (soup_ssl_hup_waitpid): Comment out the unref, it's
causing problems with HTTPS and proxies; the iochannel refcounting
is waaaaaay horked.

21 years agoadded workaround to link ssl-proxy statically
Frank Belew (Myth) [Wed, 26 Feb 2003 13:04:24 +0000 (13:04 +0000)]
added workaround to link ssl-proxy statically

* libsoup/Makefile.am: added workaround to link ssl-proxy statically

21 years agoBump up to 1.99.8 for snaps.
Joe Shaw [Tue, 11 Feb 2003 21:29:38 +0000 (21:29 +0000)]
Bump up to 1.99.8 for snaps.

2003-02-11  Joe Shaw  <joe@ximian.com>

* configure.in: Bump up to 1.99.8 for snaps.

* soup-address.c (soup_gethostbyname): Fix this for Solaris.  It
returns the address to the resulting hostent or NULL on failure,
unlike Linux which returns an error code.

21 years ago*** empty log message ***
Joe Shaw [Tue, 11 Feb 2003 21:29:31 +0000 (21:29 +0000)]
*** empty log message ***

21 years agoBump up to 1.99.7 for snaps.
Joe Shaw [Tue, 11 Feb 2003 16:59:39 +0000 (16:59 +0000)]
Bump up to 1.99.7 for snaps.

2003-02-11  Joe Shaw  <joe@ximian.com>

* configure.in: Bump up to 1.99.7 for snaps.

* libsoup/soup-openssl.c (soup_openssl_get_iochannel): Print out
the error string from OpenSSL if we can't establish a connection.

21 years agoBump up to 1.99.6 for snaps.
Joe Shaw [Tue, 4 Feb 2003 21:00:54 +0000 (21:00 +0000)]
Bump up to 1.99.6 for snaps.

2003-02-04  Joe Shaw  <joe@ximian.com>

* configure.in: Bump up to 1.99.6 for snaps.

* libsoup/soup-server.c (destroy_message): We already assigned
chan, so don't reassign it, and unref it in all cases.
(issue_bad_request): Always unref after a call to
soup_socket_get_iochannel(), because it refs it.
(conn_accept): Fix some funky GIOChannel reffing here.

* libsoup/soup-ssl.c (soup_ssl_get_iochannel_real): Don't call
g_io_channel_ref() on the socket.  This is the exact opposite of
what we want to do.  Create a temporary structure containing the
parent pid and the old socket and unref the socket when our
callback is called.  This should fix GIOChannels being leaked on
SSL connections.

* libsoup/soup-ssl-proxy.c: Always close the GIOChannels after the
main loop quits.

21 years agoBump up to 1.99.5 for the snaps.
Joe Shaw [Wed, 22 Jan 2003 20:05:56 +0000 (20:05 +0000)]
Bump up to 1.99.5 for the snaps.

2003-01-22  Joe Shaw  <joe@ximian.com>

* configure.in: Bump up to 1.99.5 for the snaps.

* libsoup/soup-address.c (soup_address_new): If we found the
address in our hash, we need to return NULL or else Soup will
think we're doing an async lookup and do some cancellation on
us.  Besides, we were returning the wrong type anyway and it
was crashing things.

21 years agoIt's not uncommon for us to get a G_IO_ERROR_AGAIN when trying to write
Joe Shaw [Fri, 17 Jan 2003 23:20:50 +0000 (23:20 +0000)]
It's not uncommon for us to get a G_IO_ERROR_AGAIN when trying to write

2003-01-17  Joe Shaw  <joe@ximian.com>

* libsoup/soup-ssl-proxy.c (soup_ssl_proxy_readwrite): It's not
uncommon for us to get a G_IO_ERROR_AGAIN when trying to write
out, so keep trying until we succeed.

21 years agobump up version for snaps
Joe Shaw [Fri, 10 Jan 2003 20:09:33 +0000 (20:09 +0000)]
bump up version for snaps

21 years agoLoad some X509 and SSL error strings and print out the error when the cert
Joe Shaw [Fri, 10 Jan 2003 20:03:25 +0000 (20:03 +0000)]
Load some X509 and SSL error strings and print out the error when the cert

2003-01-10  Joe Shaw  <joe@ximian.com>

* libsoup/soup-openssl.c (verify_cb): Load some X509 and SSL error
strings and print out the error when the cert can't verify.

21 years agoFix a memcpy overrun noticed by valgrind
Dan Winship [Thu, 9 Jan 2003 21:02:43 +0000 (21:02 +0000)]
Fix a memcpy overrun noticed by valgrind

* libsoup/soup-address.c (soup_gethostbyname): Fix a memcpy
overrun noticed by valgrind

21 years agoAdded. Starts a server only on the interface specified, instead of all
Joe Shaw [Fri, 20 Dec 2002 18:00:39 +0000 (18:00 +0000)]
Added. Starts a server only on the interface specified, instead of all

2002-12-20  Joe Shaw  <joe@ximian.com>

* libsoup/soup-server.c (soup_server_new_with_host): Added.
Starts a server only on the interface specified, instead of all
network interfaces.

21 years agouse $libdir instead of /usr/lib when looking for libraries
Jeremy Katz [Mon, 16 Dec 2002 16:34:17 +0000 (16:34 +0000)]
use $libdir instead of /usr/lib when looking for libraries

2002-12-16  Jeremy Katz  <katzj@redhat.com>
        * configure.in: use $libdir instead of /usr/lib when looking for
        libraries

21 years agoI am an idiot. Don't set a variable to NULL and then immediately try to
Joe Shaw [Wed, 11 Dec 2002 16:56:22 +0000 (16:56 +0000)]
I am an idiot. Don't set a variable to NULL and then immediately try to

2002-12-11  Joe Shaw  <joe@ximian.com>

* libsoup/soup-queue.c (proxy_https_connect_cb): I am an idiot.
Don't set a variable to NULL and then immediately try to
dereference it.

21 years agoPut a timeout on the select()s when we get SSL_ERROR_WANT_READ/WRITE so we
Joe Shaw [Mon, 9 Dec 2002 22:46:03 +0000 (22:46 +0000)]
Put a timeout on the select()s when we get SSL_ERROR_WANT_READ/WRITE so we

2002-12-09  Joe Shaw  <joe@ximian.com>

* libsoup/soup-openssl.c (soup_openssl_get_iochannel): Put a
timeout on the select()s when we get SSL_ERROR_WANT_READ/WRITE so
we don't hang forever if we don't get more data.

* libsoup/soup-ssl-proxy.c (main): Don't set our fds to blocking
or else we'll hang forever in SSL_connect() if the other side
hangs up.

21 years ago*** empty log message ***
Joe Shaw [Mon, 9 Dec 2002 22:45:51 +0000 (22:45 +0000)]
*** empty log message ***