[cpp-sp] branch main updated: CPPSP-63 Chunked IO has stopped working for WinHttp

Codeberg noreply at shibboleth.net
Sun Aug 23 14:05:56 UTC 2026


This is an automated email from the git hooks/post-receive script.

codeberg pushed a commit to branch main
in repository cpp-sp.

View the commit online:
https://codeberg.org/Shibboleth/cpp-sp/commit/12abc6ae34f48cdcbdb2eb456c2898a7dbdcbdfe

The following commit(s) were added to refs/heads/main by this push:
     new 12abc6ae CPPSP-63 Chunked IO has stopped working for WinHttp
12abc6ae is described below

commit 12abc6ae34f48cdcbdb2eb456c2898a7dbdcbdfe
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Fri Aug 21 15:34:26 2026 +0100

    CPPSP-63 Chunked IO has stopped working for WinHttp
    
    https://shibboleth.atlassian.net/browse/CPPSP-63
    
    Fixed and re-enabled
---
 shibsp/remoting/impl/WinHTTPRemotingService.cpp | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/shibsp/remoting/impl/WinHTTPRemotingService.cpp b/shibsp/remoting/impl/WinHTTPRemotingService.cpp
index 5d9a0019..5eebe4df 100644
--- a/shibsp/remoting/impl/WinHTTPRemotingService.cpp
+++ b/shibsp/remoting/impl/WinHTTPRemotingService.cpp
@@ -465,7 +465,6 @@ void WinHTTPRemotingService::send(const char* path, istream& input, ostream& out
         throw RemotingException("Send failed");
     }
 
-#if 0
     //
     // As per CPPSP=73, chunked IO has regressed (when tested against the test harness)
     //
@@ -482,7 +481,7 @@ void WinHTTPRemotingService::send(const char* path, istream& input, ostream& out
         DWORD written;
         while (input) {
             //
-            // This is a pain - we have to do the chunking by hand so we send the chunky bit, then the data, end the end of chucky bit
+            // This is a pain - we have to do the chunking by hand so we send the chunky bit, then the data, end the end of chunky bit
             //
             char buf[1024];
             char chunkString[128];
@@ -492,29 +491,38 @@ void WinHTTPRemotingService::send(const char* path, istream& input, ostream& out
             DWORD chunkStringLen = static_cast<DWORD>(strnlen_s(chunkString, sizeof(chunkString)));
 
             m_log.debug("Sending chunk with %d bytes to %s", transferSize, path);
+            // chunky bit for <chunkSringLen> bytes
             if (!WinHttpWriteData(request, chunkString, chunkStringLen, &written)) {
                 m_log.crit("Send. Failed to send chunk header to %s : %d", path, GetLastError());
                 throw RemotingException("Send failed");
             }
+            // data
             if (!WinHttpWriteData(request, buf, transferSize, &written)) {
                 m_log.crit("Send. Failed to send chunk data to %s : %d", path, GetLastError());
                 throw RemotingException("Send failed");
             }
+            // terminator
             if (!WinHttpWriteData(request, "\r\n", 2, &written)) {
                 m_log.crit("Send. Failed to send chunk trailer to %s : %d", path, GetLastError());
                 throw RemotingException("Send failed");
             }
         }
         //
-        // And when all gthe data is gone we say that the last chunk is zero long
+        // And when all the data is gone we say that the last chunk is zero long
         //
+        // chunky bit for 0 bytes
         if (!WinHttpWriteData(request, "0\r\n", 3, &written)) {
             m_log.crit("Send. Failed to send chunk header to %s : %d", path, GetLastError());
             throw RemotingException("Send failed");
         }
-    } else 
-#endif
-    {
+        //
+        // [no] data
+        // terminator
+        if (!WinHttpWriteData(request, "\r\n", 2, &written)) {
+            m_log.crit("Send. Failed to send chunk header to %s : %d", path, GetLastError());
+            throw RemotingException("Send failed");
+        }
+    } else {
         //
         // Just buffer up all the data and send it in a wunner
         //
@@ -637,7 +645,7 @@ void WinHTTPRemotingService::handleCipher(HINTERNET handle) const
     if (cipher.empty())
         return;
 
-    m_log.debug("cipher presented : {} ", cipher);
+    m_log.debug("cipher presented : %s ", cipher);
 
     if (secinfo.ConnectionInfo.dwProtocol == SP_PROT_TLS1_2_CLIENT) {
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list