Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-62584

Xmlrpc server returns content-length:0 for exceptions

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.4.3, 3.5
    • Fix Version/s: 3.4.4, 3.5.1
    • Component/s: Hub, Web Services
    • Labels:
    • Testing Instructions:
      Hide
      1. Navigate to Site administration -> Plugins -> Web services
        1. Enable web services
        2. Enable the XML-RPC protocol
        3. Choose "Select a service"
          1. Add a custom service called Foo
          2. Follow "Add functions" link and add the "core_webservice_get_site_info" function
      2. Navigate to {{Site administration -> Plugins -> Authentication -> Manage authentication
        1. Enable the Web service authentication plugin
      3. Open your console and ensure that you are in the directory of your site
      4. Edit your config.php to set the wwwroot to "http://localhost:8080"
      5. Run the following your command line to run a local PHP server:

        php -S localhost:8080
        

      6. Open a second console window and run:

        curl -v --url "http://localhost:8080/webservice/xmlrpc/simpleserver.php?wsusername=USERNAME&wspassword=USERPASSWORD" --data "<?xml version=\"1.0\" encoding=\"utf-8\"?><methodCall><methodName>core_webservice_get_site_info</methodName><params> <param>  <value>   <array>    <data/>   </array>  </value> </param></params></methodCall>"
        

        1. Confirm you get a valid response in xml format
      7. Correct the username and password to any valid user and re-run
        1. Confirm you get a valid response in xml format
      Show
      Navigate to Site administration -> Plugins -> Web services Enable web services Enable the XML-RPC protocol Choose " Select a service " Add a custom service called Foo Follow " Add functions " link and add the " core_webservice_get_site_info " function Navigate to {{Site administration -> Plugins -> Authentication -> Manage authentication Enable the Web service authentication plugin Open your console and ensure that you are in the directory of your site Edit your config.php to set the wwwroot to " http://localhost:8080 " Run the following your command line to run a local PHP server: php -S localhost:8080 Open a second console window and run: curl -v --url "http://localhost:8080/webservice/xmlrpc/simpleserver.php?wsusername=USERNAME&wspassword=USERPASSWORD" --data "<?xml version=\"1.0\" encoding=\"utf-8\"?><methodCall><methodName>core_webservice_get_site_info</methodName><params> <param> <value> <array> <data/> </array> </value> </param></params></methodCall>" Confirm you get a valid response in xml format Correct the username and password to any valid user and re-run Confirm you get a valid response in xml format
    • Affected Branches:
      MOODLE_34_STABLE, MOODLE_35_STABLE
    • Fixed Branches:
      MOODLE_34_STABLE, MOODLE_35_STABLE
    • Pull 3.5 Branch:
      wip-MDL-62584-35
    • Pull Master Branch:
      wip-MDL-62584-master

      Description

      Moodle xmlrpc server returns content-length:0 header with non-empty content. For some reason https://moodle.net server strips out content completely in this case, probably because of the web-server (it uses nginx) or other software involved in page serving.

      This results with error not being returned to sites that try to register.

      Another challenge that this can not be reproduced in local/testing environments - header "content-legth:0" is just ignored and full response body is returned

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                marina Marina Glancy
                Reporter:
                marina Marina Glancy
                Peer reviewer:
                Andrew Nicols
                Integrator:
                David Monllaó
                Tester:
                Bas Brands
                Participants:
                Component watchers:
                David Mudrák (@mudrd8mz), Helen Foster, Juan Leyva, Jake Dallimore, Jun Pataleta
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  9/Jul/18