That is exactly the right direction I needed to go. Thanks.
I am putting  the cookie found by your routine into httpHeaders
It still isnt working, but I feel like this is the right path. I need to validate that the cookie is actually being sent.
I wish there was a way to watch the http traffic go by.

Bert

On Jul 10, 2008, at 10:46 AM, Trevor DeVore wrote:

On Jul 10, 2008, at 10:10 AM, Bert Shuler wrote:

I have a site which I need to authenticate to. I do this:

put URL "http://site.com/login?uid="&URLEncode("[EMAIL PROTECTED]") & "&password=" & URLEncode("mypass") into field "html"

The host site validates my password, sets a cookie, and redirects me to the front page, which because I have a validated cookie, shows me I am logged in. This works fine in a browser, but it seem "put URL" is doing the redirect, but dropping the cookie. So I never actually get logged in.

My question is this, can I make "put URL" keep the cookies? Or, as an alternate solution, can I make the revBrowser upload files with zero user intervention?

Any pointers will be appreciated.

Hi Bert,

I think you have to handle cookies manually. I just did some work with cookies yesterday so here are some notes based on that experience.

I'm using 'post' rather than 'put' but after executing the 'post' command I used libURLLastRHHeaders() to retrieve the header that the server sent back. You will find at least one line that starts with 'Set-Cookie'.

What you are responsible for doing is extracting the cookie from that line and creating a 'Cookie' entry in the header you send to the server with each request. I put together a handler that takes libURLLastRHHeaders(), extracts the cookies and stores them in a script local variable (this code is for a library, you could easily return the result) that I then assign to 'the httpheaders' property before I send a request to the server expecting the cookie. Here is what it looks like:

##===================

local sCookieHeader


## Parse header returned from a server and create a cookie header that can be sent back: Cookie: cookie1;cookie2;cookie3;...
private command  _StoreCookies pHeader
   local theCharNo,theCookieLine,theLineNo,theOffset

   put empty into sCookieHeader
   put 0 into theOffset
   repeat forever
put lineoffset("Set-Cookie:", pHeader, theOffset) into theLineNo
       if theLineNo > 0 then
           add theOffset to theLineNo
           put line theLineNo of pHeader into theCookieLine
           delete word 1 of theCookieLine ## Set-Cookie:
           put offset(";", theCookieLine) into theCharNo
           if theCharNo > 0 then
               delete char theCharNo to -1 of theCookieLine
           end if
           put theCookieLine & ";" after sCookieHeader
           put theLineNo into theOffset
       else
           exit repeat
       end if
   end repeat

   if the last char of sCookieHeader is ";" then
       delete the last char of sCookieHeader
   end if

   if sCookieHeader is not empty then
       put "Cookie: " before sCookieHeader
   end if

   return empty
end _StoreCookies

##======================

Hopefully this helps.

--
Trevor DeVore
Blue Mango Learning Systems
ScreenSteps: http://www.screensteps.com
Developer Resources: http://revolution.bluemangolearning.com
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to