1

.NET Framework 4.x

I have an HTTP client with c#, I find HTTPS request is full handshake always. But if use Postman to request, it will reuse the SSL session by session_ticket.

These is packet capture through wireshark:

client hello
      Extension:session_ticket(len=0)
sever hello
      Extension:session_ticket(len=0)
New Session Ticket
      Handshake Protocol: New Session Ticket
    Handshake Type: New Session Ticket (4)
    Length: 214
    TLS Session Ticket
        Session Ticket Lifetime Hint: 100800 seconds (1 day, 4 hours)
        Session Ticket Length: 208
        Session Ticket: 50bb2ffffb6ba4e17cdb6d4c6239f8decd2d590d97b01db4…

Every request packet is the same as above.

If use postman to request,

client hello
          Extension:session_ticket(len=208)

Does somebody know that?

this is my HTTP client

ServicePointManager.ServerCertificateValidationCallback = validationCallback;
if (strUrl.StartsWith("https"))
{
    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;// | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;
}

HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(strUrl);
httpWebRequest.CachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.CacheIfAvailable);
httpWebRequest.Method = "POST";
httpWebRequest.ContentType = "application/octet-stream";
httpWebRequest.Timeout = 30000; ///10s
httpWebRequest.ReadWriteTimeout = 30000; ///10s
httpWebRequest.KeepAlive = false;
httpWebRequest.ContentLength = bytes.Length;
httpWebRequest.Headers.Add("CustomKey", ident.ToString());
httpWebRequest.BeginGetRequestStream(new AsyncCallback(WriteCallback), new RequestState(httpWebRequest, bytes));
Fildor
  • 14,510
  • 4
  • 35
  • 67
cosmosir
  • 11
  • 3

0 Answers0