From 1a1e5be2c95f00a6f2a0ec7fe361c32868ad722e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Fri, 9 Aug 2019 10:34:46 +0200
Subject: [PATCH] Protocols.HTTP [do_async_proxied_method]: Use the correct
 callback.

HTTP protocol failures ahould be reported on the request_ok()
callback. The request_fail() callback is for connection failures.

Fixes [PIKE-198] some more.
---
 lib/modules/Protocols.pmod/HTTP.pmod/module.pmod | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/modules/Protocols.pmod/HTTP.pmod/module.pmod b/lib/modules/Protocols.pmod/HTTP.pmod/module.pmod
index e2857f24b7..71b9fd409b 100644
--- a/lib/modules/Protocols.pmod/HTTP.pmod/module.pmod
+++ b/lib/modules/Protocols.pmod/HTTP.pmod/module.pmod
@@ -388,14 +388,15 @@ protected void https_proxy_connect_ok(Protocols.HTTP.Query con,
 				      mapping(string:string) request_headers,
 				      string data)
 {
+  con->set_callbacks(@orig_cb_info);
   if (con->status >= 300) {
     // Proxy did not like us or failed to connect to the remote.
-    https_proxy_connect_fail(con, orig_cb_info, url, method,
-			     query_variables, request_headers,
-			     data);
+    // Return the failure message.
+    if (con->request_ok) {
+      con->request_ok(con, @con->extra_args);
+    }
     return;
   }
-  con->set_callbacks(@orig_cb_info);
 
   con->headers["connect"] = "keep-alive";
   con->headers["content-length"] = "0";
-- 
GitLab