| LEFT | RIGHT |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 Eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 import java.net.InetSocketAddress; | 23 import java.net.InetSocketAddress; |
| 24 import java.net.Socket; | 24 import java.net.Socket; |
| 25 | 25 |
| 26 import sunlabs.brazil.server.Request; | 26 import sunlabs.brazil.server.Request; |
| 27 import sunlabs.brazil.server.Server; | 27 import sunlabs.brazil.server.Server; |
| 28 import sunlabs.brazil.util.MatchString; | 28 import sunlabs.brazil.util.MatchString; |
| 29 | 29 |
| 30 /** | 30 /** |
| 31 * <code>RequestHandler</code> implements a SSL tunnel. | 31 * <code>RequestHandler</code> implements a SSL tunnel. |
| 32 * | 32 * |
| 33 * The following configuration parameters are used to initialize this <code>Hand
ler</code>: | 33 * The following configuration parameters are used to initialize this |
| 34 * <code>Handler</code>: |
| 34 * <dl class=props> | 35 * <dl class=props> |
| 35 * | 36 * |
| 36 * <dt>prefix, suffix, glob, match | 37 * <dt>prefix, suffix, glob, match |
| 37 * <dd>Specify the URL that triggers this handler. (See {@link MatchString}). | 38 * <dd>Specify the URL that triggers this handler. (See {@link MatchString}). |
| 38 * <dt>auth | 39 * <dt>auth |
| 39 * <dd>The value of the proxy-authenticate header (if any) sent to the upstream
proxy | 40 * <dd>The value of the proxy-authenticate header (if any) sent to the upstream |
| 41 * proxy |
| 40 * <dt>proxyHost | 42 * <dt>proxyHost |
| 41 * <dd>If specified, the name of the upstream proxy | 43 * <dd>If specified, the name of the upstream proxy |
| 42 * <dt>proxyPort | 44 * <dt>proxyPort |
| 43 * <dd>The upstream proxy port, if a proxyHost is specified (defaults to 80) | 45 * <dd>The upstream proxy port, if a proxyHost is specified (defaults to 80) |
| 44 * | 46 * |
| 45 * </dl> | 47 * </dl> |
| 46 * | 48 * |
| 47 * A sample set of configuration parameters illustrating how to use this handler
follows: | 49 * A sample set of configuration parameters illustrating how to use this |
| 50 * handler follows: |
| 48 * | 51 * |
| 49 * <pre> | 52 * <pre> |
| 50 * handler=https | 53 * handler=https |
| 51 * https.class=org.adblockplus.brazil.SSLConnectionHandler | 54 * https.class=org.adblockplus.brazil.SSLConnectionHandler |
| 52 * </pre> | 55 * </pre> |
| 53 * | 56 * |
| 54 * See the description under {@link sunlabs.brazil.server.Handler#respond respon
d} for a more | 57 * See the description under {@link sunlabs.brazil.server.Handler#respond |
| 55 * detailed explanation. | 58 * respond} for a more detailed explanation. |
| 56 * | 59 * |
| 57 * Original source by Jochen Luell, PAW (http://paw-project.sourceforge.net/) | 60 * Original source by Jochen Luell, PAW (http://paw-project.sourceforge.net/) |
| 58 */ | 61 */ |
| 59 | 62 |
| 60 public class SSLConnectionHandler extends BaseRequestHandler | 63 public class SSLConnectionHandler extends BaseRequestHandler |
| 61 { | 64 { |
| 62 @Override | 65 @Override |
| 63 public boolean respond(final Request request) throws IOException | 66 public boolean respond(final Request request) throws IOException |
| 64 { | 67 { |
| 65 if (!request.method.equals("CONNECT")) | 68 if (!request.method.equals("CONNECT")) |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 } | 169 } |
| 167 out.flush(); | 170 out.flush(); |
| 168 } | 171 } |
| 169 catch (final IOException e) | 172 catch (final IOException e) |
| 170 { | 173 { |
| 171 e.printStackTrace(); | 174 e.printStackTrace(); |
| 172 } | 175 } |
| 173 } | 176 } |
| 174 } | 177 } |
| 175 } | 178 } |
| LEFT | RIGHT |