From 9b5c6cf86ed8dbf749bc2e401d4f87d340b6413d Mon Sep 17 00:00:00 2001 From: Xavier Roche Date: Wed, 15 Oct 2014 19:17:29 +0000 Subject: Fixed webhttrack incompatibility with Chrome * closes:#53 Also fixed HTML-escaping issues inside webhttrack Rationale: The webhttrack script made the wrong assumption that once the "browse" command returned, it meant the user killed the navigation window, and it had to kill the server itself. However, modern browsers tend to "attach" to an existing session (creating a new tab, for example, within an existing window), causing the browsing command to return immediately, thus causing the server to be killed immediately by the webhttrack script. I have rewritten the logic behind, and now the server is able to kill himself if the parent script dies, AND if the browsing client did not make any activity for two minutes. The "activity" can be any browser/refreshed page, or the internal "ping" iframe (which pings the server every 30 seconds). With this model, we *should* be compatible with old browsers, and modern ones. --- html/Makefile.am | 4 +- html/Makefile.in | 4 +- html/server/about.html | 76 +----------------- html/server/addurl.html | 83 +++----------------- html/server/error.html | 71 +---------------- html/server/exit.html | 4 +- html/server/file.html | 75 +----------------- html/server/finished.html | 113 ++++++--------------------- html/server/help.html | 81 ++------------------ html/server/index.html | 77 ++----------------- html/server/option1.html | 147 +++++++++-------------------------- html/server/option10.html | 145 +++++++++-------------------------- html/server/option11.html | 171 ++++++++++++----------------------------- html/server/option2.html | 169 ++++++++++++---------------------------- html/server/option2b.html | 125 +++++++----------------------- html/server/option3.html | 151 ++++++++++-------------------------- html/server/option4.html | 153 ++++++++++--------------------------- html/server/option5.html | 159 +++++++++++--------------------------- html/server/option6.html | 143 +++++++++------------------------- html/server/option7.html | 141 +++++++++------------------------- html/server/option8.html | 155 ++++++++++--------------------------- html/server/option9.html | 151 ++++++++++-------------------------- html/server/ping.js | 26 +++++++ html/server/refresh.html | 191 +++++++++++++++------------------------------- html/server/step2.html | 129 ++++++++----------------------- html/server/step3.html | 91 +++------------------- html/server/step4.html | 139 +++++++++------------------------ html/server/style.css | 66 ++++++++++++++++ src/htsserver.c | 70 +++++++++++++---- src/htsserver.h | 1 + src/htsweb.c | 87 ++++++++++++++++++++- src/webhttrack | 79 ++----------------- 32 files changed, 915 insertions(+), 2362 deletions(-) create mode 100644 html/server/ping.js create mode 100644 html/server/style.css diff --git a/html/Makefile.am b/html/Makefile.am index 26d82a4..605d6f0 100755 --- a/html/Makefile.am +++ b/html/Makefile.am @@ -20,7 +20,7 @@ HelpHtmldiv_DATA = div/search.sh HelpHtmlimg_DATA = img/* HelpHtmlimages_DATA = images/* HelpHtmlTxt_DATA = ../greetings.txt ../history.txt ../license.txt -WebHtml_DATA = server/*.html +WebHtml_DATA = server/*.html server/*.js server/*.css WebHtmlimages_DATA = server/images/* WebHtmlsfx_DATA = server/sfx/* # note: converted & normalized by @@ -41,6 +41,6 @@ EXTRA_DIST = $(HelpHtml_DATA) $(HelpHtmlimg_DATA) $(HelpHtmlimages_DATA) \ install-data-hook: if test ! -L $(DESTDIR)$(prefix)/share/httrack/html ; then \ ( cd $(DESTDIR)$(prefix)/share/httrack \ - && $(LN_S) $(htmldir) html \ + && $(LN_S) ../doc/httrack html \ ) \ fi diff --git a/html/Makefile.in b/html/Makefile.in index 5b8baf9..1a86bde 100644 --- a/html/Makefile.in +++ b/html/Makefile.in @@ -265,7 +265,7 @@ HelpHtmldiv_DATA = div/search.sh HelpHtmlimg_DATA = img/* HelpHtmlimages_DATA = images/* HelpHtmlTxt_DATA = ../greetings.txt ../history.txt ../license.txt -WebHtml_DATA = server/*.html +WebHtml_DATA = server/*.html server/*.js server/*.css WebHtmlimages_DATA = server/images/* WebHtmlsfx_DATA = server/sfx/* # note: converted & normalized by @@ -800,7 +800,7 @@ uninstall-am: uninstall-HelpHtmlDATA uninstall-HelpHtmlTxtDATA \ install-data-hook: if test ! -L $(DESTDIR)$(prefix)/share/httrack/html ; then \ ( cd $(DESTDIR)$(prefix)/share/httrack \ - && $(LN_S) $(htmldir) html \ + && $(LN_S) ../doc/httrack html \ ) \ fi diff --git a/html/server/about.html b/html/server/about.html index 82af482..2190ad2 100755 --- a/html/server/about.html +++ b/html/server/about.html @@ -6,79 +6,9 @@ '${projname}' - HTTrack Website Copier - + + @@ -131,7 +60,7 @@ ${do:if-file-exists:html/index.html} ${LANG_TIPHELP} ${do:end-if} @@ -142,18 +71,18 @@ ${do:end-if} - - - - - - + + + + + + - - - - - + + + + + @@ -167,62 +96,62 @@ ${do:end-if} - + ${LANG_I33}
${LANG_IOPT1}${LANG_IOPT2}${LANG_IOPT3}${LANG_IOPT4}${LANG_IOPT5}${LANG_IOPT11}${LANG_IOPT1}${LANG_IOPT2}${LANG_IOPT3}${LANG_IOPT4}${LANG_IOPT5}${LANG_IOPT11}
${LANG_IOPT6}${LANG_IOPT7}${LANG_IOPT8}${LANG_IOPT9}${LANG_IOPT10}${LANG_IOPT6}${LANG_IOPT7}${LANG_IOPT8}${LANG_IOPT9}${LANG_IOPT10}  
-
- +
+
${LANG_I38}
${LANG_I56}
${LANG_I66}
${LANG_I67}
${LANG_I57}
- - - +
- + + -
+ - - -
+ onMouseOver="info('${html:LANG_TIPOK}'); return true" onMouseOut="info(' '); return true" + > +
+ +
diff --git a/html/server/option2b.html b/html/server/option2b.html index ef6d0b2..6afd048 100755 --- a/html/server/option2b.html +++ b/html/server/option2b.html @@ -6,88 +6,17 @@ '${projname}' - HTTrack Website Copier - + + @@ -140,7 +73,7 @@ function no_refresh() { ${LANG_O1} @@ -152,7 +85,7 @@ ${do:if-file-exists:html/index.html} ${LANG_O5} @@ -198,8 +131,8 @@ ${do:end-if} - -
+ +
@@ -210,8 +143,8 @@ ${LANG_H20} ${info.currentjob}
- -
+ +
@@ -219,20 +152,20 @@ ${LANG_H20} ${info.currentjob} - - - - - - - - - - - - - - + + + + + + + + + + + + + +
${info.state[0]}${info.name[0]}${info.file[0]}${info.size[0]}/${info.sizetot[0]}
${info.state[1]}${info.name[1]}${info.file[1]}${info.size[1]}/${info.sizetot[1]}
${info.state[2]}${info.name[2]}${info.file[2]}${info.size[2]}/${info.sizetot[2]}
${info.state[3]}${info.name[3]}${info.file[3]}${info.size[3]}/${info.sizetot[3]}
${info.state[4]}${info.name[4]}${info.file[4]}${info.size[4]}/${info.sizetot[4]}
${info.state[5]}${info.name[5]}${info.file[5]}${info.size[5]}/${info.sizetot[5]}
${info.state[6]}${info.name[6]}${info.file[6]}${info.size[6]}/${info.sizetot[6]}
${info.state[7]}${info.name[7]}${info.file[7]}${info.size[7]}/${info.sizetot[7]}
${info.state[8]}${info.name[8]}${info.file[8]}${info.size[8]}/${info.sizetot[8]}
${info.state[9]}${info.name[9]}${info.file[9]}${info.size[9]}/${info.sizetot[9]}
${info.state[10]}${info.name[10]}${info.file[10]}${info.size[10]}/${info.sizetot[10]}
${info.state[11]}${info.name[11]}${info.file[11]}${info.size[11]}/${info.sizetot[11]}
${info.state[12]}${info.name[12]}${info.file[12]}${info.size[12]}/${info.sizetot[12]}
${info.state[13]}${info.name[13]}${info.file[13]}${info.size[13]}/${info.sizetot[13]}
${info.state[0]}${info.name[0]}${info.file[0]}${info.size[0]}/${info.sizetot[0]}
${info.state[1]}${info.name[1]}${info.file[1]}${info.size[1]}/${info.sizetot[1]}
${info.state[2]}${info.name[2]}${info.file[2]}${info.size[2]}/${info.sizetot[2]}
${info.state[3]}${info.name[3]}${info.file[3]}${info.size[3]}/${info.sizetot[3]}
${info.state[4]}${info.name[4]}${info.file[4]}${info.size[4]}/${info.sizetot[4]}
${info.state[5]}${info.name[5]}${info.file[5]}${info.size[5]}/${info.sizetot[5]}
${info.state[6]}${info.name[6]}${info.file[6]}${info.size[6]}/${info.sizetot[6]}
${info.state[7]}${info.name[7]}${info.file[7]}${info.size[7]}/${info.sizetot[7]}
${info.state[8]}${info.name[8]}${info.file[8]}${info.size[8]}/${info.sizetot[8]}
${info.state[9]}${info.name[9]}${info.file[9]}${info.size[9]}/${info.sizetot[9]}
${info.state[10]}${info.name[10]}${info.file[10]}${info.size[10]}/${info.sizetot[10]}
${info.state[11]}${info.name[11]}${info.file[11]}${info.size[11]}/${info.sizetot[11]}
${info.state[12]}${info.name[12]}${info.file[12]}${info.size[12]}/${info.sizetot[12]}
${info.state[13]}${info.name[13]}${info.file[13]}${info.size[13]}/${info.sizetot[13]}
@@ -246,10 +179,10 @@ ${LANG_H20} ${info.currentjob}
  -
diff --git a/html/server/step2.html b/html/server/step2.html index e2d74db..4f194dd 100755 --- a/html/server/step2.html +++ b/html/server/step2.html @@ -6,75 +6,8 @@ '${projname}' - HTTrack Website Copier - + +