@@ -75,21 +75,6 @@ public SSLComunicator(OutputStream output, ConnectionDirectiveHandler parent, St
7575 }
7676
7777 public void startConnection () {
78- if (!ProxyMain .getPropertiesProvider ().getAsBoolean (PropertyKey .PROXY_SSL_ENABLED )) {
79- try {
80- HttpResponse hrqh = new HttpResponse ("HTTP/1.1" , 503 , "Service Unavailable" ,
81- new TreeMap <String , String >(String .CASE_INSENSITIVE_ORDER ));
82- output .write ((hrqh .toHttpResponseLine () + "\r \n \r \n " ).getBytes ());
83- logger .log (LoggingLevel .WARN ,
84- "An attempt to connect with SSL has been caught while SSL being disabled." );
85- stopCommunicator ();
86- return ;
87- } catch (IOException e ) {
88- logger .log (LoggingLevel .WARN , "Failed to write the response line." , e );
89- stopCommunicator ();
90- return ;
91- }
92- }
9378 if (parent .getDirective ().isDirect ()) {
9479 try {
9580 transferSocket = new Socket (originalHost , originalPort );
@@ -109,6 +94,21 @@ public void startConnection() {
10994 return ;
11095 }
11196 } else {
97+ if (!ProxyMain .getPropertiesProvider ().getAsBoolean (PropertyKey .PROXY_SSL_ENABLED )) {
98+ try {
99+ HttpResponse hrqh = new HttpResponse ("HTTP/1.1" , 503 , "Service Unavailable" ,
100+ new TreeMap <String , String >(String .CASE_INSENSITIVE_ORDER ));
101+ output .write ((hrqh .toHttpResponseLine () + "\r \n \r \n " ).getBytes ());
102+ logger .log (LoggingLevel .WARN ,
103+ "An attempt to connect with SSL has been caught while SSL being disabled." );
104+ stopCommunicator ();
105+ return ;
106+ } catch (IOException e ) {
107+ logger .log (LoggingLevel .WARN , "Failed to write the response line." , e );
108+ stopCommunicator ();
109+ return ;
110+ }
111+ }
112112 server = new SSLCommunicationServer (this );
113113 Integer serverPort = server .prepareServerSocket ();
114114 try {
0 commit comments