RSS
 

Archive for July, 2007

Loading Flash Charts with XML over HTTPS

23 Jul

The simple answer: You must allow the xml file to be cached.

This could be a security risk in the situation where the chart data is sensitive. IE7 still suffers from this problem however.

Not only should the flash file itself “charts.swf” be cached, but the XML file used to generate the file needs to be cached as well.

All you need to do is remove any type of “no-cache” headers that are sent for those two files.


Cache-Control: no-cache #=> remove this line (http 1.1)
Pragma: no-cache #=> remove this line as well (if present - http 1.0)

There is a solution though that can still retain some security: limit the cache time to a few minutes or seconds.

That way if the user logs out from a public terminal, the cache would expire shortly — so the next user of the public terminal should not be able to see the chart data by hitting the back button or viewing the cache on the hard-drive.


Cache-Control: max-age=0

More info can be found about Cache-Control HTTP headers from the official spec.

VN:F [1.9.3_1094]
Rating: 5.0/10 (1 vote cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)
Retweet
 
Comments Off

Posted in Development

 

Example of How to Ignore Files in Subversion

04 Jul

Have you ever had those pesky little files constantly telling you they’ve been modified? …you couldn’t care less about “commiting” them into the subversion repository every time, right? — log files, session data, temporary caches are all great examples of things that should probably be ignored and forgotten.

Ignoring locally modified files in subversion is quite easy, once you get the hang of it.

I struggled a bit with the example from the SVN book. Mainly because I was unsure where to actually set my property.

I’m writing an application with Smarty and PHP and have several temporary files created in my development environment and wanted to simply “ignore” them all so they do not keep showing up when I run an “svn status” command…

$ touch ./template_c/foo
$ svn st
?      template_c/foo

Everything under “template_c” should be ignored by subversion, I do not want to version temporary cache files of templates created with new requests.

Here’s the quick and easy way to get it done…

$ cd ~/trunk
$ svn propset svn:ignore '*' ./template_c/

First, I change directory into the trunk (or parent of the directory I want to ignore).

Then I simply set an svn property “svn:ignore”, which takes 2 property arguments: the pattern of the file to ignore, and the directory path to apply it to.

In other words, I am telling svn to set the property “svn:ignore” to ignore all files “*” under the sub-directory “./template_c”.

If I wanted to ignore only smarty template php files, I would’ve used something like:

$ svn propset svn:ignore '*.tpl.php' ./template_c/
#ignores files such as "foo.tpl.php"
/pre>

However, I still have one last step, as shown by the following "status" command:

<pre class="syntax bash">
$ svn st
 M     .
 M     template_c

…commit the new property for the current directory (this property will apply to all svn users once committed).

$ svn ci -m 'ignore smarty template caches' .

If you want to only apply the change to your local repository, then look into the ‘-F’ option to “svn propset” to specify a local file with a list of file patterns to ignore. This way, developers can add/remove entries from their own local copy if they wish.

One last trick — if I really want to see what is in the ignored directory, I just run the command with the “–no-ignore” option:

$ svn st --no-ignore
I      template_c/foo
VN:F [1.9.3_1094]
Rating: 8.4/10 (5 votes cast)
VN:F [1.9.3_1094]
Rating: +4 (from 4 votes)
Retweet