OK, so here we go. test.tcl contains a single line, a call to ad_returnredirect, which has been modified to use ns_respond instead of ns_returnredirect.

GET /test.tcl HTTP/1.0

HTTP/1.0 302 Found
Set-Cookie: ad_session_id=80111002%2c0+%7b542+1140224229 +57E9A3EA3E33AB40F47F8EA71184A3D012E347ED%7d; Path=/; Max-Age=1200
location: http://temp.nybooks.com/test2.tcl
MIME-Version: 1.0
Date: Sat, 18 Feb 2006 00:37:09 GMT
Server: AOLserver/4.0.10
Content-Type: text/plain; charset=iso-8859-1
Content-Length: 8
Connection: close

RedirectConnection closed by foreign host.

And if I request test2.tcl directly, I get

GET /test2.tcl HTTP/1.0

HTTP/1.0 200 OK
MIME-Version: 1.0
Content-Type: text/html
Set-Cookie: ad_session_id=80111202%2c0+%7b453+1140224589 +962CB2C08C8F3888B4A1FF91770F02814E70BB45%7d; Path=/; Max-Age=1200
Server: AOLserver/4.0

ns_conn headers - size = 0<br>
<p>
ad_conn headers - size = 0<br>
<p>
ns_conn outputheaders - size = 2<br>
key = Set-Cookie, value = ad_session_id=80111202%2c0+%7b453+1140224589 +962CB2C08C8F3888B4A1FF91770F02814E70BB45%7d; Path=/; Max-Age=1200<br>
key = Server, value = AOLserver/4.0<br>
<p>
ad_conn outputheaders - size = 2<br>
key = Set-Cookie, value = ad_session_id=80111202%2c0+%7b453+1140224589 +962CB2C08C8F3888B4A1FF91770F02814E70BB45%7d; Path=/; Max-Age=1200<br>
key = Server, value = AOLserver/4.0<br>
Connection closed by foreign host.

So Set-Cookie is there.

However, if I request test.tcl in the browser, I get redirected to test2.tcl which prints out the output of ad/ns_conn headers and ad/ ns_conn outputheaders, where there is nary a Set-Cookie in sight. Somehow it's getting lost along the way.

I'm perplexed.

janine

On Feb 17, 2006, at 3:45 PM, Tom Jackson wrote:

Janine,

So the command sequence I use goes like this:

$ telnet rmadilo.com 80
Trying 216.211.130.179...
Connected to rmadilo.com.
Escape character is '^]'.
GET /mypage HTTP/1.0
Host: rmadilo.com

HTTP/1.0 200 OK
Set-Cookie: SessionID = "9A7EDDAAACCD226251DFC34240FA7A320FA7FE5C" ; Max-Age =
911003711 ; Path=/
Set-Cookie2: SessionID = "9A7EDDAAACCD226251DFC34240FA7A320FA7FE5C" ; Max-Age
= 911003711 ; Path=/ ; Version = 1
Last-Modified: Mon, 09 May 2005 23:27:28 GMT
MIME-Version: 1.0
Date: Sat, 18 Feb 2006 00:24:49 GMT
Server: AOLserver/4.0.10
Content-Type: text/html; charset=iso-8859-1
Content-Length: 29
Connection: close

<a href="/files/">Files</a>


It is only necessary to use the Host: header if you use virtual hosting.

tom jackson






On Friday 17 February 2006 15:12, Janine Sisk wrote:
If I telnet in and do "GET /"  I just get the HTML for the page, like
you would expect:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd";>
<html>
<head>

and so forth.  If I request the page that does the redirect I get

GET test.tcl
RedirectConnection closed by foreign host.

However if I request test.tcl in the browser I do get properly
redirected to test2.tcl.  I am not very well versed in telnet
commands, so if there's something else I can do to get more info,
please let me know.

Yes, I have printed out the contents of outputheaders and the Set-
Cookie is there, but it doesn't make it through the redirect.

janine

On Feb 17, 2006, at 2:48 PM, Tom Jackson wrote:
Janine,

If you telnet into the page, what do you get sent back?

I'm not sure where in here you add the Set-Cookie header? Do you
know that it
is in the output headers at the time you grab a copy of the set?

tom jackson

On Friday 17 February 2006 14:10, Janine Sisk wrote:
This should be simple, but it's turning out not to be.

First I used this code, which I got from a post at openacs.org (and
the poster got it from the AOLserver docs for ns_respond):

set headers [ns_set new myheaders]
ns_set put $headers location $url
ns_respond -status $return_code -type text/plain -string Redirect -
headers $headers

This worked as far as the redirect and status code are concerned, but
cookies were no longer functioning.

I noticed that ad_set_cookie (an openacs proc) adds a key called Set- Cookie to the "ns_conn outputheaders" set, so I tried this, hoping to
capture all possible relevant values:

set headers [ad_conn headers]
set outputheaders [ad_conn outputheaders]
set allheaders [ns_set merge $headers $outputheaders]
ns_set idelkey $allheaders location
ns_set put $allheaders location $url
ns_respond -status $return_code -type text/plain -string Redirect -
headers $allheaders

No improvement; cookies still don't work. BTW, I tried it with both ns_conn and ad_conn but they both give the exact same output, so same
end result.

Any suggestions on what I might be doing wrong here?

I know that the best way to fix this would be to create an
ns_returnmoved function in AOLserver, but I was trying to avoid
having any of our clients using a customized version.

Thanks for any suggestions,

janine


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to
<[EMAIL PROTECTED]> with the body of "SIGNOFF AOLSERVER"
in the
email message. You can leave the Subject: field of your email blank.

--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to
<[EMAIL PROTECTED]> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the
Subject: field of your email blank.

--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to
<[EMAIL PROTECTED]> with the body of "SIGNOFF AOLSERVER" in the
email message. You can leave the Subject: field of your email blank.


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> with the body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of your email blank.


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> 
with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.

Reply via email to