From: Andy Wingo <wingo@pobox.com>
To: Shane Celis <shane.celis@gmail.com>
Cc: 15227@debbugs.gnu.org
Subject: bug#15227: Possible bug in (web server)
Date: Tue, 21 Jun 2016 11:49:04 +0200 [thread overview]
Message-ID: <87inx23m9b.fsf@pobox.com> (raw)
In-Reply-To: <CB238240-1C7E-4703-B8DB-733764230E5F@gmail.com> (Shane Celis's message of "Sat, 31 Aug 2013 03:11:10 -0400")
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 <shane.celis@gmail.com> 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 #<<response> [...]
> ;;
> ;; Getting http://fsf.org... response #<<response> [...]
> ;;
> ;; Getting http://localhost:8080... response #<<response> [...]
> ;;
> ;; Getting http://localhost:8080... response #<<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 #<<response> [...]
> ;;
> ;; Getting http://fsf.org... response #<<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 #<<response> [...]
> ;;
> ;; Getting http://fsf.org... response #<<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 <server|client [ip]>~%" (car args))
> (exit 2))
> (cond
> ((string= "server" (cadr args))
> (start-server))
> ((string= "client" (cadr args))
> (apply run-client (cddr args)))))
next prev parent reply other threads:[~2016-06-21 9:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-31 7:11 bug#15227: Possible bug in (web server) Shane Celis
2013-09-13 13:36 ` Ian Price
2016-06-21 9:49 ` Andy Wingo [this message]
2017-04-29 20:38 ` Matt Wette
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87inx23m9b.fsf@pobox.com \
--to=wingo@pobox.com \
--cc=15227@debbugs.gnu.org \
--cc=shane.celis@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).