Skip to content

Commit 4849256

Browse files
committed
better usage info
1 parent b20f83c commit 4849256

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

ProxyCache.java

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -158,33 +158,34 @@ else if (secure && request.method.equals("CONNECT")) {
158158

159159
/** Read command line arguments and start proxy */
160160
public static void main(String args[]) {
161-
for (String argument: args) { // http://java.about.com/od/javasyntax/a/Using-Command-Line-Arguments.htm
162-
if(argument.equals("-s") || argument.equals("--secure")) {
163-
// proxy secure HTTPS/TLS connections (experimental as it can course 100% CPU usage)
164-
secure = true;
165-
System.out.print("Proxy HTTPS/TLS connections. (experimental as it can course 100% CPU usage)\n");
166-
167-
}
168-
if(argument.equals("-e") || argument.equals("--expires")) {
169-
// when validating the cache also check the expires header, this can reduce the number of requests out to the web.
170-
expires = true;
171-
System.out.print("Check expires headers when checking the freshniss of an object in the cache.\n");
172-
}
173-
}
174-
175161
int myPort = 0;
176162

177163
try {
178164
myPort = Integer.parseInt(args[0]);
179165
} catch (ArrayIndexOutOfBoundsException e) {
180-
System.out.println("Need port number as argument");
166+
System.out.println("Usage: ProxyCache <Port Number>\nArguments:\n -s, --secure Proxy HTTPS/TLS (experimental, can use 100% CPU)\n -e, --expires Check expires headers");
167+
// System.out.println("Need port number as argument");
181168
System.exit(-1);
182169
} catch (NumberFormatException e) {
183170
System.out.println("Please give port number as integer.");
184171
System.exit(-1);
185172
}
186173
init(myPort);
187174

175+
for (String argument: args) { // http://java.about.com/od/javasyntax/a/Using-Command-Line-Arguments.htm
176+
if(argument.equals("-s") || argument.equals("--secure")) {
177+
// proxy secure HTTPS/TLS connections (experimental as it can course 100% CPU usage)
178+
secure = true;
179+
System.out.println("Proxy HTTPS/TLS connections. (experimental as it can course 100% CPU usage)");
180+
181+
}
182+
if(argument.equals("-e") || argument.equals("--expires")) {
183+
// when validating the cache also check the expires header, this can reduce the number of requests out to the web.
184+
expires = true;
185+
System.out.println("Check expires headers when checking the freshniss of an object in the cache.");
186+
}
187+
}
188+
188189
/** Main loop. Listen for incoming connections and spawn a new
189190
* thread for handling them */
190191
Socket client = null;

0 commit comments

Comments
 (0)