From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.dismail.de ( [192.168.2.1]) by mugam.systemreboot.net (OpenSMTPD) with ESMTPS id 7ca7a233 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Mon, 20 Jul 2026 14:26:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=20190914; bh=O9gYUr5dBZb D7l71GxP+YCHhgVXnRKNQldhjWHgkmVc=; h=date:subject:to:from; d=dismail.de; b=h/2t19z0OoIOXLNPTv475BqUqQglDw6/wb9pZnGgk1KL98W29fDu7O 4/byIhwG3oyfJqlOBFLLILw1qL0xKTKF/X4dIOSpOSek9Z64mCASN8DsURGquqR9t/PoKf SBg756ffx57RPkkIJYnhKfS/JIRxbs1Y3y7B3opM8rTQEHYid8oOiCb0UBK2HlubmyzFwl yhKY3+NoqdwkdTd2h+uP+2rayHht1vnITrAXmBgoMAEPUb63HpmRTqYhSEAOI4vihTTSMK e8RYu3ZgL8BzNE4H61iU8M7+KU1awC0ZXF+9N31TKmXgE7kCkePYh5Ijem56+OrhzbIbCc 95+HxlWg== Received: from smtp1.dismail.de ( [10.240.26.11]) by mx1.dismail.de (OpenSMTPD) with ESMTP id 9b0ce142 for ; Mon, 20 Jul 2026 16:26:28 +0200 (CEST) Received: from smtp1.dismail.de (localhost [127.0.0.1]) by smtp1.dismail.de (OpenSMTPD) with ESMTP id 3f6c9138 for ; Mon, 20 Jul 2026 16:26:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=20190914; bh=O9gYUr5dBZb D7l71GxP+YCHhgVXnRKNQldhjWHgkmVc=; h=date:subject:to:from; d=dismail.de; b=h/2t19z0OoIOXLNPTv475BqUqQglDw6/wb9pZnGgk1KL98W29fDu7O 4/byIhwG3oyfJqlOBFLLILw1qL0xKTKF/X4dIOSpOSek9Z64mCASN8DsURGquqR9t/PoKf SBg756ffx57RPkkIJYnhKfS/JIRxbs1Y3y7B3opM8rTQEHYid8oOiCb0UBK2HlubmyzFwl yhKY3+NoqdwkdTd2h+uP+2rayHht1vnITrAXmBgoMAEPUb63HpmRTqYhSEAOI4vihTTSMK e8RYu3ZgL8BzNE4H61iU8M7+KU1awC0ZXF+9N31TKmXgE7kCkePYh5Ijem56+OrhzbIbCc 95+HxlWg== Received: by dismail.de (OpenSMTPD) with ESMTPSA id f93c2c9b (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Mon, 20 Jul 2026 16:26:28 +0200 (CEST) From: jgart To: kaagum@systemreboot.net Subject: [PATCH] Remove #:streaming? #t from HTTP requests to fix JSON parsing Date: Mon, 20 Jul 2026 15:21:49 +0100 Message-ID: <20260720142610.1193079-1-jgart@dismail.de> X-Mailer: git-send-email 2.55.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Hi Arun, I ran into a bug where json-request would throw a JSON-invalid exception when talking to OpenAI-compatible APIs. The issue is that #:streaming? #t in http-request bypasses Guile's automatic content-encoding decompression (gzip) and chunked transfer decoding. So json->scm was receiving raw gzip-compressed bytes instead of the actual JSON text. The fix is straightforward: - Drop #:streaming? #t so http-request returns a clean, fully-decoded bytevector. - Switch from json->scm (port-based) to json-string->scm (string-based), decoding the bytevector with utf8->string. - Remove the set-port-encoding! call since we no longer work with a port. I also noticed that openai-models was working around this with an accept-encoding: identity header. That workaround is no longer needed once Guile handles decompression normally? Thanks, jgart