Re: Obtaining the status of a request?

Lars Kellogg-Stedman wrote:
> 
> I'm still slowly working my way through the libwww documentation, and I've
> run into some more questions.
> 
> I want to retrieve the http status of a request outside of the termination
> handler.  HTRequest_error() looks like it will give me this information,
> but...what do I do with the HTList object returned by HTRequest_error()?
> 
> The HTError module provides functions for adding and deleting errors from
> an error stack, but doesn't appear to provide any accessor functions.  All
> I want is to do something like this:

The after handlers are actually a really good place to look at the
status code. If you really don't want to do that then you have to use
the error stack yourself described at

	http://www.w3.org/Library/User/Using/Error.html

For each of the error elements in the list, you can get the error index
number using the HTError_index() described in

	http://www.w3.org/Library/src/HTError.html#Codes

This index number can be used to map in to any table provided by the
application (which allows it to use different natural languages etc. The
reason why I can't use the HTTP status codes directly is that other
protocols (FTP, NNTP) often use the same numbers to mean different
things.

There is a default table defined in the HTDialog module

	http://www.w3.org/Library/src/HTDialog.html

And some functions that you can use to traverse the error stack are also
defined in this module. See for example the HTDialog_errorMessage
function defined in this module.

If I were you - use the after filters.

Henrik

Received on Saturday, 6 March 1999 17:19:51 UTC