]> git.ipfire.org Git - thirdparty/openssl.git/blobdiff - crypto/http/http_client.c
Don't exclude quite so much in a no-sock build
[thirdparty/openssl.git] / crypto / http / http_client.c
index 2649723c61d1bf4c1423c7f3970c12f57dc868f2..124fed0c9de7b2cbda1cfdf0bd7ebd1aec377020 100644 (file)
@@ -715,6 +715,7 @@ static BIO *HTTP_new_bio(const char *server, const char *server_port,
  end:
     return cbio;
 }
+#endif /* OPENSSL_NO_SOCK */
 
 static ASN1_VALUE *BIO_mem_d2i(BIO *mem, const ASN1_ITEM *it)
 {
@@ -744,7 +745,7 @@ static BIO *OSSL_HTTP_REQ_CTX_transfer(OSSL_HTTP_REQ_CTX *rctx)
         /* BIO_should_retry was true */
         sending = 0;
         /* will not actually wait if rctx->max_time == 0 */
-        if (BIO_wait(rctx->rbio, rctx->max_time) <= 0)
+        if (BIO_wait(rctx->rbio, rctx->max_time, 100 /* milliseconds */) <= 0)
             return NULL;
     }
 
@@ -840,8 +841,13 @@ BIO *OSSL_HTTP_transfer(const char *server, const char *port, const char *path,
 
     if (bio != NULL)
         cbio = bio;
-    else if ((cbio = HTTP_new_bio(server, port, proxy, proxy_port)) == NULL)
+    else
+#ifndef OPENSSL_NO_SOCK
+        if ((cbio = HTTP_new_bio(server, port, proxy, proxy_port)) == NULL)
+            return NULL;
+#else
         return NULL;
+#endif
 
     (void)ERR_set_mark(); /* prepare removing any spurious libssl errors */
     if (rbio == NULL && BIO_connect_retry(cbio, timeout) <= 0)
@@ -1106,9 +1112,9 @@ int OSSL_HTTP_proxy_connect(BIO *bio, const char *server, const char *port,
     char *mbuf = OPENSSL_malloc(BUF_SIZE);
     char *mbufp;
     int read_len = 0;
-    int rv;
     int ret = 0;
     BIO *fbio = BIO_new(BIO_f_buffer());
+    int rv;
     time_t max_time = timeout > 0 ? time(NULL) + timeout : 0;
 
     if (bio == NULL || server == NULL || port == NULL
@@ -1168,7 +1174,7 @@ int OSSL_HTTP_proxy_connect(BIO *bio, const char *server, const char *port,
 
     for (;;) {
         /* will not actually wait if timeout == 0 */
-        rv = BIO_wait(fbio, max_time);
+        rv = BIO_wait(fbio, max_time, 100 /* milliseconds */);
         if (rv <= 0) {
             BIO_printf(bio_err, "%s: HTTP CONNECT %s\n", prog,
                        rv == 0 ? "timed out" : "failed waiting for data");
@@ -1238,4 +1244,3 @@ int OSSL_HTTP_proxy_connect(BIO *bio, const char *server, const char *port,
 # undef BUF_SIZE
 }
 
-#endif /* !defined(OPENSSL_NO_SOCK) */