Changeset 5319
- Timestamp:
- 2003-08-28T12:38:21+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/collection/Job.java
r4675 r5319 38 38 import java.awt.event.*; 39 39 import java.io.*; 40 import java.net.*; 40 41 import java.util.*; 41 42 import javax.swing.tree.*; … … 88 89 /** 89 90 */ 90 public Job(TreeModel model, boolean clobber, boolean debug, boolean no_parents, boolean other_hosts, boolean page_requisites, boolean quiet, GURL initial, int depth, String destination, String proxy_pass, String proxy_user, WGet mummy, boolean simple) {91 public Job(TreeModel model, boolean clobber, boolean debug, boolean no_parents, boolean other_hosts, boolean page_requisites, boolean quiet, URL initial, int depth, String destination, String proxy_pass, String proxy_user, WGet mummy, boolean simple) { 91 92 this.model = model; 92 93 … … 97 98 this.page_requisites = page_requisites; 98 99 this.quiet = quiet; 99 this.initial = initial;100 this.initial = new GURL(initial); 100 101 this.depth = depth; 101 102 this.destination = destination; … … 208 209 } 209 210 210 if(proxy_user != null) { 211 command = command + "--proxy-user=" + proxy_user 212 + " --proxy-passwd=" + proxy_pass + " "; 211 // Determine if we have to use a proxy. 212 if(Gatherer.config.get("general.use_proxy", true)) { 213 String proxy_host = Gatherer.config.getString("general.proxy_host", true); 214 String proxy_port = Gatherer.config.getString("general.proxy_port", true); 215 // Find out whether the user has already authenticated themselves 216 String user_pass = null; 217 String address = proxy_host + ":" + proxy_port; 218 System.err.println("Searching for authentication for: " + address); 219 int count = 0; 220 while(count < 3 && (user_pass = (String) Gatherer.authentications.get(address)) == null) { 221 Authenticator.requestPasswordAuthentication(proxy_host, null, Integer.parseInt(proxy_port), "http://", Gatherer.dictionary.get("WGet.Prompt"), "HTTP"); 222 count++; 223 } 224 if(count >= 3) { 225 state = STOPPED; 226 return; 227 } 228 System.err.println("login@pass: " + user_pass); 229 if(user_pass.indexOf("@") != -1) { 230 // Write the use proxy command 231 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 "; 232 233 } 234 else { 235 Gatherer.println("Unknown user/pass"); 236 } 213 237 } 214 238 … … 225 249 226 250 if(previous_state == Job.COMPLETE) { 227 progress.mirrorBegun(true );251 progress.mirrorBegun(true, true); 228 252 } 229 253 else { 230 progress.mirrorBegun(false );254 progress.mirrorBegun(false, true); 231 255 } 232 256 … … 258 282 if(!ignore_for_robots) { 259 283 // Add download 260 String new_url = 261 line.substring(line.indexOf("`") + 1, 262 line.lastIndexOf("'")); 284 String new_url = line.substring(line.indexOf("`") + 1, line.lastIndexOf("'")); 263 285 // Remove the destination guff 264 286 if(destination != null) { … … 291 313 line.substring(line.indexOf("`") + 1, 292 314 line.lastIndexOf("'")); 315 // For some strange reason this won't compile 316 // src/org/greenstone/gatherer/collection/Job.java:311: cannot resolve symbol 317 // symbol : class CAKE 318 // location: class org.greenstone.gatherer.collection.Job 319 /* *********************************************************** 320 CAKE CAKE CAKE CAKE I WANT CAKE GIVE ME CAKE NOW!! 321 *********************************************************** */ 293 322 // Remove the destination guff 294 323 if(destination != null) { … … 348 377 // downloaded will be correct. 349 378 if(previous_state == Job.COMPLETE) { 350 progress.mirrorBegun(true );379 progress.mirrorBegun(true, false); 351 380 } 352 381 else { 353 progress.mirrorBegun(false );382 progress.mirrorBegun(false, false); 354 383 } 355 384
Note:
See TracChangeset
for help on using the changeset viewer.