changeset 392:faad1c51c289 plus

part 4 == body for RESP working
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Mon, 22 Jun 2026 16:00:02 +0100
parents b9b301fd064d
children e6d945a287a0
files lib/python/cc/iwarc.py
diffstat 1 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/lib/python/cc/iwarc.py	Mon Jun 22 15:58:51 2026 +0100
+++ b/lib/python/cc/iwarc.py	Mon Jun 22 16:00:02 2026 +0100
@@ -117,17 +117,17 @@
           eob = bp + length
           while buf.startswith(b'\r\n', eob - 2):
             eob -= 2
-          # Only output parts (2 = HTTP header, 4 = body) that are wanted
-          if parts & 2:
-            if wtype == RESP or wtype == REQ :
-              # request and response have http headers
-              eo2 = buf.index(b'\r\n\r\n', start_2)
+          # Only output parts (2 = CC-info|HTTP header, 4 = HTTP body) if wanted
+          if wtype == RESP :
+            # response has body as well as out/in http headers
+            eo2 = buf.index(b'\r\n\r\n', start_2)
+            if parts & 2:
               _out = callback(wtype, bufView[start_2:eo2 + 2], 2)
-            else:
-              # rest of the part
-              _out = callback(wtype, bufView[start_2:eob], 2)
-          if (wtype == RESP) and parts & 4:
-            _out = callback(wtype, bufView[eo2 + 4:eob], 4)
+            if parts & 4:
+              _out = callback(wtype, bufView[eo2 + 4:eob], 4)
+          elif parts & 2:
+            # anything else gets the whole rest of the part
+            _out = callback(wtype, bufView[start_2:eob], 2)
             #raise ValueError("Not implemented: body part (4): %s"%parts)
     #bp += length
     #if buf[bp] != 13: