From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.bugs Subject: bug#32528: http-post breaks with XML response payload containing boundary Date: Tue, 28 Aug 2018 17:51:14 -0400 Message-ID: <87bm9mf9d9.fsf@netris.org> References: <874lfiltkg.fsf@elephly.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1535493079 25313 195.159.176.226 (28 Aug 2018 21:51:19 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 28 Aug 2018 21:51:19 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Cc: 32528@debbugs.gnu.org To: Ricardo Wurmus Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Tue Aug 28 23:51:14 2018 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fultI-0006Oy-2I for guile-bugs@m.gmane.org; Tue, 28 Aug 2018 23:51:12 +0200 Original-Received: from localhost ([::1]:40177 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fulvO-0006EA-9B for guile-bugs@m.gmane.org; Tue, 28 Aug 2018 17:53:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59907) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fulvC-0006Ca-1P for bug-guile@gnu.org; Tue, 28 Aug 2018 17:53:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fulv5-0005mG-Mu for bug-guile@gnu.org; Tue, 28 Aug 2018 17:53:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:59323) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fulv4-0005lP-RT for bug-guile@gnu.org; Tue, 28 Aug 2018 17:53:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fulv4-0005co-OY for bug-guile@gnu.org; Tue, 28 Aug 2018 17:53:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mark H Weaver Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 28 Aug 2018 21:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32528 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 32528-submit@debbugs.gnu.org id=B32528.153549317621602 (code B ref 32528); Tue, 28 Aug 2018 21:53:02 +0000 Original-Received: (at 32528) by debbugs.gnu.org; 28 Aug 2018 21:52:56 +0000 Original-Received: from localhost ([127.0.0.1]:36107 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fulux-0005cM-Sv for submit@debbugs.gnu.org; Tue, 28 Aug 2018 17:52:56 -0400 Original-Received: from world.peace.net ([64.112.178.59]:36358) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fuluw-0005cA-Nw for 32528@debbugs.gnu.org; Tue, 28 Aug 2018 17:52:54 -0400 Original-Received: from mhw by world.peace.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1fuluq-0006CE-SR; Tue, 28 Aug 2018 17:52:48 -0400 In-Reply-To: <874lfiltkg.fsf@elephly.net> (Ricardo Wurmus's message of "Sat, 25 Aug 2018 10:49:19 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.org gmane.lisp.guile.bugs:9138 Archived-At: Ricardo Wurmus writes: > I=E2=80=99m having a problem with http-post and I think it might be a bug= . I=E2=80=99m > talking to a Debbugs SOAP service over HTTP by sending (via POST) an XML > request. The Debbugs SOAP service responds with a string of XML. > > Here=E2=80=99s a simplified version of what I do: > > (use-module (web http)) > (let ((req-xml "")) > (receive (response body) > (http-post uri > #:body req-xml > #:headers > `((content-type . (text/xml)) > (content-length . ,(string-length req-xml)))) > ;; Do something with the response body > (xml->sxml body #:trim-whitespace? #t))) > > This fails for some requests with an error like this: > > web/http.scm:1609:23: Bad Content-Type header: multipart/related; typ= e=3D"text/xml"; start=3D""; boundary=3D"=3D-=3D-=3D" [...] > The reason why it fails is that Guile processes the response and treats > the *payload* contained in the XML response as HTTP. No, this was a good guess, but it's not actually the problem. If you add --save-headers to the wget command line, you'll see the full response, and the HTTP headers are what's being parsed, as it should be. It looks like this (except that I removed the carriage returns below): HTTP/1.1 200 OK Date: Tue, 28 Aug 2018 21:40:30 GMT Server: Apache SOAPServer: SOAP::Lite/Perl/1.11 Strict-Transport-Security: max-age=3D63072000 Content-Length: 32650 X-Content-Type-Options: nosniff X-Frame-Options: sameorigin X-XSS-Protection: 1; mode=3Dblock Keep-Alive: timeout=3D5, max=3D100 Connection: Keep-Alive Content-Type: multipart/related; type=3D"text/xml"; start=3D""; boundary=3D"=3D-=3D-=3D" =20=20