W3C home > Mailing lists > Public > www-lib@w3.org > October to December 2004

Re: Question: libwww & POST with redirect and basic auth

From: Erik Lotspeich <erik@lotspeich.org>
Date: Fri, 5 Nov 2004 23:09:52 +0000 (UTC)
To: www-lib@w3.org
Message-ID: <Pine.LNX.4.60.0411052306580.2412@shrimp.lotspeich.org>


I'll answer my own question.  It seems to be the case that lack of 
response from the mailing list always prompts me to go deeper into the 
problem and find my own solution. :)

It turns out that libwww drops the credentials intentionally.  I have no 
idea why, but it doesn't seem that this is correct.  I'm sure that there 
is some reason that I'm not aware of.  I solved my problem by a quick 
change to libwww:

diff -u -r w3c-libwww-5.4.0-/Library/src/HTFilter.c 
--- w3c-libwww-5.4.0-/Library/src/HTFilter.c    1999-03-30 
16:53:31.000000000 -0800
+++ w3c-libwww-5.4.0/Library/src/HTFilter.c     2004-11-05 
14:10:31.227802149 -0800
@@ -249,9 +249,6 @@

-    /* Delete any auth credendials as they get regenerated */
-    HTRequest_deleteCredentialsAll(request);
      **  Start new request with the redirect anchor found in the headers.
      ** Note that we reuse the same request object which means that we 

I believe that the credentials shouldn't be dropped, but I'd like to 
confirm that with an "expert" or author of the library.



On Fri, 5 Nov 2004, Erik Lotspeich wrote:

> Hi,
> I am using libwww in an application where I POST some data using basic 
> authentication.  The response page is not just a regular web page, but a 
> redirect to another page.  The problem is that libwww doesn't send the basic 
> authentication credentials when requesting the redirected page.
> I'd like either of two things:
> 1. libwww would not handle the redirect and just stop processing as soon as 
> the post is complete
> 2. handle the redirect and present the proper credentials
> I have scoured the documentation and have come up with the following bit of 
> code:
>                res_request=HTRequest_new();
>                response=HTRequest_response(request);
>                HTRequest_setResponse(res_request,response);
>                res_anchor=HTResponse_redirection(response);
>                HTResponse_setRedirection(response,res_anchor);
>                HTBasic_generate(res_request,basic,0);
>                HTLoadAnchor(res_anchor,res_request);
> The point here was to hopefully "add" the basic credentials to the request 
> for the response page.  And of course I'm sure that I'm way off here since 
> this code does nothing.
> Any help would be greatly appreciated.
> Regards,
> Erik.
> P.S. I haven't forgotten that I owe this list some HOWTO docs on SSL and 
> Basic Auth and POST.  Of course, I can add whatever help you all give me to 
> this document; I'll try to complete it soon!
Received on Friday, 5 November 2004 23:10:33 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:33:56 UTC