Fossil

Check-in [8466a15722]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Repeated clicks on the audio-captcha button cause it to start over. Change the title of 206 HTTP replies to "Partial Content".
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8466a1572259134179d933975c850008e0d8c6f5dfac2b007930b7f3b076474b
User & Date: drh 2020-03-18 15:03:49.526
Context
2020-03-18
17:25
Merged glob-docs branch down to trunk. ... (check-in: b45a985c86 user: wyoung tags: trunk)
15:09
Correct a statement that contradicts the first paragraph in the same section. ... (check-in: ce5925c202 user: florian tags: glob-docs)
15:03
Repeated clicks on the audio-captcha button cause it to start over. Change the title of 206 HTTP replies to "Partial Content". ... (check-in: 8466a15722 user: drh tags: trunk)
14:56
Try to make it easier for people to find the documentation on how to add new commands to the Fossil core. ... (check-in: 29c3e99d73 user: drh tags: trunk)
14:14
Change the HTTP reply status for range requests from "206 OK" to "206 Partial Content". ... (Closed-Leaf check-in: 8a1e1c9096 user: florian tags: audio-captcha)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/captcha.c.
558
559
560
561
562
563
564
565
566
567


568
569
570
571
572
573
574
/*
** Add a "Speak the captcha" button.
*/
void captcha_speakit_button(unsigned int uSeed, const char *zMsg){
  if( zMsg==0 ) zMsg = "Speak the text";
  @ <input type="button" value="%h(zMsg)" id="speakthetext">
  @ <script nonce="%h(style_nonce())">
  @ var x = document.getElementById("speakthetext")
  @ x.onclick = function(){
  @   var audio = new Audio("%R/captcha-audio/%u(uSeed)")


  @   audio.play();
  @ }
  @ </script>
}

/*
** WEBPAGE: test-captcha







|
|
|
>
>







558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
/*
** Add a "Speak the captcha" button.
*/
void captcha_speakit_button(unsigned int uSeed, const char *zMsg){
  if( zMsg==0 ) zMsg = "Speak the text";
  @ <input type="button" value="%h(zMsg)" id="speakthetext">
  @ <script nonce="%h(style_nonce())">
  @ document.getElementById("speakthetext").onclick = function(){
  @   var audio = window.fossilAudioCaptcha \
  @ || new Audio("%R/captcha-audio/%u(uSeed)");
  @   window.fossilAudioCaptcha = audio;
  @   audio.currentTime = 0;
  @   audio.play();
  @ }
  @ </script>
}

/*
** WEBPAGE: test-captcha
Changes to src/cgi.c.
277
278
279
280
281
282
283

284
285
286
287
288
289
290

  if( g.fullHttpReply ){
    if( rangeEnd>0
     && iReplyStatus==200 
     && fossil_strcmp(P("REQUEST_METHOD"),"GET")==0
    ){
      iReplyStatus = 206;

    }
    fprintf(g.httpOut, "HTTP/1.0 %d %s\r\n", iReplyStatus, zReplyStatus);
    fprintf(g.httpOut, "Date: %s\r\n", cgi_rfc822_datestamp(time(0)));
    fprintf(g.httpOut, "Connection: close\r\n");
    fprintf(g.httpOut, "X-UA-Compatible: IE=edge\r\n");
  }else{
    assert( rangeEnd==0 );







>







277
278
279
280
281
282
283
284
285
286
287
288
289
290
291

  if( g.fullHttpReply ){
    if( rangeEnd>0
     && iReplyStatus==200 
     && fossil_strcmp(P("REQUEST_METHOD"),"GET")==0
    ){
      iReplyStatus = 206;
      zReplyStatus = "Partial Content";
    }
    fprintf(g.httpOut, "HTTP/1.0 %d %s\r\n", iReplyStatus, zReplyStatus);
    fprintf(g.httpOut, "Date: %s\r\n", cgi_rfc822_datestamp(time(0)));
    fprintf(g.httpOut, "Connection: close\r\n");
    fprintf(g.httpOut, "X-UA-Compatible: IE=edge\r\n");
  }else{
    assert( rangeEnd==0 );