libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libmicrohttpd] SSI support


From: Christian Grothoff
Subject: Re: [libmicrohttpd] SSI support
Date: Sat, 25 Aug 2012 14:18:01 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.6esrpre) Gecko/20120817 Icedove/10.0.6

On 08/25/2012 10:37 AM, Martin Velek wrote:
Hello,

may I ask you, how to correctly implement SSI
(http://en.wikipedia.org/wiki/Server_Side_Includes) pages into
libmicrohttpd?

E.g. I have a page
#define PAGE "<html><head><title>libmicrohttpd demo</title>"\
              "</head><body>Temeprature:<!--#exec cgi="temperature"
--></body></html>"

The SSI parser knows that he should call const * char
temperature(void) when the string<!--#exec cgi="temperature" -->  is
found inside a html file. There is an issue, I cannot prepare the
whole reply in one buffer.

I have thought about using this function (taken from example)
  response = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN, xxx,
&data_generator, NULL, NULL);

And the data_generator, which contains SSI parser, will read from
given filename until<!--#exec cgi="temperature" -->  is found and
replace it by the output of const * char temperature(void). If no data
left, it will return MHD_CONTENT_READER_END_OF_STREAM.

Is it a fancy solution? Or if there is a better way how to handle it,
I will appreciate your help.
I don't know about this being a 'fancy' solution, but it sounds like you implemented the canonical solution.

Happy hacking!

-Christian



reply via email to

[Prev in Thread] Current Thread [Next in Thread]