Changeset 6943
- Timestamp:
- 03/26/10 17:27:33 (3 years ago)
- Location:
- trunk/core/lib
- Files:
-
- 2 edited
-
Foswiki.spec (modified) (2 diffs)
-
Foswiki/Net.pm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/core/lib/Foswiki.spec
r6932 r6943 1179 1179 # Some environments require outbound HTTP traffic to go through a proxy 1180 1180 # server. (e.g. http://proxy.your.company). 1181 # <b>CAUTION</b> This setting can be overridden by a %PROXYHOST% setting 1182 # in SitePreferences. Make sure you delete the setting from there. 1181 # <b>CAUTION</b> This setting can be overridden by a PROXYHOST setting 1182 # in SitePreferences. Make sure you delete the setting from there if 1183 # you are using a SitePreferences topic from a previous release of Foswiki. 1184 # If your proxy requires authentication, simply put it in the URL, as in: 1185 # http://username:password@proxy.your.company. 1183 1186 $Foswiki::cfg{PROXY}{HOST} = ''; 1184 1187 … … 1186 1189 # Some environments require outbound HTTP traffic to go through a proxy 1187 1190 # server. Set the port number here (e.g: 8080). 1188 # <b>CAUTION</b> This setting can be overridden by a %PROXYPORT% setting 1189 # in SitePreferences. Make sure you delete the setting from there. 1191 # <b>CAUTION</b> This setting can be overridden by a PROXYPORT setting 1192 # in SitePreferences. Make sure you delete the setting from there if you 1193 # are using a SitePreferences topic from a previous release of Foswiki. 1190 1194 $Foswiki::cfg{PROXY}{PORT} = ''; 1191 1195 -
trunk/core/lib/Foswiki/Net.pm
r6761 r6943 165 165 $proxyPort = $prefs->getPreference('PROXYPORT'); 166 166 } 167 $proxyHost ||= $Foswiki::cfg{PROXY}{HOST}; 168 $proxyPort ||= $Foswiki::cfg{PROXY}{PORT}; 167 168 # Do not use || so user can disable proxy using preferences 169 $proxyHost = $Foswiki::cfg{PROXY}{HOST} unless defined $proxyHost; 170 $proxyPort = $Foswiki::cfg{PROXY}{PORT} unless defined $proxyPort; 169 171 if ( $proxyHost && $proxyPort ) { 172 my ( $proxyUser, $proxyPass ); 173 if ( $proxyHost =~ m#^http://(?:(.*?)(?::(.*?))?@)?(.*)(?::(\d+))?/*# ) { 174 $proxyUser = $1; 175 $proxyPass = $2; 176 $proxyHost = $3; 177 $proxyPort = $4 if defined $4; 178 } else { 179 require Foswiki::Net::HTTPResponse; 180 return new Foswiki::Net::HTTPResponse( 181 "Proxy settings are invalid, check configure ($proxyHost)"); 182 } 170 183 $req = "GET http://$host:$port$url HTTP/1.0\r\n"; 171 184 $host = $proxyHost; 172 185 $port = $proxyPort; 186 if ($proxyUser) { 187 require MIME::Base64; 188 import MIME::Base64(); 189 my $base64 = encode_base64( "$proxyUser:$proxyPass", "\r\n" ); 190 $req .= "Proxy-Authorization: Basic $base64"; 191 } 173 192 } 174 193
Note: See TracChangeset
for help on using the changeset viewer.
