Thread: [Cppcms-users] urlencode and base64_urlencode filters do not work...
Brought to you by:
artyom-beilis
From: augustin <aug...@ov...> - 2011-01-12 04:02:18
|
Hello, Referring to the template filters: http://art-blog.no-ip.info/cppcms_ref_v0_99_1/namespacecppcms_1_1filters.html http://art-blog.no- ip.info/wikipp/en/page/cppcms_1x_templates_comm#Variable.with.filters In my template, all the following filters work as expected: <% my_var | to_title %> <% my_var | raw %> <% my_var | to_upper %> <% my_var | escape %> But if I use one of the two urlencode filters, the application crashes at run time: <% my_var | urlencode %> <% my_var | base64_urlencode %> Is their use different? But I see in wikipp that you don't use any filters for URLs, e.g.: <a href="<% c.diff_url %>"><% gt "Diff to previous" %></a> What's the best (safest) way to handle links? my_var is a std::string. Thanks, Augustin. -- Friends: http://www.reuniting.info/ http://activistsolutions.org/ My projects: http://astralcity.org/ http://3enjeux.overshoot.tv/ http://linux.overshoot.tv/ http://overshoot.tv/ http://charityware.info/ http://masquilier.org/ http://openteacher.info/ http://minguo.info/ http://www.wechange.org/ http://searching911.info/ . |
From: Artyom <art...@ya...> - 2011-01-12 08:28:49
|
> > Hello, > > Referring to the template filters: > > http://art-blog.no-ip.info/cppcms_ref_v0_99_1/namespacecppcms_1_1filters.html > http://art-blog.no- > ip.info/wikipp/en/page/cppcms_1x_templates_comm#Variable.with.filters > > In my template, all the following filters work as expected: > <% my_var | to_title %> > <% my_var | raw %> > <% my_var | to_upper %> > <% my_var | escape %> > > But if I use one of the two urlencode filters, the application crashes at run > time: > <% my_var | urlencode %> > <% my_var | base64_urlencode %> > > Is their use different? First of all base64_urlencode indeed had a bug, fixed in trunk changeset 1630. Thanks for reporting this! I don't see any issues with urlencode filter seems to work. Also small notice: "escape" is the **default** filter no need to specify it explicitly, if you want to pass the string "as-is" you need to use "raw" filter - which bypasses the escaping. Artyom |
From: augustin <aug...@ov...> - 2011-01-12 09:01:02
|
On Wednesday 12 January 2011 04:28:42 pm Artyom wrote: > First of all base64_urlencode indeed had a bug, fixed in trunk changeset > 1630. > > Thanks for reporting this! > > > I don't see any issues with urlencode filter seems to work. > base64_urlencode seems to be working now, but I still experience random (?) crashes with urlencode. I'll investigate more and let you know if I can narrow it down with a small example code. thanks, Augustin. -- Friends: http://www.reuniting.info/ http://activistsolutions.org/ My projects: http://astralcity.org/ http://3enjeux.overshoot.tv/ http://linux.overshoot.tv/ http://overshoot.tv/ http://charityware.info/ http://masquilier.org/ http://openteacher.info/ http://minguo.info/ http://www.wechange.org/ http://searching911.info/ . |
From: Artyom <art...@ya...> - 2011-01-12 09:34:12
|
> > base64_urlencode seems to be working now, but I still experience random (?) > crashes with urlencode. I'll investigate more and let you know if I can narrow > > it down with a small example code. > Ok... That was really embarrassing as three was a bug in urlencode for long time. char c = ...; char buf[4]; sprintf(buf,"%%%02x",(unsigned)c); // <- BUG HERE! Together with the fact that I forgot include <cppcms/config.h> to get CPPCMS_HAVE_SNPRINTF so it hadn't used protected version of snprintf(buf,sizeof(buf),"%%%02x",(unsigned)c); // Which is not correct as well, but not crashes. and finally got buffer overflow... Fixed in 1631 in CppCMS 1.x.x and in 1632 in CppCMS 0.0.x P.S. Now I know why Unicode user names didn't worked in Wikipp.... Thanks a lot for reporting this bug. Artyom |
From: augustin <aug...@ov...> - 2011-01-12 10:30:15
|
On Wednesday 12 January 2011 05:34:05 pm Artyom wrote: > Fixed in 1631 in CppCMS 1.x.x and in 1632 in CppCMS 0.0.x Yep, it works now. :) > Thanks a lot for reporting this bug. Well, it's nice to be useful, for a change. I usually ask very beginner questions. Thanks for the quick fix. Augustin. -- Friends: http://www.reuniting.info/ http://activistsolutions.org/ My projects: http://astralcity.org/ http://3enjeux.overshoot.tv/ http://linux.overshoot.tv/ http://overshoot.tv/ http://charityware.info/ http://masquilier.org/ http://openteacher.info/ http://minguo.info/ http://www.wechange.org/ http://searching911.info/ . |