Support Unicode encode

This commit is contained in:
wanghongenpin
2024-09-22 01:44:56 +08:00
parent 248576b103
commit e152f9b9e6
7 changed files with 36 additions and 21 deletions

View File

@@ -48,8 +48,6 @@ class ConnectionHandler(
*/
@Throws(IOException::class)
fun handlePacket(stream: ByteBuffer) {
val rawPacket = ByteArray(stream.limit())
stream[rawPacket, 0, stream.limit()]
stream.rewind()
val ipHeader = IPPacketFactory.createIP4Header(stream)
@@ -105,7 +103,7 @@ class ConnectionHandler(
* 是否支持协议
*/
private val methods: List<String> =
mutableListOf("GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS", "TRACE", "CONNECT")
mutableListOf("GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "TRACE", "CONNECT", "PROPFIND", "REPORT")
private fun supperProtocol(packetData: ByteBuffer): Boolean {
val position = packetData.position()

View File

@@ -63,11 +63,7 @@ class ProxyVpnThread(
if (length > 0) {
try {
readBuffer.flip()
val byteArray = ByteArray(length)
readBuffer.get(byteArray)
val packet = ByteBuffer.wrap(byteArray)
handler.handlePacket(packet)
handler.handlePacket(readBuffer)
} catch (e: Exception) {
val errorMessage = (e.message ?: e.toString())
Log.e(TAG, errorMessage, e)

View File

@@ -9,9 +9,6 @@ import java.nio.ByteOrder
/**
* Helper class to perform various useful task
*
* @author Borey Sao
* Date: May 8, 2014
*/
object PacketUtil {
@get:Synchronized