From 6eda70c50874ff6c9fb566201fdb01b748730790 Mon Sep 17 00:00:00 2001 From: Xavier Roche Date: Thu, 28 Feb 2013 14:48:58 +0000 Subject: Fixed bogus charset because the meta http-equiv tag is placed too far in the html page --- src/htsparse.c | 46 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/htsparse.c b/src/htsparse.c index 264d4a3..7e1f6f2 100644 --- a/src/htsparse.c +++ b/src/htsparse.c @@ -495,6 +495,8 @@ int htsparse(htsmoduleStruct* str, htsmoduleStructExtended* stre) { int intag_start_valid=0; int intag_ctype=0; // + int emited_footer = 0; // emitted footer comment tag(s) count + // int parent_relative=0; // the parent is the base path (.js, .css..) HT_ADD_START; // débuter lastsaved=adr; @@ -766,15 +768,42 @@ int htsparse(htsmoduleStruct* str, htsmoduleStructExtended* stre) { intag_ctype=2; } } - } - } + } + } if (opt->getmode & 1) { // sauver html - p=strfield(adr,""); - // if (p==0) p=strfield(adr,", , or tag. + // FIXME: we currently emit the tag BEFORE the tag, actually, which is not clean + if ((p=strfield(adr,"")) != 0 + || ( (p=strfield(adr,"")) != 0 + || ( (p=strfield(adr,"adr,'\r')) eol="\r\n"; if (StringNotEmpty(opt->footer) || opt->urlmode != 4) { /* != preserve */ @@ -789,7 +818,8 @@ int htsparse(htsmoduleStruct* str, htsmoduleStructExtended* stre) { //fwrite(tempo,1,strlen(tempo),fp); HT_ADD(tempo); } - if (strnotempty(r->charset)) { + // Emit charset ? + if (emited_footer == 1 && strnotempty(r->charset)) { HT_ADD("charset); HT_ADD("\" />"); -- cgit v1.2.3