[En-Nut-Discussion] SSI and ASP extensions for httpd, seek extensions for file system api

Ole Reinhardt ole.reinhardt at kernelconcepts.de
Fri Aug 5 16:00:31 CEST 2005


Hi all,

I just checked in a bunch of new code.

In detail:

I added support for fseek, ftell, _seek, _tell. These functions shoudl
work with uromfs and pnutfs.

The NutOS http deamon now supports server side includes and asp
functions. The ASP part is contributed by Michael Fischer.

In detail:

On can now register a special mime Handler for every supported mime
type. To support asp and ssi I added several mime types too (e.g.
".shtml" ".asp" and some more)

If you have not registered the default NutHttpProcessFileRequest will
load the file from fs and send it to the http ouput stream. If a mime
handler is registered, this function will be called instead and have to
send the data.

You can set a mime handler with:

u_char NutSetMimeHandler(char *extension, void (*handler)(FILE *stream,
int fd, int file_len, u_char *http_root, REQUEST *req));

and query a mime handler with:

void *NutGetMimeHandler(char *name);

Where name is a filename.

The SSI and the ASP extensions both use this mechanism. You can enable
them by NutRegisterAsp and NutRegisterSsi();

Server side includes may only be used in files with the extension
"*.shtml" and asp may only be uswd in files with "*.asp"

For asp you can register a callback to handle your own ASP functions.
See the httpd example application for more info.

What SSI and ASP functions are supported:

SSI:

<!--#include virtual="/news/news.htm" -->
<!--#include file="UROM:file.txt" -->
<!--#exec cgi="/cgi-bin/test.cgi?param=value" -->

ASP:

<%nut_version%>
<%nut_mac_addr%>
<%nut_ip_addr%>
<%nut_ip_mask%>
<%nut_gateway%>

If you have registered an ASP callback you can also use:

<%myownfunctions%>

Where the strings "myownfunctions" are passed to the callback...

Have fun using server side includes and asp and happy hacking!

Ole Reinhardt

-- 
kernel concepts    Tel: +49-271-771091-14
Dreisbachstr. 24   Fax: +49-271-771091-19
D-57250 Netphen    E+ : +49-177-7420433
--





More information about the En-Nut-Discussion mailing list