Moodle
  1. Moodle
  2. MDL-34068

chat daemon not sending response headers to browser. Breaks Firefox

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.18, 2.2, 2.2.5, 2.3.2, 2.4
    • Fix Version/s: 2.2.6, 2.3.3
    • Component/s: Chat
    • Labels:
    • Testing Instructions:
      Hide

      This issue must be tested with MDL-27398 integrated and with different browsers (the issue was reported with FireFox)

      1. In Admin tree -> Plugins -> Activity modules -> Chat, select "Chat server daemon" as chat method
      2. Go to a course and create a chat activity instance
      3. Go to the chat instance and follow "Click here to enter the chat now"
      4. You SHOULD be able to see a popup divided in 3 parts, you SHOULD NOT see as plain text (with HTML tags) in the upper-left side, you SHOULD see the user picture
      Show
      This issue must be tested with MDL-27398 integrated and with different browsers (the issue was reported with FireFox) In Admin tree -> Plugins -> Activity modules -> Chat, select "Chat server daemon" as chat method Go to a course and create a chat activity instance Go to the chat instance and follow "Click here to enter the chat now" You SHOULD be able to see a popup divided in 3 parts, you SHOULD NOT see as plain text (with HTML tags) in the upper-left side, you SHOULD see the user picture
    • Affected Branches:
      MOODLE_19_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-34068_master
    • Rank:
      42373

      Description

      When you run the chat daemon, which uses a frameset, the main chat area, (where messages appear, i.e., win=chat) does not send out a response header. Proper response headers are sent for the sidekick frames (message, beep, and user). The user sees the underlying html exposed in Firefox. Firefox treats the output in quirks mode and as text/plain not text/html. IE Chrome appear to be more forgiving.

      I tracked this down using Fiddler, Firefox' Live Headers add-on and by looking at the Firefox cache (about:cache).

      As a partial fix, I added an HTTP response block beginning on line 532 of chatd.php. However, this may cause some of the sidebars to send the header response twice.

      chatd.php
      $this->dismiss_half($sessionid, false);
      
              // new block begins here
      
              $header  = "HTTP/1.1 200 OK\n";
              $header .= "Date: ".date('r')."\n";
              $header .= "Server: Moodle\n";
              $header .= "Content-Type: text/html; charset=utf-8\n";
              $header .= "Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT\n";
              $header .= "Cache-Control: no-cache, must-revalidate\n";
              $header .= "Expires: Wed, 4 Oct 1978 09:32:45 GMT\n";
              $header .= "\n";
              $this->write_data($this->conn_sets[$sessionid][CHAT_CONNECTION_CHANNEL], $header);
      
              // new block ends here
      
              $this->write_data($this->conn_sets[$sessionid][CHAT_CONNECTION_CHANNEL], $CHAT_HTMLHEAD_JS);
      

        Issue Links

          Activity

          Hide
          Matteo Scaramuccia added a comment -

          FYI: this has been discussed in http://moodle.org/mod/forum/discuss.php?d=205471, before filing the issue.

          Show
          Matteo Scaramuccia added a comment - FYI: this has been discussed in http://moodle.org/mod/forum/discuss.php?d=205471 , before filing the issue.
          Hide
          Michael de Raadt added a comment -

          It looks like this is still probably a problem with the current version.

          Show
          Michael de Raadt added a comment - It looks like this is still probably a problem with the current version.
          Hide
          David Monllaó added a comment -

          Thanks Paul for reporting the issue and providing a solution.

          I've added text/html headers to the new connection output, but I can't see any duplicate response header in any of the other frames, each of them has it's own header and this new addition does not conflict. I avoid investing more efforts in this issue (refactoring code I mean) because, if it has to be done, should be part of a general cleanup of the chat daemon code.

          Show
          David Monllaó added a comment - Thanks Paul for reporting the issue and providing a solution. I've added text/html headers to the new connection output, but I can't see any duplicate response header in any of the other frames, each of them has it's own header and this new addition does not conflict. I avoid investing more efforts in this issue (refactoring code I mean) because, if it has to be done, should be part of a general cleanup of the chat daemon code.
          Hide
          Rossiani Wijaya added a comment -

          This looks good.

          +1 for integration.

          Show
          Rossiani Wijaya added a comment - This looks good. +1 for integration.
          Hide
          David Monllaó added a comment -

          Thanks Rossie

          Show
          David Monllaó added a comment - Thanks Rossie
          Hide
          Eloy Lafuente (stronk7) added a comment -

          The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

          TIA and ciao

          Show
          Eloy Lafuente (stronk7) added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
          Hide
          David Monllaó added a comment -

          Rebased

          Show
          David Monllaó added a comment - Rebased
          Hide
          Aparup Banerjee added a comment -

          Thanks, thats been integrated.

          Show
          Aparup Banerjee added a comment - Thanks, thats been integrated.
          Hide
          Ankit Agarwal added a comment -

          Tested this with random browsers and themes. All working good.
          Thanks

          Show
          Ankit Agarwal added a comment - Tested this with random browsers and themes. All working good. Thanks
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Gutta cavat lapidem, non vi sed saepe cadendo - Ovidio

          This issue has been integrated upstream and is now available both via git and cvs (and in some hours, via mirrors and downloads).

          Thanks!

          Show
          Eloy Lafuente (stronk7) added a comment - Gutta cavat lapidem, non vi sed saepe cadendo - Ovidio This issue has been integrated upstream and is now available both via git and cvs (and in some hours, via mirrors and downloads). Thanks!

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: