📄 msslredirector.java
字号:
package net.jumperz.app.MGuardian.plugin;
import net.jumperz.net.*;
import net.jumperz.util.*;
import java.net.*;
import java.util.*;
import java.io.*;
public class MSslRedirector
extends MGuardianPlugin
{
//--------------------------------------------------------------------------------
public Map execute( Map sessionInfo )
throws IOException
{
MHttpResponse response = ( MHttpResponse )sessionInfo.get( "response" );
if( response == null )
{
return null;
}
String protocol = ( String )sessionInfo.get( "protocol" );
if( !protocol.equals( "HTTPS" ) )
{
return null;
}
int statusCode = response.getStatusCode();
if( statusCode < 300 || 400 <= statusCode )
{
return null;
}
if( !response.headerExists( "Location" ) )
{
return null;
}
String location = response.getHeaderValue( "Location" );
if( location.indexOf( "http://" ) == 0 )
{
location = location.replaceFirst( "^http", "https" );
response.setHeaderValue( "Location", location );
}
return null;
}
//--------------------------------------------------------------------------------
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -