Thread: [Cppcms-users] Cookies
Brought to you by:
artyom-beilis
|
From: Saikumar G. <sai...@gm...> - 2013-04-29 04:08:59
|
The cookies set in the cppcms app is not visible in the response header at
the client side.
response().set_cookie(cppcms::http::cookie("COOKIE1","value"));
The configuration is through fastcgi from lighttpd.
fastcgi.server = (
"/main" => ((
"bin-path" => "/home/dev/myapp/myapp -c /home/dev/myapp/config.js",
"socket" => "/tmp/hello-fcgi-socket",
"max-procs" => 1,
"check-local" => "disable"
))
)
Could it be because the lighttpd is not forwarding the cookies sent from the
cppcms app ?
Am I doing something wrong with the settings ?
|
|
From: Artyom B. <art...@ya...> - 2013-04-29 06:26:07
|
It is most likely because you had already generated some output before setting the cookie. if you called response().out() - than the headers were generated and written to the output. So make sure you have no output requested. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >________________________________ > From: Saikumar Gandapodi <sai...@gm...> >To: cpp...@li... >Sent: Monday, April 29, 2013 7:08 AM >Subject: [Cppcms-users] Cookies > > >The cookies set in the cppcms app is not visible in the response header at >the client side. > > response().set_cookie(cppcms::http::cookie("COOKIE1","value")); > >The configuration is through fastcgi from lighttpd. > >fastcgi.server = ( > "/main" => (( > "bin-path" => "/home/dev/myapp/myapp -c /home/dev/myapp/config.js", > "socket" => "/tmp/hello-fcgi-socket", > "max-procs" => 1, > "check-local" => "disable" > )) >) > >Could it be because the lighttpd is not forwarding the cookies sent from the >cppcms app ? > >Am I doing something wrong with the settings ? > > > >------------------------------------------------------------------------------ >Try New Relic Now & We'll Send You this Cool Shirt >New Relic is the only SaaS-based application performance monitoring service >that delivers powerful full stack analytics. Optimize and monitor your >browser, app, & servers with just a few lines of code. Try New Relic >and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |
|
From: Marcel H. <ke...@co...> - 2013-04-29 06:57:28
Attachments:
signature.asc
|
On 29.04.2013 06:08, Saikumar Gandapodi wrote:
> The cookies set in the cppcms app is not visible in the response header at
> the client side.
>
> response().set_cookie(cppcms::http::cookie("COOKIE1","value"));
>
> The configuration is through fastcgi from lighttpd.
>
> fastcgi.server = (
> "/main" => ((
> "bin-path" => "/home/dev/myapp/myapp -c /home/dev/myapp/config.js",
> "socket" => "/tmp/hello-fcgi-socket",
> "max-procs" => 1,
> "check-local" => "disable"
> ))
> )
>
> Could it be because the lighttpd is not forwarding the cookies sent from the
> cppcms app ?
>
> Am I doing something wrong with the settings ?
Also you have to know, that the cookies are not visible immediately, but
on the next request from the client.
|
|
From: Saikumar G. <sai...@gm...> - 2013-04-30 03:53:47
|
Good catch. You were right, I had generated the output before setting the cookie. Moving it before the response().out() solved this issue. Thank you. |
|
From: Saikumar G. <sai...@gm...> - 2013-05-02 04:10:01
|
Yet another issue I am facing when using cookie.
I would like to store a user key in cookie when the user logs in and remove the
cookie when the user logs out.
After successful login the cookie is set
app.response().set_cookie(cppcms::http::cookie("_key_", key));
and during logout the cookie is set with max age 0
cppcms::http::cookie thecookie("_key_", key);
thecookie.max_age(0);
app,response().set_cookie(thecookie);
However the cookie is never removed from the browser after logout happens.
Any ideas why this is happening.
Also, I see that cppcms is using Max-Age to set the cookie expiry.
How will this work for earlier IE versions ?
|
|
From: Artyom B. <art...@ya...> - 2013-05-02 04:46:28
|
Don't reinvent the wheel - use sessions: http://cppcms.com/wikipp/en/page/cppcms_1x_sessions http://cppcms.com/wikipp/en/page/secure_programming Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >________________________________ > From: Saikumar Gandapodi <sai...@gm...> >To: cpp...@li... >Sent: Thursday, May 2, 2013 7:09 AM >Subject: Re: [Cppcms-users] Cookies > > >Yet another issue I am facing when using cookie. > >I would like to store a user key in cookie when the user logs in and remove the >cookie when the user logs out. > >After successful login the cookie is set > app.response().set_cookie(cppcms::http::cookie("_key_", key)); > >and during logout the cookie is set with max age 0 > cppcms::http::cookie thecookie("_key_", key); > thecookie.max_age(0); > app,response().set_cookie(thecookie); > >However the cookie is never removed from the browser after logout happens. >Any ideas why this is happening. > >Also, I see that cppcms is using Max-Age to set the cookie expiry. >How will this work for earlier IE versions ? > > > > >------------------------------------------------------------------------------ >Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET >Get 100% visibility into your production application - at no cost. >Code-level diagnostics for performance bottlenecks with <2% overhead >Download for free and get started troubleshooting in minutes. >http://p.sf.net/sfu/appdyn_d2d_ap1 >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |
|
From: Petr J. <ele...@ex...> - 2013-05-03 03:14:02
Attachments:
signature.asc
|
I don't think setting max_age to 0 is actually meant to remove the cookie.
On 2/05/2013 2:09 PM, Saikumar Gandapodi wrote:
> Yet another issue I am facing when using cookie.
>
> I would like to store a user key in cookie when the user logs in and remove the
> cookie when the user logs out.
>
> After successful login the cookie is set
> app.response().set_cookie(cppcms::http::cookie("_key_", key));
>
> and during logout the cookie is set with max age 0
> cppcms::http::cookie thecookie("_key_", key);
> thecookie.max_age(0);
> app,response().set_cookie(thecookie);
>
> However the cookie is never removed from the browser after logout happens.
> Any ideas why this is happening.
>
> Also, I see that cppcms is using Max-Age to set the cookie expiry.
> How will this work for earlier IE versions ?
>
>
>
>
> ------------------------------------------------------------------------------
> Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
> Get 100% visibility into your production application - at no cost.
> Code-level diagnostics for performance bottlenecks with <2% overhead
> Download for free and get started troubleshooting in minutes.
> http://p.sf.net/sfu/appdyn_d2d_ap1
> _______________________________________________
> Cppcms-users mailing list
> Cpp...@li...
> https://lists.sourceforge.net/lists/listinfo/cppcms-users
>
--
Please use PGP to encrypt your email to ensure our privacy is respected.
|
|
From: Saikumar G. <sai...@gm...> - 2013-05-03 10:17:54
|
I got this working. Cookie was removed on setting the max age to 0 on Chrome, FF and Safari. Havent tested this on IE yet. The issue is that the path was different from the page it was initially set to the page it was deleting. Setting the path to / in both places solved this. |
|
From: Saikumar G. <sai...@gm...> - 2013-05-03 10:31:13
|
Max-Age did not work in IE 8.0 with which I tested.
Artyom,
Unless I am mistaken, the session implementation in cppcms relies on Max-Age to expire and
delete it. If so how did you accomplish it to work on IE versions of browser ?
|