- Timestamp:
- 2018-09-07T19:39:40+12:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/util/ProtocolPortProperties.java
r32429 r32432 60 60 private boolean supportsHttps = false; 61 61 private String defaultPortPropertyName = "localhost.port.http"; 62 private String localHttpURL; 62 63 63 64 // default protocol if multiple supported … … 86 87 public boolean hadError() { return errorCode != ALL_CORRECT; } 87 88 88 // Use 127.0.0.1 instead of localhost since localhost is unsafe (can be mapped 89 // to something other than 127.0.0.1). See https://letsencrypt.org/docs/certificates-for-localhost/ 89 // returns the local http base URL, something like http://127.0.0.1:<httpPort> 90 90 public String getLocalHttpBaseAddress() { 91 // httpPort is set during the constructor, 92 // so knowing httpPort, we can set the internal/local access http URL: 93 String portSuffix = httpPort.equals("80") ? "" : (":"+httpPort); 94 return "http://127.0.0.1"+portSuffix; 95 91 return localHttpURL; 96 92 } 93 97 94 98 95 // Constructor that will throw an Exception on ports/protocol configuration error or inconsistency … … 116 113 } 117 114 115 // Setting the internal/local access url, which has to be over http (see 116 // https://letsencrypt.org/docs/certificates-for-localhost/) 117 // localhost.server.http defaults to 127.0.0.1 instead of localhost, since 118 // localhost is unsafe as it can be mapped to something other than 127.0.0.1. 119 localHttpURL = "http://" + props.getProperty("localhost.server.http", "127.0.0.1"); 120 if(!httpPort.equals("80")) { 121 localHttpURL = localHttpURL + ":" + httpPort; 122 } 123 118 124 String supportedProtocols = props.getProperty("server.protocols"); 119 125 if(supportedProtocols == null || supportedProtocols.equals("")) {
Note:
See TracChangeset
for help on using the changeset viewer.