Web Server VARIABLE works in Flash but not from SD Card

Discussion to talk about software related topics only.
Post Reply
Lachlanp
Posts: 91
Joined: Tue Jan 29, 2013 4:44 am

Web Server VARIABLE works in Flash but not from SD Card

Post by Lachlanp »

If create a simple web page index.htm and save in the html directory and compile the program, the html code

<title><!--VARIABLE FooWithParameters(fd, 1) --></title>

result with the tab displaying the results of the FooWithParameters program as expected.

If I now load the same index.htm page on the SD Card (with all appropriate drivers), then the tab display is
<!--VARIABLE FooWithParameters(fd, 1) --> rather than the text this should display.

Does anyone have any ideas why the exact same line of code does not work with the SD Card.

Regards
Lachlan
User avatar
dciliske
Posts: 624
Joined: Mon Feb 06, 2012 9:37 am
Location: San Diego, CA
Contact:

Re: Web Server VARIABLE works in Flash but not from SD Card

Post by dciliske »

Yes. I know the exact reason and yet can't think of a solution. The reason for this is how the http server and all of the VARIABLE and FUNCITIONCALL tags are implemented. The standard process of writing your webpage, building your application, and serving said page from the Netburner is as follows:
  1. Place all webpages in 'html' subdirectory of source directory.
  2. Build the application. When building the application, the tool 'htmlcomp' reads the contents of all files in the 'html' directory and converts them into C source code. It also parses html files looking for template tags, and replaces them with lookup markers in the C source. Finally, it compiles tables containing the list of files processed and contained in the source, and tables with to be used in the lookups when serving the page.
  3. When a client connects, and requests a webpage, the server takes in the GET request and looks in its file table. If it finds the requested file, it then determines if the file has lookups or not. If it doesn't, then the file is simply served up and written directly to the response stream. If it does have lookups, the server must use the lookup tables created in the comphtml process to determine what values to insert or what function to call.


So, why can't you use the VARIABLE tag when the html file is on the SD Card? Because it wasn't compiled into the app by comphtml and therefore is served statically. Should this work differently? Probably. Do I know what that will look like or when it will occur, unfortunately, no. The way around this issue is to put any and all pages that use the VARIABLE or FUNCTIONCALL tags in the app itself, but place the large static resources (like images or Javascript libraries) on the external SD Card and partition your source/directory structure of the website accordingly.

-Dan
Dan Ciliske
Project Engineer
Netburner, Inc
Lachlanp
Posts: 91
Joined: Tue Jan 29, 2013 4:44 am

Re: Web Server VARIABLE works in Flash but not from SD Card

Post by Lachlanp »

Thanks, this works fine
Post Reply