Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
QueryR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julien Lopez
QueryR
Commits
19fd6712
Commit
19fd6712
authored
6 years ago
by
Tomas Stupka
Browse files
Options
Downloads
Plain Diff
[GR-5642] Make sure install.packages picks up proxy configuration.
PullRequest: fastr/1515
parents
89e847a3
be20ad6d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/REnvVars.java
+56
-13
56 additions, 13 deletions
....r.runtime/src/com/oracle/truffle/r/runtime/REnvVars.java
with
56 additions
and
13 deletions
com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/REnvVars.java
+
56
−
13
View file @
19fd6712
...
...
@@ -120,19 +120,62 @@ public final class REnvVars implements RContext.ContextState {
safeReadEnvironFile
(
userFile
);
}
}
// Check for http proxies
String
httpProxy
=
getEitherCase
(
"http_proxy"
);
if
(
httpProxy
!=
null
)
{
String
port
=
null
;
int
portIndex
=
httpProxy
.
lastIndexOf
(
':'
);
if
(
portIndex
>
0
)
{
port
=
httpProxy
.
substring
(
portIndex
+
1
);
httpProxy
=
httpProxy
.
substring
(
0
,
portIndex
);
}
httpProxy
=
httpProxy
.
replace
(
"http://"
,
""
);
System
.
setProperty
(
"http.proxyHost"
,
httpProxy
);
if
(
port
!=
null
)
{
System
.
setProperty
(
"http.proxyPort"
,
port
);
// Check for proxies
for
(
String
protocol
:
new
String
[]{
"http"
,
"https"
,
"ftp"
})
{
String
javaProxyHost
=
System
.
getProperty
(
protocol
+
".proxyHost"
);
if
(
javaProxyHost
!=
null
)
{
// if java proxy props are set, then let have them precedense over env settings
// storing in envVars ensures they get propagated to child processes
String
javaProxyPort
=
System
.
getProperty
(
protocol
+
".proxyPort"
);
envVars
.
put
(
protocol
+
"_proxy"
,
javaProxyHost
+
(
javaProxyPort
!=
null
?
":"
+
javaProxyPort
:
""
));
if
(
"http"
.
equals
(
protocol
)
||
"ftp"
.
equals
(
protocol
))
{
// necessary only for http and ftp - according to
// https://docs.oracle.com/javase/7/docs/api/java/net/doc-files/net-properties.html
// The HTTPS handler will use the same nonProxyHosts property
// as the HTTP protocol.
String
noProxy
=
System
.
getProperty
(
protocol
+
".no_proxy"
);
if
(
noProxy
!=
null
)
{
envVars
.
put
(
protocol
+
"_no_proxy"
,
noProxy
);
}
else
{
envVars
.
remove
(
protocol
+
"_no_proxy"
);
}
}
}
else
{
// if java properties aren't set, try to use the env values
String
proxy
=
getEitherCase
(
protocol
+
"_proxy"
);
if
(
proxy
!=
null
)
{
String
port
=
null
;
int
portIndex
=
proxy
.
lastIndexOf
(
':'
);
if
(
portIndex
>
0
)
{
port
=
proxy
.
substring
(
portIndex
+
1
);
proxy
=
proxy
.
substring
(
0
,
portIndex
);
}
// things like https_proxy='http://proxy-server:1234' are a valid case
// so always cleanup all protocal prefixes
proxy
=
proxy
.
replace
(
"http://"
,
""
).
replace
(
"https://"
,
""
).
replace
(
"ftp://"
,
""
);
System
.
setProperty
(
protocol
+
".proxyHost"
,
proxy
);
if
(
port
!=
null
)
{
System
.
setProperty
(
protocol
+
".proxyPort"
,
port
);
}
else
{
System
.
getProperties
().
remove
(
protocol
+
".proxyPort"
);
}
if
(
"http"
.
equals
(
protocol
)
||
"ftp"
.
equals
(
protocol
))
{
String
noProxy
=
getEitherCase
(
protocol
+
"_no_proxy"
);
if
(
noProxy
==
null
)
{
noProxy
=
getEitherCase
(
"no_proxy"
);
}
if
(
noProxy
!=
null
)
{
System
.
setProperty
(
protocol
+
".no_proxy"
,
noProxy
);
}
else
{
System
.
getProperties
().
remove
(
protocol
+
".no_proxy"
);
}
}
}
}
}
return
this
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment