Attachment "xhtmlpatch.diff.txt" to
ticket [9fbc3fad8a]
added by
anonymous
2011-04-22 03:10:51.
Index: src/cgi.c
===================================================================
--- src/cgi.c
+++ src/cgi.c
@@ -667,10 +667,16 @@
*/
void cgi_init(void){
char *z;
const char *zType;
int len;
+
+ z = (char *)P("HTTP_ACCEPT");
+ if( z && strstr(z, "application/xhtml+xml") ){
+ cgi_set_content_type("application/xhtml+xml");
+ }
+
cgi_destination(CGI_BODY);
z = (char*)P("QUERY_STRING");
if( z ){
z = mprintf("%s",z);
add_param_list(z, '&');
@@ -1027,10 +1033,12 @@
cgi_setenv("HTTP_HOST", zVal);
}else if( strcmp(zFieldName,"if-none-match:")==0 ){
cgi_setenv("HTTP_IF_NONE_MATCH", zVal);
}else if( strcmp(zFieldName,"if-modified-since:")==0 ){
cgi_setenv("HTTP_IF_MODIFIED_SINCE", zVal);
+ }else if( strcmp(zFieldName,"accept:")==0 ){
+ cgi_setenv("HTTP_ACCEPT", zVal);
}
#if 0
else if( strcmp(zFieldName,"referer:")==0 ){
cgi_setenv("HTTP_REFERER", zVal);
}else if( strcmp(zFieldName,"user-agent:")==0 ){
Index: src/style.c
===================================================================
--- src/style.c
+++ src/style.c
@@ -18,11 +18,11 @@
** This file contains code to implement the basic web page look and feel.
**
*/
#include "config.h"
#include "style.h"
-
+#include <ctype.h>
/*
** Elements of the submenu are collected into the following
** structure and displayed below the main menu by style_header().
**
@@ -105,10 +105,15 @@
Th_Store("compiler_name", COMPILER_NAME);
if( g.zLogin ){
Th_Store("login", g.zLogin);
}
if( g.thTrace ) Th_Trace("BEGIN_HEADER_SCRIPT<br />\n", -1);
+ while( isspace(*zHeader) ){ ++zHeader; }
+ if( strncmp(zHeader, "<html>", 6)==0 ) {
+ Th_Render("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
+ zHeader += 6;
+ }
Th_Render(zHeader);
if( g.thTrace ) Th_Trace("END_HEADER<br />\n", -1);
Th_Unstore("title"); /* Avoid collisions with ticket field names */
cgi_destination(CGI_BODY);
g.cgiOutput = 1;
Index: src/translate.c
===================================================================
--- src/translate.c
+++ src/translate.c
@@ -107,10 +107,15 @@
for(j=0; zLine[i] && zLine[i]!='\r' && zLine[i]!='\n'; i++){
if( zLine[i]==c1 && (c2==' ' || zLine[i+1]==c2) ){
omitline = 1; break;
}
if( zLine[i]=='"' || zLine[i]=='\\' ){ zOut[j++] = '\\'; }
+ if( strncmp(zLine+i, "<html>", 6)==0 ){
+ strcpy(zOut+j, "<html xmlns=\\\"http://www.w3.org/1999/xhtml\\\">");
+ i += 6;
+ j += 45;
+ }
zOut[j++] = zLine[i];
}
while( j>0 && isspace(zOut[j-1]) ){ j--; }
zOut[j] = 0;
if( j<=0 && omitline ){