使用 Ssl = true 时,Chilkat Upload BeginUpdate 失败并显示 "Failed to read TLS record (2)"
Chilkat Upload BeginUpdate fails with "Failed to read TLS record (2)" when using Ssl = true
我的主机更新了一些关于我的服务器的东西,我猜是 php 版本,从那时起,我的 php 上传脚本不再适用于 Chilkat.Upload。
Dim _Chil As New Chilkat.Upload
_Chil.Ssl = True
_Chil.Hostname = "www.example.com"
_Chil.Path = "/upload.php"
_Chil.AddFileReference("file", "D:\test.txt")
Dim bUploadStarted As Boolean = _Chil.BeginUpload()
If Not bUploadStarted Then
MessageBox.Show("Error trying to BeginUpload: " & _Chil.LastErrorText)
Return
End If
Do While _Chil.UploadInProgress
_Chil.SleepMs(200)
Loop
Dim bSuccess As Boolean = _Chil.UploadSuccess
If Not bSuccess Then
MessageBox.Show("Error uploading:" & _Chil.LastErrorText)
Else
MessageBox.Show("Upload succeeeded. :-)")
End If
使用 .Ssl = true
, BeginUpload 失败。这是最后一个错误文本:
ChilkatLog:
BeginUpload:
DllDate: Aug 28 2021
ChilkatVersion: 9.5.0.88
UnlockPrefix: NONE
Architecture: Little Endian; 32-bit
Language: .NET 4.6 / x86 / VS2015
VerboseLogging: 0
usingTls: 1
Connecting directly to HTTP server
domain: www.example.com
port: 80
socket2Connect:
connect2:
connectImplicitSsl:
clientHandshake:
clientHandshake2:
readHandshakeMessages:
Failed to read TLS record (2)
tlsRec_msg: 0
msgLen: 20527
nReadNBytes: 0
status: 0
--readHandshakeMessages
--clientHandshake2
--clientHandshake
Client handshake failed. (3)
--connectImplicitSsl
connectFailReason: 103
Failed to read the TLS server hello. Retry without TLS 1.3
connectImplicitSsl:
clientHandshake:
clientHandshake2:
readHandshakeMessages:
Failed to read TLS record (2)
tlsRec_msg: 0
msgLen: 20527
nReadNBytes: 0
status: 0
--readHandshakeMessages
--clientHandshake2
--clientHandshake
Client handshake failed. (3)
--connectImplicitSsl
ConnectFailReason: 103
--connect2
--socket2Connect
--BeginUpload
--ChilkatLog
如果我删除 .Ssl = true,则 BeginUpload 成功,但 UploadSuccess return false。最后的错误文本是:
ChilkatLog:
BeginUpload:
DllDate: Aug 28 2021
ChilkatVersion: 9.5.0.88
UnlockPrefix: NONE
Architecture: Little Endian; 32-bit
Language: .NET 4.6 / x86 / VS2015
VerboseLogging: 0
usingTls: 0
Connecting directly to HTTP server
domain: www.example.com
port: 80
--BeginUpload
如果我通过浏览器 运行 脚本,它工作正常。
这是我的代码:
myform.php:
<center>
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="file" name="file" >
<input type="submit" name="upload" value="upload file">
</form>
</center>
upload.php:
<?php
move_uploaded_file($_FILES["file"]["tmp_name"], "uploads/" . $_FILES["file"]["name"]);
?>
HTTPS 使用端口 443。
所以使用
_Chil.Port = 443
解决了问题。
我的主机更新了一些关于我的服务器的东西,我猜是 php 版本,从那时起,我的 php 上传脚本不再适用于 Chilkat.Upload。
Dim _Chil As New Chilkat.Upload
_Chil.Ssl = True
_Chil.Hostname = "www.example.com"
_Chil.Path = "/upload.php"
_Chil.AddFileReference("file", "D:\test.txt")
Dim bUploadStarted As Boolean = _Chil.BeginUpload()
If Not bUploadStarted Then
MessageBox.Show("Error trying to BeginUpload: " & _Chil.LastErrorText)
Return
End If
Do While _Chil.UploadInProgress
_Chil.SleepMs(200)
Loop
Dim bSuccess As Boolean = _Chil.UploadSuccess
If Not bSuccess Then
MessageBox.Show("Error uploading:" & _Chil.LastErrorText)
Else
MessageBox.Show("Upload succeeeded. :-)")
End If
使用 .Ssl = true , BeginUpload 失败。这是最后一个错误文本:
ChilkatLog:
BeginUpload:
DllDate: Aug 28 2021
ChilkatVersion: 9.5.0.88
UnlockPrefix: NONE
Architecture: Little Endian; 32-bit
Language: .NET 4.6 / x86 / VS2015
VerboseLogging: 0
usingTls: 1
Connecting directly to HTTP server
domain: www.example.com
port: 80
socket2Connect:
connect2:
connectImplicitSsl:
clientHandshake:
clientHandshake2:
readHandshakeMessages:
Failed to read TLS record (2)
tlsRec_msg: 0
msgLen: 20527
nReadNBytes: 0
status: 0
--readHandshakeMessages
--clientHandshake2
--clientHandshake
Client handshake failed. (3)
--connectImplicitSsl
connectFailReason: 103
Failed to read the TLS server hello. Retry without TLS 1.3
connectImplicitSsl:
clientHandshake:
clientHandshake2:
readHandshakeMessages:
Failed to read TLS record (2)
tlsRec_msg: 0
msgLen: 20527
nReadNBytes: 0
status: 0
--readHandshakeMessages
--clientHandshake2
--clientHandshake
Client handshake failed. (3)
--connectImplicitSsl
ConnectFailReason: 103
--connect2
--socket2Connect
--BeginUpload
--ChilkatLog
如果我删除 .Ssl = true,则 BeginUpload 成功,但 UploadSuccess return false。最后的错误文本是:
ChilkatLog:
BeginUpload:
DllDate: Aug 28 2021
ChilkatVersion: 9.5.0.88
UnlockPrefix: NONE
Architecture: Little Endian; 32-bit
Language: .NET 4.6 / x86 / VS2015
VerboseLogging: 0
usingTls: 0
Connecting directly to HTTP server
domain: www.example.com
port: 80
--BeginUpload
如果我通过浏览器 运行 脚本,它工作正常。
这是我的代码:
myform.php:
<center>
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="file" name="file" >
<input type="submit" name="upload" value="upload file">
</form>
</center>
upload.php:
<?php
move_uploaded_file($_FILES["file"]["tmp_name"], "uploads/" . $_FILES["file"]["name"]);
?>
HTTPS 使用端口 443。
所以使用
_Chil.Port = 443
解决了问题。