从 http 请求确定服务器类型
我有一个用 CPP 编写的网络服务器。我想确定请求的服务器类型。即请求来自http还是https URL?
I have a web-server written in CPP. I want to determine the server-type of the request. i.e whether the request came from http or https URL ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您有自己的用 C++ 编写的 Web 服务器,您已经知道它是通过 http 还是 https 来的,因为它们通过不同的端口并需要不同的处理。
If you have your own web-server written in c++ you already know whether it came over http or https as they come through different ports and require different handling.
您正在监听哪个端口?
默认情况下,HTTPS URL 以“https://”开头,默认使用端口 443,而 HTTP URL 以“http://”开头,默认使用端口 80。
还有其他问题,例如如何管理证书以提供安全连接?
本文可能会有所帮助 - http://java.sun.com/developer/technicalArticles/安全/安全互联网/
Which port you're listening to?
By default HTTPS URLs begin with "https://" and use port 443 by default, where HTTP URLs begin with "http://" and use port 80 by default.
There are other questions like how you're managing certificates to serve secure connections?
This article might be helpful - http://java.sun.com/developer/technicalArticles/Security/secureinternet/