Mercurial > hg > orthanc-education
changeset 79:aace2087ff7e
disable libcurl "Expect: 100-continue" header during LTI registration
| author | Sebastien Jodogne <s.jodogne@gmail.com> |
|---|---|
| date | Wed, 29 Apr 2026 13:57:52 +0200 |
| parents | a41499e72425 |
| children | 53b35f52cf45 |
| files | NEWS Sources/LTI/LTIRoutes.cpp |
| diffstat | 2 files changed, 17 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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)
--- 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);
