⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mdecodedrequestbodyrule.java

📁 httptunnel.jar httptunnel java 源码
💻 JAVA
字号:
package net.jumperz.app.MGuardian.rule;

import net.jumperz.net.*;
import java.util.regex.*;
import java.io.*;
import net.jumperz.util.*;
import java.net.*;

public class MDecodedRequestBodyRule
extends MAbstractRequestRule
{
//----------------------------------------------------------------------------------
public boolean matches( MHttpRequest request, MResultCache resultCache )
{
Matcher matcher;
String target = null;
boolean match = false;
try
	{
	if( request.hasBody() )
		{
		InputStream bodyInputStream = request.getBodyInputStream();
		ByteArrayOutputStream buffer = new ByteArrayOutputStream( bodyInputStream.available() );
		MStreamUtil.connectStream( bodyInputStream, buffer );
		target = buffer.toString( MCharset.CS_ISO_8859_1 );
		matcher = pattern.matcher( target );
		if( matcher.find() )
			{
			match = true;
			}
		else
			{
			String contentType = request.getHeaderValue( "Content-Type" );

			if( contentType != null
			 && contentType.equalsIgnoreCase( "application/x-www-form-urlencoded" )
			  )
				{
				try
					{
					if( MUnicodeUrlDecoder.isUrlDecoded( target ) )
						{
						target = MUnicodeUrlDecoder.decode( target );
						}
					else
						{
						target = URLDecoder.decode( target, MAbstractRequestRule.CHARSET );
						}
					}
					
				catch( UnsupportedEncodingException e	) { e.printStackTrace(); match = false; }
				catch( IllegalArgumentException e	) { e.printStackTrace(); match = false; }

				matcher = pattern.matcher( target );
				match = matcher.find();
				}
			}
		match = ( match != negationFlag );
		}
	else
		{
			// always false
		match = false;
		}
	}
catch( IOException e )
	{
	e.printStackTrace();
	}

resultCache.cacheResult( this, match );
return match;
}
//--------------------------------------------------------------------------------
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -