Mercurial > 510Connectbot
annotate src/ch/ethz/ssh2/HTTPProxyData.java @ 400:e856ecf87b10
Backed out changeset aeb8c2e6d83a
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Mon, 20 Oct 2014 19:12:52 -0700 |
parents | 071eccdff8ea |
children |
rev | line source |
---|---|
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
1 /* |
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
2 * Copyright (c) 2006-2011 Christian Plattner. All rights reserved. |
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
3 * Please refer to the LICENSE.txt for licensing details. |
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
4 */ |
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
5 package ch.ethz.ssh2; |
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
6 |
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
7 /** |
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
8 * A <code>HTTPProxyData</code> object is used to specify the needed connection data |
307 | 9 * to connect through a HTTP proxy. |
10 * | |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
11 * @see Connection#setProxyData(ProxyData) |
307 | 12 * |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
13 * @author Christian Plattner |
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
14 * @version 2.50, 03/15/10 |
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
15 */ |
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
16 |
307 | 17 public class HTTPProxyData implements ProxyData { |
18 public final String proxyHost; | |
19 public final int proxyPort; | |
20 public final String proxyUser; | |
21 public final String proxyPass; | |
22 public final String[] requestHeaderLines; | |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
23 |
307 | 24 /** |
25 * Same as calling {@link #HTTPProxyData(String, int, String, String) HTTPProxyData(proxyHost, proxyPort, <code>null</code>, <code>null</code>)} | |
26 * | |
27 * @param proxyHost Proxy hostname. | |
28 * @param proxyPort Proxy port. | |
29 */ | |
30 public HTTPProxyData(String proxyHost, int proxyPort) { | |
31 this(proxyHost, proxyPort, null, null); | |
32 } | |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
33 |
307 | 34 /** |
35 * Same as calling {@link #HTTPProxyData(String, int, String, String, String[]) HTTPProxyData(proxyHost, proxyPort, <code>null</code>, <code>null</code>, <code>null</code>)} | |
36 * | |
37 * @param proxyHost Proxy hostname. | |
38 * @param proxyPort Proxy port. | |
39 * @param proxyUser Username for basic authentication (<code>null</code> if no authentication is needed). | |
40 * @param proxyPass Password for basic authentication (<code>null</code> if no authentication is needed). | |
41 */ | |
42 public HTTPProxyData(String proxyHost, int proxyPort, String proxyUser, String proxyPass) { | |
43 this(proxyHost, proxyPort, proxyUser, proxyPass, null); | |
44 } | |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
45 |
307 | 46 /** |
47 * Connection data for a HTTP proxy. It is possible to specify a username and password | |
48 * if the proxy requires basic authentication. Also, additional request header lines can | |
49 * be specified (e.g., "User-Agent: CERN-LineMode/2.15 libwww/2.17b3"). | |
50 * <p> | |
51 * Please note: if you want to use basic authentication, then both <code>proxyUser</code> | |
52 * and <code>proxyPass</code> must be non-null. | |
53 * <p> | |
54 * Here is an example: | |
55 * <p> | |
56 * <code> | |
57 * new HTTPProxyData("192.168.1.1", "3128", "proxyuser", "secret", new String[] {"User-Agent: GanymedBasedClient/1.0", "X-My-Proxy-Option: something"}); | |
58 * </code> | |
59 * | |
60 * @param proxyHost Proxy hostname. | |
61 * @param proxyPort Proxy port. | |
62 * @param proxyUser Username for basic authentication (<code>null</code> if no authentication is needed). | |
63 * @param proxyPass Password for basic authentication (<code>null</code> if no authentication is needed). | |
64 * @param requestHeaderLines An array with additional request header lines (without end-of-line markers) | |
65 * that have to be sent to the server. May be <code>null</code>. | |
66 */ | |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
67 |
307 | 68 public HTTPProxyData(String proxyHost, int proxyPort, String proxyUser, String proxyPass, |
69 String[] requestHeaderLines) { | |
70 if (proxyHost == null) | |
71 throw new IllegalArgumentException("proxyHost must be non-null"); | |
72 | |
73 if (proxyPort < 0) | |
74 throw new IllegalArgumentException("proxyPort must be non-negative"); | |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
75 |
307 | 76 this.proxyHost = proxyHost; |
77 this.proxyPort = proxyPort; | |
78 this.proxyUser = proxyUser; | |
79 this.proxyPass = proxyPass; | |
80 this.requestHeaderLines = requestHeaderLines; | |
81 } | |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
82 } |