From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.bugs Subject: bug#15227: Possible bug in (web server) Date: Tue, 21 Jun 2016 11:49:04 +0200 Message-ID: <87inx23m9b.fsf@pobox.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1466502892 16843 80.91.229.3 (21 Jun 2016 09:54:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 21 Jun 2016 09:54:52 +0000 (UTC) Cc: 15227@debbugs.gnu.org To: Shane Celis Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Tue Jun 21 11:54:38 2016 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bFIO9-00070v-2h for guile-bugs@m.gmane.org; Tue, 21 Jun 2016 11:54:33 +0200 Original-Received: from localhost ([::1]:50274 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFIO5-0007KZ-AI for guile-bugs@m.gmane.org; Tue, 21 Jun 2016 05:54:29 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43045) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFIJw-000462-3z for bug-guile@gnu.org; Tue, 21 Jun 2016 05:50:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFIJr-0006Q9-BU for bug-guile@gnu.org; Tue, 21 Jun 2016 05:50:12 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36238) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFIJr-0006Pp-55 for bug-guile@gnu.org; Tue, 21 Jun 2016 05:50:07 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bFIJl-0004k8-Tv for bug-guile@gnu.org; Tue, 21 Jun 2016 05:50:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andy Wingo Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 21 Jun 2016 09:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15227 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 15227-submit@debbugs.gnu.org id=B15227.146650255518161 (code B ref 15227); Tue, 21 Jun 2016 09:50:01 +0000 Original-Received: (at 15227) by debbugs.gnu.org; 21 Jun 2016 09:49:15 +0000 Original-Received: from localhost ([127.0.0.1]:48575 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFIJ0-0004iq-Ng for submit@debbugs.gnu.org; Tue, 21 Jun 2016 05:49:15 -0400 Original-Received: from pb-sasl2.pobox.com ([64.147.108.67]:54310 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFIIz-0004ij-2O for 15227@debbugs.gnu.org; Tue, 21 Jun 2016 05:49:13 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-sasl2.pobox.com (Postfix) with ESMTP id B4DDC21D41; Tue, 21 Jun 2016 05:49:12 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=M+i3NYXVDYe5g5v7UFintv0fw2E=; b=q8gIbi Y4JisHRzr7veeUHhHLBwRtPFdvWFUMnN+VfgIV/yJnR6f7FXUgR2Lhk42Ugk0vmP 1U2qjplQt6bxZYAAqstcqUy7ggtQGbaWv9cNjkweaiP808hGLwgCKgFFB2jjczPy 3rmx62Q/qxOhO5EWMiOiCGFwipCQ+x+QyXWHQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=jIyzu3kbeFfuLB9ZffVnjqakmlryleWm mmiOCR4N8erqJSHbEauGX8HZ1E8YP6XFU/uiWocLSF8XTJizCyTDGCQxCOj/6L7l 6pNISqJlUi9v9sOs9SEdUcAK9fiD7PhLfRHF5fKNxda0DlhfM2entM23vhRbJiHi 8ctu/hv8Uc4= Original-Received: from pb-sasl2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-sasl2.pobox.com (Postfix) with ESMTP id AD6CE21D40; Tue, 21 Jun 2016 05:49:12 -0400 (EDT) Original-Received: from clucks (unknown [88.160.190.192]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by pb-sasl2.pobox.com (Postfix) with ESMTPSA id B313021D3E; Tue, 21 Jun 2016 05:49:11 -0400 (EDT) In-Reply-To: (Shane Celis's message of "Sat, 31 Aug 2013 03:11:10 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-Pobox-Relay-ID: 68423EF8-3795-11E6-AD09-28A6F1301B6D-02397024!pb-sasl2.pobox.com 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:8071 Archived-At: I don't really understand this bug. Ian's investigation isn't right, I don't think; the "delimited" port stuff from (web response) should make it correct to call get-bytevector-all on the response port. So I think there is not a client bug, but there may be a server bug on macOS. Can you retry on macOS with 2.0.11 and with 2.1.3 and see if the problem still exists? Thanks, Andy On Sat 31 Aug 2013 09:11, Shane Celis writes: > Hi all, > > I found a bug in (web server) on Mac OS X, and when I compared against GNU/Linux I seem to have found a bug in (web client) there. I've included a script and further details below. > > #!/usr/local/bin/guile \ > -e main -s > !# > ;; guile-web-server-osx-bug.scm > ;; > ;; This script demonstrates a possible bug in Guile's web server on > ;; Mac OS X. And it demonstrates a possible bug in Guile's web client > ;; on GNU/Linux. > ;; > ;; Problem > ;; ======= > ;; > ;; Using Guile's (web server) with an example program, I ran into the > ;; following issue on Mac OS X: If I ran > ;; "./guile-web-server-osx-bug.scm server" and pointed my browser at > ;; http://localhost:8080, the first request would work and be > ;; displayed in my browser. The second request would timeout. I > ;; compared this with Guile on GNU/Linux and found that the (web > ;; server) worked fine, but the (web client) did not seem to work. > ;; > ;; > ;; Reproduction > ;; ============ > ;; > ;; The script takes an argument "server" or "client [hostname/ip]". > ;; When run as a server, it will say hello with an incremented > ;; counter. When run as a client, it will grab a couple of known > ;; sites gnu.org, fsf.org, and then try localhost or the given > ;; hostname on port 8080 twice, because on Mac OS X I saw the web > ;; server work on the first request but not the second. The > ;; hostname/ip the client is contacting is presumed to be a Guile web > ;; server on the other end but doesn't have to be. > ;; > ;; If there were no bugs, this script should work like this: > ;; $ ./guile-web-server-osx-bug.scm server & > ;; Web server replied 'Hello World! 0'. > ;; Web server replied 'Hello World! 1'. > ;; > ;; $ ./guile-web-server-osx-bug.scm client > ;; Getting http://gnu.org... response #< [...] > ;; > ;; Getting http://fsf.org... response #< [...] > ;; > ;; Getting http://localhost:8080... response #< [...] > ;; > ;; Getting http://localhost:8080... response #< [...] > ;; > ;; Mac OS X bug > ;; ------------ > ;; > ;; Info > ;; ---- > ;; > ;; $ uname -a > ;; Darwin mbp13.local 12.4.0 Darwin Kernel Version 12.4.0: Wed May 1 17:57:12 PDT 2013; root:xnu-2050.24.15~1/RELEASE_X86_64 x86_64 > ;; > ;; $ bash ./build-aux/config.guess > ;; x86_64-apple-darwin12.4.0 > ;; > ;; $ guile --version > ;; guile (GNU Guile) 2.0.9 [...] > ;; > ;; $ ./config.status --config > ;; 'LDFLAGS=-L/opt/local/lib' 'CPPFLAGS=-I/opt/local/include' > ;; > ;; Running > ;; ------- > ;; > ;; $ ./guile-web-server-osx-bug.scm server > ;; Web server replied 'Hello World! 0'. > ;; > ;; -- > ;; > ;; $ ./guile-web-server-osx-bug.scm client > ;; Getting http://gnu.org... response #< [...] > ;; > ;; Getting http://fsf.org... response #< [...] > ;; > ;; Getting http://localhost:8080...SIGALRM called; timedout. > ;; > ;; If I try to connect to http://localhost:8080 through a web browser, > ;; it does not connect; however, the web server does report that it > ;; has replied. > ;; > ;; GNU/Linux bug > ;; ------------ > ;; > ;; Info > ;; ---- > ;; > ;; $ uname -a > ;; Linux debian 3.2.0-4-686-pae #1 SMP Debian 3.2.46-1 i686 GNU/Linux > ;; > ;; $ guile --version > ;; guile (GNU Guile) 2.0.9 [...] > ;; > ;; $ bash ./build-aux/config.guess > ;; i686-pc-linux-gnu > ;; > ;; $ ./config.status --config > ;; > ;; Running > ;; ------- > ;; > ;; $ ./guile-web-server-osx-bug.scm server > ;; Web server replied 'Hello World! 0'. > ;; > ;; --- > ;; > ;; $ ./guile-web-server-osx-bug.scm client > ;; Getting http://gnu.org... response #< [...] > ;; > ;; Getting http://fsf.org... response #< [...] > ;; > ;; Getting http://localhost:8080...SIGALRM called; timedout. > ;; > ;; If I try to connect to http://localhost:8080 through a web browser, > ;; it works fine; so it seems like the (web client) is not working on > ;; GNU/Linux and the (web server) is not working on Mac OS X. > ;; > > (use-modules (web server) > (web client) > (ice-9 optargs)) > > (define count 0) > > (define (hello-world-handler request request-body) > (let ((reply (format #f "Hello World! ~a" count))) > (set! count (1+ count)) > (format #t "Web server replied '~a'.~%" reply) > (values '((content-type . (text/plain))) > reply))) > > (define (start-server) > (run-server hello-world-handler 'http '(#:port 8080))) > > (define (check-url url) > (format #t "Getting ~a..." url) > (format #t " response ~a~%~%" (http-get url))) > > (define* (run-client #:optional (ip "localhost")) > (alarm 10) > ;; Test some URLs that should work. > (check-url "http://gnu.org") > (check-url "http://fsf.org") > ;; Try the web server's URL now twice. > (check-url (format #f "http://~a:8080" ip)) > (check-url (format #f "http://~a:8080" ip))) > > (sigaction SIGALRM (lambda (sig) > (format #t "SIGALRM called; timedout.~%") > (exit 1))) > > > (define (main args) > (unless (or (= 2 (length args)) > (= 3 (length args))) > (format (current-error-port) "Usage: ~a ~%" (car args)) > (exit 2)) > (cond > ((string= "server" (cadr args)) > (start-server)) > ((string= "client" (cadr args)) > (apply run-client (cddr args)))))