Skip to content
This repository was archived by the owner on Mar 31, 2025. It is now read-only.

Commit e81ce63

Browse files
author
Fabian Zeller
committed
added https Proxy option and manual set Proxy
1 parent 60ce60d commit e81ce63

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

src/main/java/com/sybit/airtable/Airtable.java

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,17 @@ public Airtable configure(Configuration config, ObjectMapper objectMapper) throw
174174
return this;
175175
}
176176

177+
/**
178+
* Set Proxy Manually.
179+
*
180+
* @param proxy
181+
*/
182+
public void setProxyManual(String proxy){
183+
if(proxy != null && !proxy.isEmpty() && !proxy.equals(" ")){
184+
Unirest.setProxy(HttpHost.create(proxy));
185+
}
186+
}
187+
177188
/**
178189
* Set Proxy environment for Unirest.
179190
*
@@ -182,14 +193,20 @@ public Airtable configure(Configuration config, ObjectMapper objectMapper) throw
182193
*/
183194
private void setProxy(String endpointUrl) {
184195
final String httpProxy = System.getenv("http_proxy");
196+
final String httpsProxy = System.getenv("https_proxy");
185197
if(httpProxy != null
186198
&& (endpointUrl.contains("127.0.0.1")
187199
|| endpointUrl.contains("localhost"))) {
188200
LOG.info("Use Proxy: ignored for 'localhost' ann '127.0.0.1'");
189201
Unirest.setProxy(null);
190-
} else if(httpProxy != null) {
202+
} else if(httpsProxy != null
203+
&& (endpointUrl.contains("https"))) {
204+
LOG.info("Use Proxy: Environment variable 'https_proxy' found and used: " + httpsProxy);
205+
Unirest.setProxy(HttpHost.create(httpsProxy));
206+
} else if(httpProxy != null
207+
&& (endpointUrl.contains("http"))){
191208
LOG.info("Use Proxy: Environment variable 'http_proxy' found and used: " + httpProxy);
192-
Unirest.setProxy(HttpHost.create(httpProxy));
209+
Unirest.setProxy(HttpHost.create(httpProxy));
193210
} else {
194211
Unirest.setProxy(null);
195212
}

0 commit comments

Comments
 (0)