RTC Forums
November 23, 2024, 11:40:12 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Cookie with "Path=/;" attribute through the Router Demo  (Read 4322 times)
Dany
RTC License++
*****
Posts: 69


« on: June 13, 2016, 12:22:44 PM »

I have the need to set a cookie and i'm using this line of code:

Code:
Server.Response.Cookie['session-id'] := Server.Session.ID + '; Path=/;';

The server that does this will return the request correctly and in my browser (this is TRtcDataProvider stuff only) i can see the following when i click "Header" i the XHR log:

Code:
HTTP/1.1 200 OK
Access-Control-Allow-Headers: Pragma,Content-type
Cache-Control: no-cache,no-store
CONTENT-TYPE: application/json
CONTENT-LENGTH: 201
SET-COOKIE: session-id=7D0E769C233A4D40B719F451DD3566F4; Path=/;

this is all good.

Now, i need to put this server behind a router. So i write a router using RTC and use the example. Strange things are happening with this cookie. Not to start a long discussion, after half a day of confusion i fire up the router demo from the SDK (RTCRouter.exe) and change the outgoing address to localhost and then i change the port to that which the server is listening to. These are all the changes i have done to the demo (of version 7.18). Click START and run the request.

The response that now comes through the router look like this:

Code:
HTTP/1.1 200 OK
Access-Control-Allow-Headers: Pragma,Content-type
Cache-Control: no-cache,no-store
CONTENT-TYPE: application/json
CONTENT-LENGTH: 215
SET-COOKIE: session-id=3D1087C9B14740E784481493F3E1C4C0
SET-COOKIE: Path=/

My "own" router does the exact same thing. I have also tried to remove the space between the first ; and the P to no avail. The difference between how the response is served obvious. This makes the browser store multiple cookies and mix them up so i'm getting stuck. I have been sifting through sources but can not grasp why the router and client does this when the server does not. Somewhere deep i have seen an object with a delimiter member set to ';' but the router should not use that?

All in all i suppose this is stuff that corresponds to "Cookie attributes" as described here https://en.wikipedia.org/wiki/HTTP_cookie#Cookie_attributes amongst other places.

Stumped and very grateful for any insights.

Regards,

/Dany
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 on: June 13, 2016, 03:42:14 PM »

Thanks for reporting this. There was a bug in the HTTP Header parser (it was affecting Clients, Routers and Load Balancers) which resulted in each parameter inside a Cookie to be split into a separate Cookie. Please, download RTC SDK v7.22 (just uploaded) and let me know if everything works as intended now, or if you bump into any other problems.

Best Regards,
Danijel Tkalcec
Logged
Dany
RTC License++
*****
Posts: 69


« Reply #2 on: June 13, 2016, 04:05:26 PM »

At first glance it looks very good.

Simply brilliant support and responses.

How i do not miss Indy or DS at all!!

Many thanks,

/Dany
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.023 seconds with 16 queries.