We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello,
I want to use the HTTP-Webserver with the flashfilesystem of the Realview RTL. The webserver should read all files from the flashfilesystem. Therefore I added the http_uif.c file to the project.
I can retrieve normal *.htm files with the help of the webbrowser, but any dynamic content like CGI-Files are not accessible by the webserver. When I doubleklick on a link to a CGI-File, I see the file not found page. At the same moment the output of the debug version of RTL libary states "HTTP_ERR: File not found, session 0".
I already added some additional debug outputs to the http_uif.c file to see which files are opened by the HTTP-Server. So I recognized that the HTML- and GIF-Files are open through the interface provided by http_uif.c, but the CGI-files aren't.
Whats the reason for this? Is there an option to change this behavior?
I'm using RL-ARM 3.10 RL-MDK 3.11.
Rainer
Please read the following posts:
http://www.keil.com/forum/docs/thread10084.asp http://www.keil.com/forum/docs/thread10244.asp
Hello Franc,
first thanks for your quick reply and sorry that I forgot to use the search from the forum first, before starting a new thread.
I have read the replies you have linked in your message post. But the result is a really bad news. From my observation of the Keil-Forum I know that you are linked to Keil and the TCPnet in some way, because you have a special backgroundknowlegde that's nowhere documented. So I hope you can answer my question.
It seems to me, the fact that cgi-files must be stored on the virtual ROM file system is a feature that might be easily changed. As I could see with the two forum posts other user would appreciate a different bahavior too.
It is possible to change this or make this feature optional by a support request to Keil?
I really need those cgi-files on the filesystem, because my target application should contain a webserver with webpages that should be highly customizeable by the end-user.
In case you don't want to answer in the forum, please give me hint. Then I will send a email to Keil support and we might discuss this by email.
Thanks in advance
As you know cgi files have some restrictions. The script processing behind is simplified, because the cgi file is accessed via the pointer to the const memory. If we allow cgi files to be located on external FS, then we need to buffer the file in RAM. This reduces the performance and increases the RAM requirements for TCPnet applications.
On the other hand I see no real reason why to do it. If a cgi file would be changed on external SD card, also the application need to be updated and recompiled. Each new command from cgi file needs a c-function behind which would process a new cgi command.
If the user modifies the cgi file, he has to modify also the underlaying HTTP_CGI.c module. This can all be done in a single project and well maintained on a project base, no need for the cgi file to be generated externally.
Franc
As a result to the restriction of the cgi-files I assume that they are processed linewise with a maximum length of 120 characters. So a cgi-file could be easily read line by line to a buffer. The additional needed buffersize of around 120 bytes would be acceptible. The performance loss due to the buffered read depends highly on the reaf speed of the used flashfilesystem, but in general reading is often quite fast and efficient.
As you see no reason, I try to explain you the use in my application. I want to extend the powerfull cgi command "c" and implement a lot of subcommands where each command outputs the dynamic value of a different variable. The values of those variables should be displayed by dynamic webpages and some of them should be alterable. For flexible use of the application those websites should be highly customizeable for the end-user. So that he can change the whole layout of the websites and for example decide which variables should be displayed.
Another positive effect is the improved developement process of the webpages. So they might be designed in an professional development enviroment on a pc and might be simply transfered through TFP (maybe FTP in future) to the application. So theres no need to recompile the whole project and download it all slowly every time some minor changes are made. So simple the changed file is updated and the system can be tested.
I didn't explained my arguments very detailed, but I'm sure everybody know what I mean.
So from my point of view the changes in the webserver of TCPnet are useful und desireable.
Hello all,
I would like to know what other people think about the cgi-feature? Maybe somebody has the same problem...
@Franc: I hope you have read my reply to your post. Can you see the advantage of requested modification now or do you still dismiss my suggestion?
Kind regards,
Rainer, you are in right! CGI feature is hard to use, CGI files can't edit with standard WEB editor.
My approach for embedded WEB server is different, I use token replacement in HTML code. Every token begin with escape char ($ in my implementation), and ending with space. Tokens are inserted in HTML text, and filesystem Read function replace it with actual value of variable.
Tokens are stored in constant table with record structure:
typedef struct { char name[10]; // char format[10]; // for sprint void *address; char type; // enum for: char int, float.. float LLim, ULim, Def; // upper, lower and default value } TParamTable;
I hope this is about you think.
Georg