Ciao amici,

        I was trying the HTTP connections this morning. I have encountered a
problem and I don't know how to get out hte way I would. Let me explain.

When I make an HTTP request (with both HEAD and GET methods), I obtain a
response from the server, I parse the header and look for the info
contained. Among the info that result, I take the status code.

If the request method is 'GET' and the document is parsable I want to
retrieve the result. Obviously. So far so OK. But I want to restrict the
cases where I retrieve the body, for only those documents I get a status
code between 200 and 299. It seems reasonable to me: it would save us to
download lots of unuseful bytes.

But trying to retrieve a redirected url (with 302) with GET method I
crashed myself against a wall. After that, indeed, I tryed to retrieve
another URL, but I received an error during the header parsing: the stream
contained the body of the previous message and so the header parsing
couldn't work ...

These are the steps I did:

- Retrieving a redirected URL
- Making a GET request
- Analyse the header and then the response status code
- It was 302. So, as it doesn't belong to the 2xx codes family, its body
has not to be read. So we skip the read of the body procedure.
- Retrieving the next URL
- Making a GET request
- Analyse the header
- Here I found the error. While parsing the header, cos the stream buffer
contained the previous response body.


The chances are 3, in order of favour:

- get the stream buffer empty with a command (I hope it exists, tell me 'YES')
- send a signal to the connection (maybe by closing it too - I hope it
won't be !!!)
- reading the body even if I don't need it (I don't think it's much good)

Please help me, I trust you ...

Ciao
-Gabriele


-------------------------------------------------

Gabriele Bartolini
U.O. Rete Civica - Comune di Prato
Prato - Italia - Europa

e-mail: [EMAIL PROTECTED]
http://www.po-net.prato.it

-------------------------------------------------

------------------------------------
To unsubscribe from the htdig3-dev mailing list, send a message to
[EMAIL PROTECTED] containing the single word "unsubscribe" in
the SUBJECT of the message.

Reply via email to