mirror of
https://github.com/tursom/TursomServer.git
synced 2025-04-01 15:11:08 +08:00
fix bug
This commit is contained in:
parent
512c523cad
commit
ba1b964e24
@ -28,8 +28,8 @@ object HttpRequest {
|
|||||||
if (startIndex < 0) {
|
if (startIndex < 0) {
|
||||||
Charsets.UTF_8
|
Charsets.UTF_8
|
||||||
} else {
|
} else {
|
||||||
var endIndex = contentType.indexOf("charset=", startIndex = startIndex, ignoreCase = true) + 8
|
var endIndex = contentType.indexOf(";", startIndex = startIndex, ignoreCase = true)
|
||||||
if (endIndex < 8) endIndex = contentType.length
|
if (endIndex < 0) endIndex = contentType.length
|
||||||
if (startIndex == endIndex) {
|
if (startIndex == endIndex) {
|
||||||
Charsets.UTF_8
|
Charsets.UTF_8
|
||||||
} else {
|
} else {
|
||||||
|
@ -5,8 +5,6 @@ package cn.tursom.core
|
|||||||
import sun.misc.Unsafe
|
import sun.misc.Unsafe
|
||||||
import java.io.ByteArrayInputStream
|
import java.io.ByteArrayInputStream
|
||||||
import java.io.ByteArrayOutputStream
|
import java.io.ByteArrayOutputStream
|
||||||
import java.io.File
|
|
||||||
import java.io.IOException
|
|
||||||
import java.lang.reflect.Field
|
import java.lang.reflect.Field
|
||||||
import java.lang.reflect.ParameterizedType
|
import java.lang.reflect.ParameterizedType
|
||||||
import java.lang.reflect.Type
|
import java.lang.reflect.Type
|
||||||
@ -158,9 +156,9 @@ fun ByteArray.sha1(): ByteArray = sha1.digest(this)
|
|||||||
fun String.sha1(): String = toByteArray().sha1().toHexString()
|
fun String.sha1(): String = toByteArray().sha1().toHexString()
|
||||||
|
|
||||||
//获取sha384加密对象
|
//获取sha384加密对象
|
||||||
val shA384 by lazy { MessageDigest.getInstance("SHA-384")!! }
|
val sha384 by lazy { MessageDigest.getInstance("SHA-384")!! }
|
||||||
|
|
||||||
fun ByteArray.sha384(): ByteArray = shA384.digest(this)
|
fun ByteArray.sha384(): ByteArray = sha384.digest(this)
|
||||||
|
|
||||||
fun String.sha384(): String = toByteArray().sha384().toHexString()
|
fun String.sha384(): String = toByteArray().sha384().toHexString()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user