# HG changeset patch # User Sebastien Jodogne # Date 1777463872 -7200 # Node ID aace2087ff7ef2f74bcb573620418595a2ba21b7 # Parent a41499e72425aed7af59a08202ae7f4026c9b371 disable libcurl "Expect: 100-continue" header during LTI registration diff -r a41499e72425 -r aace2087ff7e NEWS --- a/NEWS Tue Apr 14 07:19:44 2026 +0200 +++ b/NEWS Wed Apr 29 13:57:52 2026 +0200 @@ -2,6 +2,8 @@ =============================== * Fix opening of viewers if Orthanc is not branched at the root of the server +* Disabled libcurl "Expect: 100-continue" header during LTI registration, + which is not properly handled by certain Moodle deployments Version 1.1 (2025-11-07) diff -r a41499e72425 -r aace2087ff7e Sources/LTI/LTIRoutes.cpp --- a/Sources/LTI/LTIRoutes.cpp Tue Apr 14 07:19:44 2026 +0200 +++ b/Sources/LTI/LTIRoutes.cpp Wed Apr 29 13:57:52 2026 +0200 @@ -544,10 +544,24 @@ { OrthancPlugins::HttpClient client; - client.SetTimeout(5); // 5 seconds to avoid freezing + client.SetTimeout(10); // 10 seconds to avoid freezing client.SetMethod(OrthancPluginHttpMethod_Post); client.SetUrl(Orthanc::SerializationToolbox::ReadString(platform, "registration_endpoint")); client.AddHeader("Authorization", "Bearer " + token); + client.AddHeader("Content-Type", Orthanc::EnumerationToString(Orthanc::MimeType_Json)); + + /** + * By default, libcurl adds an "Expect: 100-continue" header to + * POST/PUT requests, expecting the server to acknowledge before + * the body is sent. While this is valid HTTP/1.1 behavior, some + * infrastructures (notably certain Moodle deployments) do not + * handle this handshake correctly, resulting in the request body + * being received as empty. Explicitly setting "Expect" to an + * empty string disables this mechanism and causes the body to be + * sent immediately together with the headers. + **/ + client.AddHeader("Expect", ""); + client.SetBody(registration.toStyledString()); OrthancPlugins::HttpHeaders headers; client.Execute(headers, response);