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

Xmlrpc server returns content-length:0 for exceptions

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.4.3, 3.5
    • 3.4.4, 3.5.1
    • Hub, Web Services
    • MOODLE_34_STABLE, MOODLE_35_STABLE
    • MOODLE_34_STABLE, MOODLE_35_STABLE
    • wip-MDL-62584-master
    • 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

    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

              marina Marina Glancy
              marina Marina Glancy
              Andrew Lyons Andrew Lyons
              David Monllaó David Monllaó
              Bas Brands Bas Brands
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo, Juan Leyva, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                9/Jul/18