davidb
davidb

Reputation: 8954

How can I check if a connection uses ssl?

I'm coding a file exchange and some files shouldnt be downloaded without ssl. So I need to check if a connection is ssl encoded or not. Does this depend to the webserver or is there any method for all webservers?

Upvotes: 8

Views: 3349

Answers (2)

César Ortiz
César Ortiz

Reputation: 311

I suppose it depends on the server configuration, but you can check if your transactions are encoded or not with a sniffer. A good one is wireshark.

Upvotes: -2

tadman
tadman

Reputation: 211590

You should be able to check request.ssl? to determine this.

As far as I can tell this is essentially just testing against request.proto to see if it is "https://".

Upvotes: 14

Related Questions