Fossil SCM

Repeated clicks on the audio-captcha button cause it to start over. Change the title of 206 HTTP replies to "Partial Content".

drh 2020-03-18 15:03 trunk merge
Commit 8466a1572259134179d933975c850008e0d8c6f5dfac2b007930b7f3b076474b
2 files changed +5 -3 +1
+5 -3
--- src/captcha.c
+++ src/captcha.c
@@ -560,13 +560,15 @@
560560
*/
561561
void captcha_speakit_button(unsigned int uSeed, const char *zMsg){
562562
if( zMsg==0 ) zMsg = "Speak the text";
563563
@ <input type="button" value="%h(zMsg)" id="speakthetext">
564564
@ <script nonce="%h(style_nonce())">
565
- @ var x = document.getElementById("speakthetext")
566
- @ x.onclick = function(){
567
- @ var audio = new Audio("%R/captcha-audio/%u(uSeed)")
565
+ @ document.getElementById("speakthetext").onclick = function(){
566
+ @ var audio = window.fossilAudioCaptcha \
567
+ @ || new Audio("%R/captcha-audio/%u(uSeed)");
568
+ @ window.fossilAudioCaptcha = audio;
569
+ @ audio.currentTime = 0;
568570
@ audio.play();
569571
@ }
570572
@ </script>
571573
}
572574
573575
--- src/captcha.c
+++ src/captcha.c
@@ -560,13 +560,15 @@
560 */
561 void captcha_speakit_button(unsigned int uSeed, const char *zMsg){
562 if( zMsg==0 ) zMsg = "Speak the text";
563 @ <input type="button" value="%h(zMsg)" id="speakthetext">
564 @ <script nonce="%h(style_nonce())">
565 @ var x = document.getElementById("speakthetext")
566 @ x.onclick = function(){
567 @ var audio = new Audio("%R/captcha-audio/%u(uSeed)")
 
 
568 @ audio.play();
569 @ }
570 @ </script>
571 }
572
573
--- src/captcha.c
+++ src/captcha.c
@@ -560,13 +560,15 @@
560 */
561 void captcha_speakit_button(unsigned int uSeed, const char *zMsg){
562 if( zMsg==0 ) zMsg = "Speak the text";
563 @ <input type="button" value="%h(zMsg)" id="speakthetext">
564 @ <script nonce="%h(style_nonce())">
565 @ document.getElementById("speakthetext").onclick = function(){
566 @ var audio = window.fossilAudioCaptcha \
567 @ || new Audio("%R/captcha-audio/%u(uSeed)");
568 @ window.fossilAudioCaptcha = audio;
569 @ audio.currentTime = 0;
570 @ audio.play();
571 @ }
572 @ </script>
573 }
574
575
+1
--- src/cgi.c
+++ src/cgi.c
@@ -279,10 +279,11 @@
279279
if( rangeEnd>0
280280
&& iReplyStatus==200
281281
&& fossil_strcmp(P("REQUEST_METHOD"),"GET")==0
282282
){
283283
iReplyStatus = 206;
284
+ zReplyStatus = "Partial Content";
284285
}
285286
fprintf(g.httpOut, "HTTP/1.0 %d %s\r\n", iReplyStatus, zReplyStatus);
286287
fprintf(g.httpOut, "Date: %s\r\n", cgi_rfc822_datestamp(time(0)));
287288
fprintf(g.httpOut, "Connection: close\r\n");
288289
fprintf(g.httpOut, "X-UA-Compatible: IE=edge\r\n");
289290
--- src/cgi.c
+++ src/cgi.c
@@ -279,10 +279,11 @@
279 if( rangeEnd>0
280 && iReplyStatus==200
281 && fossil_strcmp(P("REQUEST_METHOD"),"GET")==0
282 ){
283 iReplyStatus = 206;
 
284 }
285 fprintf(g.httpOut, "HTTP/1.0 %d %s\r\n", iReplyStatus, zReplyStatus);
286 fprintf(g.httpOut, "Date: %s\r\n", cgi_rfc822_datestamp(time(0)));
287 fprintf(g.httpOut, "Connection: close\r\n");
288 fprintf(g.httpOut, "X-UA-Compatible: IE=edge\r\n");
289
--- src/cgi.c
+++ src/cgi.c
@@ -279,10 +279,11 @@
279 if( rangeEnd>0
280 && iReplyStatus==200
281 && fossil_strcmp(P("REQUEST_METHOD"),"GET")==0
282 ){
283 iReplyStatus = 206;
284 zReplyStatus = "Partial Content";
285 }
286 fprintf(g.httpOut, "HTTP/1.0 %d %s\r\n", iReplyStatus, zReplyStatus);
287 fprintf(g.httpOut, "Date: %s\r\n", cgi_rfc822_datestamp(time(0)));
288 fprintf(g.httpOut, "Connection: close\r\n");
289 fprintf(g.httpOut, "X-UA-Compatible: IE=edge\r\n");
290

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button