HighDots Forums  

Set-Cookie does not work

alt.html alt.html


Discuss Set-Cookie does not work in the alt.html forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
marcwentink@hotmail.com
 
Posts: n/a

Default Set-Cookie does not work - 01-05-2006 , 10:41 AM






I am using socket programming and I am sending a request from client to
server, I have made this message in my program but somehow, the COOKIE
I set does not get to the server:

This is my message:

POST /cgi-bin/xxxxxx/xxxxxxxxxxxxx HTTP/1.1
Accept: */*
Referer: http://xxxxxxxxx.xxx.xxxxx:80/cgi-bi.../xxxxxxxxxxxxx
Content-Type: application/x-www-form-urlencoded
Content-Length: 15
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
Host: xxxxxxxxx.xxx.xxxxx:80
Connection: Keep-Alive
Cache-Control: no-cache
Set-Cookie: SessieString=xxxxxxxxxxxxxxxx;
path=/cgi-bin/xxxxxx/xxxxxxxxxxxxx; v
ersion=1

action=xxxxxxxx

I did got some info, the parameter 'action' is read correctly at the
server side, but getting some debug info tells me that no Cookies are
present, at all, at the Server Side. Let alone the named Cookie
SessieString.

I feel, to put it diplomaticly, 'somewhat frustrated', trying all kinds
of things, and not knowing what I do wrong. I 've been prutsing with it
the whole day now...

I tried Cookie instead of Set Cookie, with and without the path en
version, and the letter with and without the semicolon. I used /r/n
since the server is on unix (Apache) and I am sending from a
windows-client (Little C program written in g++).

:-(

Please help me!


Reply With Quote
  #2  
Old   
David Dorward
 
Posts: n/a

Default Re: Set-Cookie does not work - 01-05-2006 , 02:35 PM






marcwentink (AT) hotmail (DOT) com wrote:

Quote:
I am using socket programming and I am sending a request from client to
server, I have made this message in my program but somehow, the COOKIE
I set does not get to the server
The browser makes a request, which includes any cookies that are set
already.

The server makes a response, which can set cookies.

Are you trying to read the cookies inside the script that just set them? If
so they won't exist yet.


--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is


Reply With Quote
  #3  
Old   
Michael Winter
 
Posts: n/a

Default Re: Set-Cookie does not work - 01-05-2006 , 04:12 PM



On 05/01/2006 15:41, marcwentink (AT) hotmail (DOT) com wrote:

[snip]

Quote:
POST /cgi-bin/xxxxxx/xxxxxxxxxxxxx HTTP/1.1
This is a POST request...

[snip]

Quote:
Set-Cookie: SessieString=xxxxxxxxxxxxxxxx;
path=/cgi-bin/xxxxxx/xxxxxxxxxxxxx; v
ersion=1
....but Set-Cookie is a response header. You also seem to have a CRLF in
that value[1].

Quote:
I tried Cookie instead of Set Cookie,
If you send

Cookie: SessieString=xxxxxxxxxxxxxxxx

there should be no problem.

Quote:
with and without the path
The path parameter is not included in a Cookie request header. The
Cookie header consists only of name/value pairs.

Quote:
en version
There is no version parameter for either Cookie or Set-Cookie.

Quote:
and the letter with and without the semicolon.
I'm not quite sure what you mean there.

Quote:
I used /r/n since the server is on unix (Apache) and I am sending from a
windows-client (Little C program written in g++).
It doesn't matter which operating system is used. Each header must be
terminated a CRLF pair (ASCII 13 + 10), and the entity body must be
separated from the headers by another CRLF pair.

Mike


[1] If that is just an error caused by automated wrapping from
your newsreader, you should do yourself (and others) a favour
by either explicitly noting the wrapping (to distinguish
intent from error) or, even better, wrap manually and
continue the header value on the following line (with the
necessary linear white space).

Set-Cookie: SessieString=xxxxxxxxxxxxxxxx;
path=/cgi-bin/xxxxxx/xxxxxxxxxxxxx;
version=1

--
Michael Winter
Prefix subject with [News] before replying by e-mail.


Reply With Quote
  #4  
Old   
marcwentink@hotmail.com
 
Posts: n/a

Default Re: Set-Cookie does not work - 01-06-2006 , 03:13 AM



Hi, thanks for the comments.

It works, I should do

Cookie: SessieString=xxxxxxxxxxxxxxx

since this is a request : browser --to--> server

For your interest, I did try something like that before, but then

Cookie: xxxxxxxxxxxxxxx

and of course:

Cookie:xxxxxxxxxxxxxx
Cookie:"xxxxxxxxxxxxxxxx"

It's hard to see what wrong sometimes, with socket programming and
message generation. Thanks for all the help!


Reply With Quote
  #5  
Old   
marcwentink@hotmail.com
 
Posts: n/a

Default Re: Set-Cookie does not work - 01-06-2006 , 04:16 AM



Mr. Winter:

Quote:
If you send
Cookie: SessieString=xxxxxxxxxxxxxxxx
there should be no problem.
You're right, that was is. It was indeed browser to server. Before my
Set-Cookie attempt, I did try

"Cookie: xxxxxxxxxxxxxx",

without 'SessieString='. That was not working. Thank you.



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.