Hi,
I have developed an tested a mod_include.c improvement (httpd 2.2.15).
The module can now handle the "include uvirtual" command, where "uvirtual"
means "unbuffered".
If command is "include virtual" and 200 OK there is a call to ap_rflush(r).
I had this idea because is useful to send chunk (also with gzip) in a
controlled way to force the browser rendering with simple html files! Yes I
love static files ;-)
Scenario:
1 html file with 3 includes, nested included not tested now.
Browsers behavior:
* Chrome and Safari (also with iPhone) need more bytes before starting the
render task.
* Explorer 8 and Firefox are ok with a few bytes.
Here is an .html example:
<html>
<body>
<!--#include uvirtual="/header.html" -->
<hr>
<!-- 4 seconds sleep -->
<!--#include virtual="/sleep.php" -->
<!--#include virtual="/content.html" -->
</body>
</html>
The header comes first and then (4 seconds later) the content.
I'd love any feedback!
Massimiliano Pinto
IT Specialist
Banzai Consulting s.r.l.
Milan, ITALY
P.S:
here is the patch
Index: httpd-trunk/modules/filters/mod_include.c
===================================================================
--- httpd-trunk/modules/filters/mod_include.c (revision 942722)
+++ httpd-trunk/modules/filters/mod_include.c (working copy)
@@ -1060,8 +1060,9 @@
if (!tag || !tag_val) {
break;
}
-
- if (strcmp(tag, "virtual") && strcmp(tag, "file")) {
+
+ /* added uvirtual for unbuffered include virtual */
+ if (strcmp(tag, "virtual") && strcmp(tag, "file") && strcmp(tag,
"uvirtual")) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "unknown parameter "
"\"%s\" to tag include in %s", tag, r->filename);
SSI_CREATE_ERROR_BUCKET(ctx, f, bb);
@@ -1130,6 +1131,11 @@
if (error_fmt) {
break;
}
+
+ /* if all ok and tag is uvirtual do the flush! */
+ if (tag[0] == 'u') {
+ ap_rflush(r);
+ }
}
return APR_SUCCESS;