From f90e0d408f7e9cc618a8f0391f69cee2948644ac Mon Sep 17 00:00:00 2001
From: Martin Nilsson <mani@lysator.liu.se>
Date: Wed, 16 Jan 2002 02:18:46 +0100
Subject: [PATCH] Fixes [bug 2563] by not sending a third argument to
 Stdio.File->connect(). Connect no longer catches thrown errors. Should now
 compile without SSL installed.

Rev: lib/modules/Protocols.pmod/HTTP.pmod/Query.pike:1.38
---
 .../Protocols.pmod/HTTP.pmod/Query.pike       | 23 +++++++++++--------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/lib/modules/Protocols.pmod/HTTP.pmod/Query.pike b/lib/modules/Protocols.pmod/HTTP.pmod/Query.pike
index 00f3626cb5..1a0b965918 100644
--- a/lib/modules/Protocols.pmod/HTTP.pmod/Query.pike
+++ b/lib/modules/Protocols.pmod/HTTP.pmod/Query.pike
@@ -30,8 +30,8 @@ int timeout=120; // seconds
 #if constant(SSL.sslfile) 
  import SSL.constants;
  SSL.sslfile ssl;
- int https=0;
 #endif
+int(0..1) https = 0;
 
 object con;
 string request;
@@ -109,18 +109,23 @@ static void connect(string server,int port,int blocking)
 #ifdef HTTP_QUERY_DEBUG
    werror("<- (connect %O:%d)\n",server,port);
 #endif
+
    int success;
-   if (catch { success = con->connect(server,port,blocking); } || !success)
-   {
-      if (!(errno=con->errno())) errno=22; /* EINVAL */
+   if(con->_fd)
+     success = con->connect(server, port);
+   else
+     success = con->connect(server, port, blocking);
+
+   if(!success) {
 #ifdef HTTP_QUERY_DEBUG
-      werror("<- (error %d)\n",errno);
+     werror("<- (connect error)\n");
 #endif
-      destruct(con);
-      con=0;
-      ok=0;
-      return;
+     destruct(con);
+     con = 0;
+     ok = 0;
+     return;
    }
+
 #ifdef HTTP_QUERY_DEBUG
    werror("<- %O\n",request);
 #endif
-- 
GitLab