From d74fcce9b98135042fd713180c587dff0239d6b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 12 Oct 2012 23:09:44 +0200 Subject: [PATCH] web: Pass `AI_NUMERICSERV' when given a port number. * module/web/client.scm (open-socket-for-uri)[addresses]: Pass AI_NUMERICSERV as the `getaddrinfo' hint when (uri-port URI) is true. --- module/web/client.scm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/module/web/client.scm b/module/web/client.scm index fcbfb153c..27458a4c6 100644 --- a/module/web/client.scm +++ b/module/web/client.scm @@ -44,10 +44,13 @@ (define (open-socket-for-uri uri) "Return an open input/output port for a connection to URI." (define addresses - (getaddrinfo (uri-host uri) - (cond - ((uri-port uri) => number->string) - (else (symbol->string (uri-scheme uri)))))) + (let ((port (uri-port uri))) + (getaddrinfo (uri-host uri) + (cond (port => number->string) + (else (symbol->string (uri-scheme uri)))) + (if port + AI_NUMERICSERV + 0)))) (let loop ((addresses addresses)) (let* ((ai (car addresses))