Topic: Crossdomain.xml

Hello,
I've been trying to make a widget that reads data received from the serial port. I'm trying to do so using a perl cgi that reads the serial and formats the data as a xml file.
If I manually create a xml file with the data generated from the perl script in a regular server I can access the xml from the widget without any problem, but if I place the very same file in the chumby it doesn't work. I think it may have something to do with the crossdomain file, but i just placed a crossdomain.xml file in /www without any luck at all.
The only difference I've noticed accessing to the file in my server and in the chumby is that firefox shows the first one as an xml file and tries to download the second one.
Anyone knows how to solve this?
Thank you

Re: Crossdomain.xml

It seems like the Chumby's internal web server isn't returning the proper MIME type for the XML file.  The busybox httpd that's used on the Chumby doesn't know what to do with .xml files by default, so it serves them as application/octet-stream instead of text/xml.  To fix this, add a httpd.conf file to the directory that has your XML file with the line

.xml:text/xml

When the server reads the file from the directory, it will look at the conf file first and use that to add additional MIME types to its internal list.

Re: Crossdomain.xml

jordixou wrote:

Hello,
I've been trying to make a widget that reads data received from the serial port. I'm trying to do so using a perl cgi that reads the serial and formats the data as a xml file.
If I manually create a xml file with the data generated from the perl script in a regular server I can access the xml from the widget without any problem, but if I place the very same file in the chumby it doesn't work. I think it may have something to do with the crossdomain file, but i just placed a crossdomain.xml file in /www without any luck at all.
The only difference I've noticed accessing to the file in my server and in the chumby is that firefox shows the first one as an xml file and tries to download the second one.
Anyone knows how to solve this?
Thank you

hi jordixou,
   not quite sure what your problem is but I already do the activity you your trying to do so maybe have a look at follow approach i use.

I use a single CGI script to return the data and the crossdomain file - its just called with different parameters.

heres a sample CGI

#! /usr/bin/perl

#
# get the arguments in the URL
#

$request = $ENV{'QUERY_STRING'};  # get the URL parameters
$request =~ s/\%20/ /g;           # unencode spaces - may need other later
@fields = split/\?/, $request;    # split into seperate arguments
$fields[0] = uc($fields[0]);      # convert to upper case

if ($fields[0] eq "FILELIST") #URL get a file list
{

  print "Content-type:text/xml\r\n\r\n";
  print "\<\?xml version=\"1.0\" encoding=\"utf-8\"\?\>\n";
 
  print your XML file here BLAH BLAH BLAH

print "<USBFiles>\n";


}

if ($fields[0] eq "POLICY") # URL get policy

{
  # send the crossdomain policy file

  print "Content-type:text\/xml\r\n\r\n";
  print "<\?xml version=\"1.0\"\?>\r\n\r\n";
  print "<\!-- my crossdomain file -->\n";
  print "<cross-domain-policy>\n";
  print "  <allow-access-from domain=\"\*.chumby.com\" \/>\n";
  print "<\/cross-domain-policy>\n";

}


Then in the actionscript

I have 2 http requests as follows.

  System.security.loadPolicyFile("http://"+ipaddress+"/cgi-bin/custom/photos.pl?POLICY");
  filelist.ignoreWhite = true;
  url = "http://"+ipaddress+"/cgi-bin/custom/photos.pl?FILELIST?" + grepargs ;
  filelist.load(url);

first sets up the crossdomain file (policy)

second actually get the data.

hope this helps

cheers

Nigel

smile  smile  smile

4 (edited by jordixou 2010-01-14 00:07:17)

Re: Crossdomain.xml

Thank you guys! I didn't expect answers so soon.
I finally used the configuration file approach and now it's working smile I created a new httpd server in another port with the configuration file suggested above.