Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

outgoing_http: Don't try to use non-existent Smokescreen in dev.

Alex Vandiver40c9f741a281
diff --git a/zerver/lib/outgoing_http.py b/zerver/lib/outgoing_http.py
index 2dadf2b90f8..9e77eb82a43 100644
--- a/zerver/lib/outgoing_http.py
+++ b/zerver/lib/outgoing_http.py
@@ -1,6 +1,7 @@
from typing import Any
import requests
+from django.conf import settings
from typing_extensions import override
from urllib3.util import Retry
@@ -40,7 +41,7 @@ class OutgoingSession(requests.Session):
if headers:
self.headers.update(headers)
- if proxies is None:
+ if proxies is None and not settings.DEVELOPMENT:
proxy_host = get_config("http_proxy", "host", "localhost")
proxy_port = get_config("http_proxy", "port", "4750")
proxy = ""
@@ -52,7 +53,7 @@ class OutgoingSession(requests.Session):
"https": proxy,
}
)
- else:
+ elif proxies is not None:
self.proxies.update(proxies)
diff --git a/zerver/tests/test_outgoing_http.py b/zerver/tests/test_outgoing_http.py
index 89bcaf274ec..d1c22d067d1 100644
--- a/zerver/tests/test_outgoing_http.py
+++ b/zerver/tests/test_outgoing_http.py
@@ -4,6 +4,7 @@ from unittest import mock
import requests
import responses
+from django.test import override_settings
from requests.adapters import HTTPAdapter
from typing_extensions import override
from urllib3.util import Retry
@@ -44,6 +45,9 @@ class RequestMockWithTimeoutAsHeader(responses.RequestsMock):
return super()._on_request(adapter, request, **kwargs)
+# The general forcing of requests through Smokescreen only happens
+# when DEVELOPMENT=False
+@override_settings(DEVELOPMENT=False)
class TestOutgoingHttp(ZulipTestCase):
def test_headers(self) -> None:
with RequestMockWithProxySupport() as mock_requests: