Some time ago I need help to contact secure web via post command. I
modified PostButton. added to OverbyteIcsHttpsTst example, as suggested RTT.
void __fastcall THttpTestForm::PostButtonClick(TObject *Sender)
{
AnsiString asPost;
try {
PrepareConnection();
Display("Connecting...");
PostButton->Enabled = FALSE;
DocumentMemo->Clear();
SslHttpCli1->SendStream = new TStringStream();
asPost = PostMemo->Text;
SslHttpCli1->SendStream->WriteBuffer(&asPost, asPost.Length());
SslHttpCli1->PostASync();
} catch (Exception& E) {
Display("Connect error. " + E.ClassName() + ": " + E.Message);
return;
}
}
The problem is always I get error. I need help to interpret debug file
(sorry it's length).
I would appreciate any help.
Tanks in advance,
Xavi
Example text to post:
{
"username": "demouser",
"password": "demopassword",
"clientid": "democlient",
"signature": "f84WG29dH2gpMMGcvIV86DCLY+8="
}
DocumentMemo result:
Content type is application/xml; charset=utf-8
Document stored in "Validate" Size=393
Validate file content:
<Fault
xmlns="http://schemas.microsoft.com/ws/2005/05/envelope/none"><Code><Value>Sender</Value>
</Code><Reason><Text xml:lang="es-ES">El creador de este error no
especificó una razón.</Text></Reason>
<Detail><ServiceError xmlns="Microsoft.Samples.DistributedServices.Core"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<ErrorMessage>PANIC!</ErrorMessage></ServiceError></Detail></Fault>
Debug_Out_HttpsTst.tx content:
21:43:22:916 State = httpNotConnected
21:43:22:917 Login www.aaaaaa.net
21:43:22:918 State = httpDnsLookup
21:43:23:014 State = httpDnsLookupDone
21:43:23:014 connect to xxx.xxx.xxx.xxx/443
21:43:23:016 022A4070 Socket handle created 592
21:43:23:017 TWSocket will connect to xxx.xxx.xxx.xxx:443
21:43:23:053 SessionConnected
21:43:23:054 State = httpConnected
21:43:23:057 State = httpWaitingHeader
21:43:23:060 9 header lines to send
POST /validation/v1/Validate HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
Connection: Keep-Alive
Accept-Language: en, fr
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/4.0 (compatible; ICS)
Host: www.aaaaaa.net
Proxy-Connection: Keep-Alive
Content-Length: 0
21:43:23:081 022A4070 PutDataInSslBuffer 592 len 317 [1]
21:43:23:084 022A4070 SslTryToSend 592
21:43:23:086 SendRequest Done
21:43:23:088 022A4070 StartSslHandshake 592
21:43:23:556 022A4070 InitSSLConnection 592
21:43:23:557 022A4070 BIO_ctrl(sslbio, BIO_C_SET_SSL, BIO_NOCLOSE,
0x7B57A0) = 1 [2]
21:43:23:558 022A4070 ICB> SSL_CB_HANDSHAKE_START
... (removed lines to avoid size limit)
21:45:34:409 022A4070 TriggerEvents 592 SslState: SSL_ST_OK //
MayFD_Read=0 MayDoRecv=-1 MayFD_Write=-1 MaySslTryToSend=-1
bSslAllSent=-1 bAllSent=-1
21:45:34:410 022A4070 BIO_ctrl_pending(nbio) = 27 [156]
21:45:34:412 022A4070 TriggerEvent sslFdWrite 592
21:45:34:414 022A4070 BIO_ctrl_pending(sslbio) = 0 [157]
21:45:34:415 022A4070 BIO_ctrl_get_write_guarantee(nbio) = 4096 [158]
21:45:34:417 022A4070 SslAsyncSelect 592, 2 FD_WRITE
21:45:34:419 022A4070 TCustomSslWSocket.Do_FD_WRITE 592
21:45:34:421 022A4070 BIO_ctrl_pending(nbio) = 27 [159]
21:45:34:423 022A4070 BIO_read(nbio, 0x18BC88, 27) = 27 [160]
21:45:34:425 022A4070 my_RealSend (0x250, 1621128, 27) = 27 [161]
21:45:34:426 022A4070 BIO_ctrl_pending(nbio) = 0 [162]
21:45:34:428 022A4070 BIO_ctrl_pending(nbio) = 0 [163]
21:45:34:429 022A4070 BIO_ctrl_pending(nbio) = 0 [164]
21:45:34:430 022A4070 TriggerSslShutDownComplete(0) 592
21:45:34:432 022A4070 TCustomWSocket.Shutdown 1 592
21:45:34:433 022A4070 TriggerEvent sslFdClose 592
21:45:34:435 022A4070 SslShutdownCompleted *1* 592
21:45:34:436 022A4070 SslAsyncSelect 592, 32 FD_CLOSE
21:45:34:437 022A4070 TCustomSslWSocket.Do_FD_CLOSE error #0 592
21:45:34:439 022A4070 BIO_ctrl_pending(sslbio) = 0 [165]
21:45:34:441 022A4070 Socket data pending: 0 Err: 0 592
21:45:34:442 022A4070 FCloseInvoked=0 592
21:45:34:444 SessionClosed Error: 0
21:45:34:446 022A4070 ResetSslSession 592
--
Xavier Mor-Mur
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be