Changeset 7687
- Timestamp:
- 2004-07-01T14:55:18+12:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/collection/DownloadJob.java
r7677 r7687 223 223 } 224 224 225 String proxy_url = ""; 225 226 // Determine if we have to use a proxy. 226 227 if(Gatherer.config.get("general.use_proxy", true)) { … … 240 241 } 241 242 if(user_pass.indexOf("@") != -1) { 242 // Write the use proxy command 243 command = command + "-e httpproxy=" + proxy_host + ":" + proxy_port + "/ --proxy-user=" + user_pass.substring(0, user_pass.indexOf("@")) + " --proxy-passwd=" + user_pass.substring(user_pass.indexOf("@") + 1) + " -Y on "; 244 243 String user_name = user_pass.substring(0, user_pass.indexOf("@")); 244 String user_pwd = user_pass.substring(user_pass.indexOf("@") + 1); 245 proxy_url = user_name+":"+user_pwd+"@"+proxy_host+":"+proxy_port+"/"; 246 // Write the use proxy command - we don't do this anymore, instead we set environment variables - hopefully these can't be spied on like the follwoing can (using ps) 247 //command = command + "-e httpproxy=" + proxy_host + ":" + proxy_port + "/ --proxy-user=" + user_pass.substring(0, user_pass.indexOf("@")) + " --proxy-passwd=" + user_pass.substring(user_pass.indexOf("@") + 1) + " -Y on "; 248 245 249 } 246 250 else { … … 249 253 } 250 254 251 // The user can eitherchoose to mirror all of the page requisites...255 // The user can choose to mirror all of the page requisites... 252 256 if(page_requisites) { 253 257 command = command + "-p "; 254 258 } 255 259 260 // Download files from other hosts 256 261 if(other_hosts) { 257 262 command = command + "-H "; … … 276 281 Gatherer.println("Cmd: " + command); 277 282 Runtime rt = Runtime.getRuntime(); 278 Process prcs = rt.exec(command, null, dest_file); 283 String [] env = null; 284 if (!proxy_url.equals("")) { 285 env = new String[2]; 286 env[0] = "http_proxy=http://"+proxy_url; 287 env[1] = "ftp_proxy=ftp://"+proxy_url; 288 } 289 Process prcs = rt.exec(command, env, dest_file); 279 290 InputStreamReader isr = new InputStreamReader(prcs.getErrorStream()); 280 291 BufferedReader br = new BufferedReader(isr); … … 367 378 Gatherer.g_man.refreshWorkspaceTree(WorkspaceTree.DOWNLOADED_FILES_CHANGED); 368 379 } 369 380 381 370 382 /** The most important part of the DownloadJob class, this method is 371 383 * responsible for calling the WGet native methods used to
Note:
See TracChangeset
for help on using the changeset viewer.