{"id":42875,"date":"2023-03-16T18:06:40","date_gmt":"2023-03-16T10:06:40","guid":{"rendered":"http:\/\/gulass.cn\/?p=42875"},"modified":"2023-03-16T18:06:40","modified_gmt":"2023-03-16T10:06:40","slug":"pressure-measurement-https","status":"publish","type":"post","link":"https:\/\/gulass.cn\/pressure-measurement-https.html","title":{"rendered":"\u770b\u817e\u8baf\u4e13\u5bb6\u5982\u4f55\u5728\u9ad8\u5e76\u53d1\u538b\u6d4b\u4e2d\u652f\u6301HTTPS\u5427\uff01"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | \u7528epoll\u7f16\u5199\u4e00\u4e2a\u9ad8\u5e76\u53d1\u7f51\u7edc\u7a0b\u5e8f\u662f\u5f88\u5e38\u89c1\u7684\u4efb\u52a1\uff0c\u4f46\u5728epoll\u4e2d\u52a0\u5165SSL\u5c42\u7684\u652f\u6301\u5219\u662f\u4e00\u4e2a\u4e0d\u5e38\u89c1\u7684\u573a\u666f\u3002\u817e\u8bafWeTest\u670d\u52a1\u5668\u538b\u529b\u6d4b\u4ea7\u54c1\uff0c\u5728\u7528\u6237\u53cd\u9988\u4e2d\u6536\u5230\u4e86\u4e0d\u5c11\u652f\u6301HTTPS\u534f\u8bae\u7684\u8bf7\u6c42\u3002\u57fa\u4e8e\u6b64\uff0c\u672c\u6587\u4ecb\u7ecd\u4e86\u5728\u57fa\u4e8eepoll\u7684\u9ad8\u5e76\u53d1\u673a\u5668\u4eba\u6846\u67b6\u4e2d\u52a0\u5165OpenSSL\uff0c\u5b9e\u73b0\u5bf9HTTPS\u652f\u6301\u65f6\u7684\u57fa\u672c\u5b9e\u73b0\u601d\u8def\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n \u4e00\u3001\u80cc\u666f<\/strong><\/div>\n 2014\u5e74\uff0c\u8c37\u6b4c\u5728\u5176\u5b98\u65b9\u535a\u5ba2\u4e2d\u53d1\u5e03\u516c\u544a\u79f0\uff0c\u4e3a\u4e86\u6253\u9020\u66f4\u5b89\u5168\u7684\u4e92\u8054\u7f51\u73af\u5883\uff0c\u8c37\u6b4c\u641c\u7d22\u5f15\u64ce\u5c06\u5c1d\u8bd5\u628a\u201c\u662f\u5426\u4f7f\u7528\u5b89\u5168\u52a0\u5bc6\u201d\uff08HTTPS\uff09\u4f5c\u4e3a\u641c\u7d22\u6392\u540d\u7b97\u6cd5\u4e2d\u7684\u4e00\u4e2a\u53c2\u8003\u56e0\u7d20\uff0c\u4f7f\u7528\u52a0\u5bc6\u6280\u672f\u7684\u7f51\u7ad9\u5c06\u5f97\u5230\u66f4\u591a\u7684\u5c55\u793a\u673a\u4f1a\uff0c\u6392\u540d\u76f8\u5bf9\u540c\u7c7b\u7f51\u7ad9\u4e5f\u66f4\u6709\u4f18\u52bf\u3002\u9762\u5bf9\u8fd0\u8425\u5546\u7684HTTP\u52ab\u6301\uff0c\u5e7f\u544a\u5d4c\u5165\uff0c\u5c06\u4ea7\u54c1\u9875\u9762\u91cd\u5b9a\u5411\u5230\u5176\u4ed6\u9875\u9762\uff0cHTTP\u7ad9\u70b9\u901a\u5e38\u675f\u624b\u65e0\u7b56\u3002\u6240\u4ee5\u4ec5\u4ec5\u662f\u4e3a\u4e86\u52a0\u5bc6\u6d41\u91cf\uff0cHTTPS\u7684\u90e8\u7f72\u4e5f\u5c06\u6210\u4e3a\u5927\u52bf\u6240\u8d8b\u3002<\/p>\n \u817e\u8bafWeTest\u670d\u52a1\u5668\u6027\u80fd\u6d4b\u8bd5\u539f\u672c\u7684\u7b80\u5355\u6a21\u5f0f\uff0c\u4e3b\u8981\u9488\u5bf9\u4ee5HTTP\u534f\u8bae\u4e3a\u4e3b\u7684\u8f7b\u91cf\u7ea7\u573a\u666f\uff08\u6e38\u620f\u4e1a\u52a1\u4e00\u822c\u4f1a\u91c7\u7528\u66f4\u590d\u6742\u7684\u534f\u8bae\uff09\u3002\u800c\u5728\u4e0a\u7ebf\u4e4b\u540e\uff0c\u6536\u5230\u4e86\u4e0d\u5c11\u9700\u8981HTTPS\u6d4b\u8bd5\u7684\u7528\u6237\u53cd\u9988\uff0c\u7531\u6b64\u51b3\u5b9a\u5728\u6211\u4eec\u4f7f\u7528\u7684\u538b\u6d4b\u6846\u67b6\u4e2d\u52a0\u5165HTTPS\u652f\u6301\u3002<\/p>\n <\/p>\n \u817e\u8bafWeTest\u670d\u52a1\u5668\u6027\u80fd\u6d4b\u8bd5\u662f\u4e00\u4e2a\u57fa\u4e8eepoll\u7684\u9ad8\u5e76\u53d1\u673a\u5668\u4eba\u7f51\u7edc\u884c\u4e3a\u6a21\u62df\u6846\u67b6\u3002\u5176\u4e2d\u7684\u7f51\u7edc\u4f20\u8f93\u6a21\u5757\uff0c\u662f\u7528\u5355\u7ebf\u7a0bepoll\u7684\u591a\u8def\u590d\u7528\u65b9\u5f0f\uff0c\u5c06\u591a\u4e2a\u673a\u5668\u4eba\u548c\u670d\u52a1\u5668\u7684\u4ea4\u4e92\u5305\u8fdb\u884c\u975e\u963b\u585e\u9ad8\u901f\u8f6c\u53d1\u3002\u914d\u5408\u4ee5Linux\u7cfb\u7edf\u5c42\u9762\u7684\u4e00\u4e9b\u914d\u7f6e\u4f18\u5316\uff0c\u5c31\u53ef\u4ee5\u8fbe\u5230\u5355\u8fdb\u7a0b\u51e0\u5343\u7684\u673a\u5668\u4eba\u6570\u91cf\u3002<\/p>\n \u540e\u53f0\u5f00\u53d1\u540c\u5b66\uff0c\u4e00\u822c\u5728\u81ea\u5df1\u7684web\u670d\u52a1\u5668\u4e2d\u52a0HTTPS\u7684\u914d\u7f6e\u76f8\u5bf9\u5e38\u89c1\uff0c\u4f46\u81ea\u5df1\u5230socket\u5c42\u53bb\u5199HTTPS\u7684\u4ee3\u7801\u5b9e\u73b0\uff0c\u8fd9\u4e2a\u9700\u6c42\u8fd8\u771f\u4e0d\u592a\u591a\u3002\u52a8\u624b\u4e4b\u524d\uff0c\u6211\u4eec\u8c03\u7814\u4e86HTTPS\u5c42\u53ef\u7528\u7684\u5e93\uff0c\u6700\u5e38\u89c1\u7684\u5c31\u662fOpenSSL\u4e86\u3002\u50cfcurl\u4e5f\u6709HTTPS\u7684\u76f8\u5e94\u652f\u6301\uff0c\u4e0d\u8fc7\u8003\u8651\u5230\u8981\u5728tcp socket\uff08epoll\uff09\u8fd9\u4e00\u5c42\u5b9e\u73b0\uff0c\u8fd8\u662f\u9009\u62e9\u4e86OpenSSL\u3002<\/p>\n \u4e8c\u3001OpenSSL<\/strong><\/div>\n \u5728\u4ecb\u7ecdOpenSSL\u4e4b\u524d\uff0c\u9996\u5148\u8981\u4ecb\u7ecd\u4e0bHTTPS\u3002HTTPS\u662f\u4ec0\u4e48\uff1fHTTPS\u5c31\u662fhttp+tls\/ssl\uff08\u4e0b\u6587\u7b80\u79f0SSL\uff09\u3002\u4ece\u7f51\u7edc\u534f\u8bae\u7684\u5c42\u9762\u6765\u8bf4\uff0cTCP\u662f\u4f20\u8f93\u5c42\u534f\u8bae\uff0cHTTP\u662f\u5e94\u7528\u5c42\u534f\u8bae\uff0cSSL\u5c31\u662f\u4e3a\u4e86\u7ed9\u5e94\u7528\u5c42\u7684HTTP\u62a5\u6587\u52a0\u5bc6\uff0c\u4e13\u95e8\u52a0\u5728TCP\u548chttp\u4e4b\u95f4\u7684\u4e00\u5c42\u5b89\u5168\u534f\u8bae\u3002\u7f51\u7edc\u4e0a\u5bf9HTTPS\u534f\u8bae\u8fdb\u884c\u4ecb\u7ecd\u7684\u597d\u6587\u5f88\u591a\uff0c\u5982\uff1ahttp:\/\/www.cnblogs.com\/LittleHann\/p\/3741907.html\uff0c\u8be6\u7ec6\u9610\u8ff0\u4e86HTTPS\u7684\u539f\u7406\uff0c\u8fd9\u91cc\u5c31\u4e0d\u518d\u8d58\u8ff0\u3002<\/p>\n OpenSSL\u5c31\u662f\u5728\u5e38\u7528\u7684socket\u5c42\u8fde\u63a5\u5efa\u597d\u4e4b\u540e\uff0c\u5b8c\u6210SSL\u5c42\u7684\u8fde\u63a5\u5efa\u7acb\u3001\u6536\u53d1\u5305\u3001\u8fde\u63a5\u91ca\u653e\uff0c\u5176\u5b9e\u8c03\u7528\u7684\u57fa\u672c\u601d\u8def\u8fd8\u662f\u5f88\u6e05\u6670\u7684\u3002\u6211\u4eec\u4ee5\u672c\u6587\u4e2d\u8981\u5b9e\u73b0\u7684client\u4fa7\u4e3a\u4f8b\uff0c\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n \u53ef\u4ee5\u770b\u5230\uff0c\u5c31\u662f\u5728\u666e\u901a\u7684socket\u5efa\u7acb\u597dTCP\u8fde\u63a5\u540e\uff0c\u518d\u7528SSL_connect\u5efa\u7acbssl\u5c42\u7684\u8fde\u63a5\u3002\u7136\u540e\u7528SSL_read\/SSL_write\u66ff\u4ee3recv\/send\u8fdb\u884c\u6536\u53d1\u6570\u636e\uff0c\u5e76\u5728close socket\u7684\u524d\u540e\u91ca\u653essl\u5c42\u7684\u8d44\u6e90\u5373\u53ef\u3002<\/p>\n \u7531\u4e8e\u5df2\u7ecf\u5b9e\u73b0\u4e86\u57fa\u4e8eepoll\u7684\u5ba2\u6237\u7aef\u6570\u636e\u6536\u53d1\u548cHTTP\u534f\u8bae\u7684\u89e3\u6790\uff0c\u6240\u4ee5\u8fd9\u4e24\u8005\u90fd\u4e0d\u662f\u672c\u6587\u7684\u91cd\u70b9\u2014\u2014\u4e0b\u6587\u4e3b\u8981\u4ecb\u7ecd\u7684\u662f\u5728epoll\u7684\u6846\u67b6\u4e2d\u4f7f\u7528OpenSSL\u6536\u53d1\u6570\u636e\u65f6\uff0c\u9700\u8981\u6ce8\u610f\u7684\u5730\u65b9\u3002<\/p>\n \u4e09\u3001\u5168\u53cc\u5de5\u5b9e\u73b0<\/strong><\/div>\n \u770b\u5230\u8fd9\u4e2a\u6807\u9898\uff0c\u80af\u5b9a\u6709\u540c\u5b66\u4f1a\u7eb3\u95f7\uff1aTCP\u672c\u6765\u4e0d\u5c31\u662f\u5168\u53cc\u5de5\u7684\u4e48\uff0cHTTPS\u662f\u5728TCP\u5c42\u4e4b\u4e0a\u7684\uff0c\u600e\u4e48\u8fd8\u4f1a\u5355\u72ec\u62ce\u51fa\u8fd9\u4e2a\u6765\u8bf4\uff1f\u6ca1\u9519\uff0cTCP\u662f\u5168\u53cc\u5de5\u7684\uff0c\u4f46OpenSSL\u7684\u5b9e\u73b0\uff0c\u4e0d\u4ee3\u8868\u4f60\u80fd\u50cf\u666e\u901asocket\u4e00\u6837\u5728\u6536\u53d1\u4e24\u4e2a\u901a\u9053\u4e0a\u968f\u610f\u64cd\u4f5c\u3002<\/p>\n \u8981\u70b91\uff1aOpenSSL\u5e76\u53d1\u8bfb\u5199\uff0c\u662f\u4e0d\u5b89\u5168\u7684<\/p>\n \u5176\u5b9eOpenSSL\u5b98\u65b9\u7684\u6587\u6863\u4e0a\u8fd8\u6ca1\u627e\u5230\u76f4\u63a5\u7684\u8bdd\u672f\u6307\u660e\u540c\u4e00\u4e2aSSL\u4e0d\u80fd\u4e24\u4e2a\u7ebf\u7a0b\u5e76\u53d1\u8bfb\u5199\uff0c\u4f46\u5b9e\u9645\u4e0a\uff0c\u5916\u7f51\u4e0a\u3001km\u4e0a\u90fd\u6709\u6587\u7ae0\u8bf4\u5728\u591a\u7ebf\u7a0b\u5e76\u53d1\u60c5\u51b5\u4e0b\u8bfb\u5199\u4f1a\u5f15\u8d77\u7a0b\u5e8f\u5d29\u6e83\u3002\u60f3\u6765\u662fSSL\u5bf9\u8c61\u5185\u90e8\u5b9e\u73b0\u4e2d\uff0c\u7ef4\u62a4\u4e86\u5171\u4eab\u7684\u72b6\u6001\u53d8\u91cf\u6216\u8005\u7f13\u5b58\u533a\u4e4b\u7c7b\u7684\u8d44\u6e90\uff0c\u5e76\u53d1\u8bfb\u5199\u65f6\u4f1a\u6539\u574f\u6570\u636e\u5bfc\u81f4\u5d29\u6e83\u3002\u53ef\u4ee5\u901a\u8fc7\u521d\u59cb\u5316\u65f6\u8bbe\u7f6e\u52a0\u9501\u56de\u8c03\u7684\u65b9\u5f0f\u6765\u907f\u514d\uff08http:\/\/linux.die.net\/man\/3\/crypto_set_locking_callback\uff09\uff0c\u4f46\u9501\u7ec8\u7a76\u5bf9\u6027\u80fd\u6709\u4e0d\u5c0f\u7684\u5f71\u54cd\u3002<\/p>\n \u4e0d\u8fc7gaps\u73b0\u6709\u7684\u5b9e\u73b0\u662f\u5355\u8fdb\u7a0b\u7684\uff0c\u5373\u5355\u8fdb\u7a0b\u4e2d\u901a\u8fc7epoll\u5b8c\u6210\u4e86\u591a\u4e2a\u673a\u5668\u4eba\u8fde\u63a5\u7684\u6536\u53d1\u6570\u636e\uff0c\u6240\u4ee5\u5e76\u4e0d\u5b58\u5728\u591a\u7ebf\u7a0b\u5e76\u53d1\u7684\u95ee\u9898\uff0c\u4e5f\u65e0\u9700\u52a0\u9501\u3002\u7531\u6b64\uff0c\u5c0f\u6807\u9898\u7684\u201c\u5168\u53cc\u5de5\u5b9e\u73b0\u201d\u5176\u5b9e\u66f4\u4e25\u683c\u8bf4\u662f\u201d\u5355\u8fdb\u7a0b\u60c5\u51b5\u4e0b\u8bfb\u5199\u4e92\u4e0d\u5e72\u6270\u7684\u53cc\u5de5\u5b9e\u73b0\u201c\u3002<\/p>\n \u8981\u70b92\uff1aOpenSSL\u7684\u5efa\u94fe\u3001\u6536\u5305\u3001\u53d1\u5305\u63a5\u53e3\uff0c\u5176\u662f\u5426\u963b\u585e\u90fd\u968fsocket\u672c\u8eab\u5c5e\u6027\u800c\u53d8\uff0c\u6240\u4ee5OpenSSL\u53ef\u4ee5\u975e\u963b\u585e\u4f7f\u7528<\/p>\n \u5728\u6211\u4eec\u7684\u573a\u666f\u4e0b\uff0c\u7528epoll\u6765\u7ef4\u62a4\u673a\u5668\u4eba\u7684\u5e76\u53d1\u5efa\u8fde\u63a5\u548c\u6536\u53d1\u5305\uff0c\u5f53\u7136\u5e0c\u671b\u4efb\u4f55\u4e00\u4e2a\u52a8\u4f5c\u90fd\u662f\u975e\u963b\u585e\u7684\uff0c\u8fd9\u6837\u624d\u80fd\u5c06\u591a\u8def\u590d\u7528\u7684\u529f\u6548\u53d1\u6325\u5230\u6781\u81f4\u3002\u90a3\u73b0\u5728\u52a0\u4e86\u4e2aSSL2\u8fdb\u53bb\uff0c\u662f\u5426\u8fd8\u80fd\u4fdd\u6301\u8fd9\u4e00\u70b9\uff1f\u7b54\u6848\u662f\u80fd\u3002\u6240\u4ee5\uff0c\u8fd9\u91cc\u7684\u8981\u70b9\u662f\uff0cOpenSSL\u7684\u5efa\u7acb\u8fde\u63a5\u3001\u6536\u5305\u3001\u53d1\u5305\uff0c\u90fd\u53ef\u4ee5\u662f\u975e\u963b\u585e\u7684\u3002<\/p>\n \u5efa\u7acb\u8fde\u63a5\u4e0d\u7528\u4e0a\u56fe\u4e2d\u7684SSL_connect\uff0c\u800c\u7528SSL_do_handshake\u3002\u8fd9\u6837\uff0c\u5982\u679csocket\u672c\u8eab\u8bbe\u7f6e\u4e3a\u975e\u963b\u585e\u7684\uff0c\u90a3\u8fd9\u4e2a\u64cd\u4f5c\u4e5f\u5c31\u4e0d\u4f1a\u963b\u585e\uff0c\u800c\u662f\u6709\u4e09\u79cd\u8fd4\u56de\u53ef\u80fd\uff1a<\/p>\n <\/p>\n \u8fd4\u56de0\uff1a<\/p>\n \u610f\u5473\u7740SSL\u5c42\u7684\u4ea4\u4e92\u963b\u585e\u4e86\u3002\u76f4\u89c2\u5730\u53bb\u7406\u89e3\uff0c\u867d\u7136\u8fd9\u65f6\u5019TCP\u5df2\u7ecf\u8fde\u597d\u4e86\uff0c\u4f46\u603b\u8981\u53bb\u6536\u53d1\u4e9b\u63e1\u624b\u6570\u636e\u4ec0\u4e48\u7684\u6765\u5efa\u7acbSSL\u5c42\u8fde\u63a5\u5427\uff0c\u800c\u8fd9\u4e2a\u8fc7\u7a0b\u6536\u53d1\u6570\u636e\u963b\u585e\u4e86\u3002\u6b64\u65f6\uff0c\u7528SSL_get_error()\u53ef\u4ee5\u83b7\u53d6\u5177\u4f53\u7684\u9519\u8bef\u7801\uff1a\u82e5\u662fSSL_ERROR_WANT_READ\u6216SSL_ERROR_WANT_WRITE\uff0c\u5c31\u5728epoll\u4e2d\u5173\u6ce8\u8be5\u8fde\u63a5\u7684\u53ef\u8bfb\u6216\u53ef\u5199\u4e8b\u4ef6\uff0c\u5e76\u5728\u4e8b\u4ef6\u88ab\u89e6\u53d1\u65f6\u63a5\u7740\u8c03\u7528SSL_do_handshake\uff0c\u76f4\u5230\u8fd4\u56de\u4e0b\u9762\u76841\u3002<\/p>\n 2\uff09\u8fd4\u56de1\uff1a<\/p>\n SSL\u5c42\u5efa\u94fe\u6570\u636e\u4ea4\u4e92\u5b8c\u6210\uff0c\u53ef\u4ee5\u5f00\u59cb\u6536\u53d1\u4e1a\u52a1\u6570\u636e\u4e86<\/p>\n 3\uff09<0\uff1a<\/p>\n \u534f\u8bae\u6216\u8fde\u63a5\u5c42\u5404\u79cd\u5f02\u5e38\u51fa\u9519\uff0c\u4e0d\u518d\u8be6\u8ff0\u3002<\/p>\n \u975e\u963b\u585e\u5efa\u7acbSSL\u8fde\u63a5\u7684\u8fc7\u7a0b\u5982\u56fe\u6240\u793a\uff1a<\/p>\n <\/p>\n \u5efa\u94fe\u4e4b\u540e\uff0c\u5c31\u662f\u6536\u53d1\u6570\u636e\u4e86\u3002\u7531\u4e8esocket\u4e3a\u975e\u963b\u585e\uff0c\u6240\u4ee5\u6536\u53d1\u6570\u636e\u7684\u51fd\u6570SSL_read\u3001SSL_write\u4e00\u6837\u4f1a\u975e\u963b\u585e\u3002\u4ed6\u4eec\u7684\u53c2\u6570\u548c\u666e\u901a\u7684recv\/send\u7b49\u8bfb\u5199\u7c7b\u51fd\u6570\u5f88\u50cf\uff0c\u5c31\u662f\u4f20\u5165buff\u548clength\u8fd9\u4e9b\u3002\u9700\u8981\u6ce8\u610f\u7684\u5728\u4e8e\uff0c\u548cSSL_do_handshake\u4e00\u6837\uff0c\u5982\u679c\u8fd4\u56de\u503c\u5927\u4e8e0\uff0c\u8868\u793a\u6210\u529f\u6536\u53d1\u4e86\u4e1a\u52a1\u5c42\u6570\u636e\uff1b\u5982\u679c\u8fd4\u56de\u503c\u7b49\u4e8e0\uff0c\u5219\u9700\u8981\u5224\u65ad\u4e0b\u9519\u8bef\u7801\u662f\u4e0d\u662fSSL_ERROR_WANT_READ\u6216SSL_ERROR_WANT_WRITE\uff0c\u5373\u8bfb\u5199\u963b\u585e\u4e86\u3002<\/p>\n \u53d1\u5305\uff0c\u5373\u53d1\u9001\u4e00\u4e2a\u8bf7\u6c42\u5230HTTP\u670d\u52a1\u5668\u7684\u903b\u8f91\u5982\u4e0b\u56fe\uff1a<\/p>\n \u53ef\u4ee5\u770b\u51fa\uff0c\u53d1\u5305\u7684\u903b\u8f91\u548c\u666e\u901a\u7684\u4f7f\u7528epoll\u53d1\u5305\u7684\u903b\u8f91\u5927\u6982\u76f8\u540c\uff0c\u533a\u522b\u5728\u4e8e\u4ee5\u4e0b\u51e0\u70b9\uff1a<\/p>\n 1\uff09SSL_write\u66ff\u4ee3\u4e86\u666e\u901a\u7684send\uff1b<\/p>\n 2\uff09SSL_write\u4e5f\u4f1a\u963b\u585e\u3002\u53ea\u662f\uff0c\u6211\u4eec\u8fd9\u91cc\u53ea\u5173\u6ce8\u5199\u963b\u585e\uff08\u5373\u56fe\u4e2d\u7684\u9519\u8bef\u7801\u4e3aSSL_ERROR_WANT_WRITE\uff09\uff0c\u7136\u540e\u52a0\u5165epoll\uff0c\u5173\u6ce8socket\u7684\u53ef\u5199\u4e8b\u4ef6\u3002<\/p>\n \u4e0a\u9762\u7684\u7b2c2\u70b9\u5c31\u662fOpenSSL\u6bd4\u8f83\u5947\u8469\u7684\u4e00\u4e2a\u5730\u65b9\u4e86\uff1a\u8c03\u7528SSL_write\u53d1\u5305\uff0c\u53ef\u80fd\u8fd4\u56de\u7684\u662f\u4e00\u4e2aSSL_ERROR_WANT_READ\uff0c\u5373\u53d1\u5305\u53ef\u80fd\u963b\u585e\u5728\u8bfb\u64cd\u4f5c\uff01\u65e0\u6cd5\u7406\u89e3\u5427\u3002\u5176\u5b9e\u8fd9\u4e2a\u662f\u56e0\u4e3a\u5728HTTP\u7684\u5e95\u5c42\uff0c\u4f1a\u6709\u4e00\u4e2a\u91cd\u534f\u5546\u7684\u8fc7\u7a0b\uff0c\u8fd9\u4e2a\u8fc7\u7a0b\uff0c\u76f8\u5f53\u4e8e\u5728\u4e1a\u52a1\u6570\u636e\u6b63\u5728\u5355\u5411\u5730\u6536\u6216\u53d1\u7684\u65f6\u5019\uff0c\u7a81\u7136\u5728SSL\u94fe\u8def\u5c42\u8981\u53bb\u4ea4\u4e92\u534f\u8bae\u6570\u636e\uff0c\u91cd\u5efa\u94fe\u63a5\u4e86\u2014\u2014\u90a3\u8fd9\u4e2a\u65f6\u5019\uff0c\u91cd\u534f\u5546\u534f\u8bae\u6570\u636e\u4ea4\u4e92\u662f\u53cc\u65b9\u7684\uff0cclient\u53ef\u80fd\u521a\u597d\u5728recv\u534f\u8bae\u6570\u636e\u65f6\u88ab\u963b\u585e\u4e86\uff0c\u90a3\u5c31\u53ea\u80fd\u4e56\u4e56\u5730\u7b49socket\u53ef\u8bfb\u4e86\u2014\u2014SSL_write\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4f1a\u8fd4\u56de\u4e00\u4e2aSSL_ERROR_WANT_READ\uff0c\u7b49\u5f85\u53ef\u8bfb\u3002\u800c\u4e0b\u6b21\u53ef\u8bfb\u4e8b\u4ef6\u53d1\u751f\u65f6\uff0c\u8fd8\u9700\u8981\u91cd\u590d\u8c03\u7528SSL_write\uff0c\u76f4\u5230SSL_write\u6210\u529f\u2026\u2026\u662f\u4e0d\u662f\u6709\u70b9\u5947\u602a\uff0cepoll\u544a\u77e5\u6211\u4eecsocket\u53ef\u8bfb\u4e86\uff0c\u6211\u4eec\u5c45\u7136\u8981\u5bf9socket\u8c03\u7528\u5199\u64cd\u4f5c\u3002 \u6536\u5305\uff0c\u5373\u63a5\u6536\u670d\u52a1\u5668\u4fa7\u8fd4\u56de\u7684HTTP\u54cd\u5e94\u7684\u903b\u8f91\u5982\u4e0b\u56fe\uff1a<\/p>\n \u53ef\u4ee5\u770b\u5230\uff0c\u6536\u5305\u7684\u903b\u8f91\u548c\u53d1\u5305\u7c7b\u4f3c\uff0c\u4e5f\u662f\u6709\u53ef\u80fd\u4f1a\u56e0\u4e3a\u91cd\u534f\u5546\u4ea7\u751f\u5199\u963b\u585e\uff0c\u6211\u4eec\u5728\u5168\u53cc\u5de5\u5b9e\u73b0\u7684\u505a\u6cd5\uff0c\u4e00\u6837\u662f\u8ba4\u4e3a\u51fa\u9519\u3002<\/p>\n \u56db\u3001\u52a0\u5165\u534a\u53cc\u5de5\u5f00\u5173\u2014\u2014\u91cd\u534f\u5546\u8003\u8651<\/strong><\/div>\n \u8981\u70b93\uff1a\u5f53SSL_read\u6216SSL_write\u963b\u585e\u65f6\uff0c\u9700\u8981\u5728SSL\u5bf9\u8c61\u4e0a\u91cd\u590d\u8c03\u7528\u8be5\u64cd\u4f5c\u76f4\u5230\u6536\u53d1\u5b8c\u6210<\/p>\n \u8981\u70b93\u6b63\u662f\u6211\u4eec\u4e0a\u9762\u63d0\u5230\u7684\u5947\u8469\u4e4b\u5904\u3002\u8fd9\u4e5f\u662f\u5728OpenSSL\u7684\u5b98\u65b9\u6587\u6863\u4e2d\u8bf4\u660e\u4e86\u7684\uff1a<\/p>\n \u6240\u4ee5\uff0c\u6211\u4eec\u5982\u679c\u9700\u8981\u771f\u6b63\u652f\u6301\u91cd\u534f\u5546\uff0c\u5c31\u5fc5\u987b\u6709\u4e00\u79cd\u534a\u53cc\u5de5\u7684\u5b9e\u73b0\u2014\u2014\u8fd9\u79cd\u5b9e\u73b0\u4f1a\u5728\u6536\u53d1\u5305\u963b\u585e\u5728\u5bf9\u5e94\u7684\u64cd\u4f5c\u540e\uff0c\u8bb0\u5f55\u4e00\u4e2a\u4e2d\u95f4\u72b6\u6001\uff0c\u4e0d\u5904\u7406\u5f53\u524d\u4e0d\u671f\u671b\u7684\u6536\u6216\u53d1\uff0c\u76f4\u5230\u4e4b\u524d\u88ab\u963b\u585e\u7684\u64cd\u4f5c\u5b8c\u6210\u3002\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u76f8\u5f53\u4e8e\u5bf9\u8fd9\u4e2a\u81ea\u5b9a\u4e49\u7684\u72b6\u6001\u7ef4\u62a4\u4e86\u4e00\u4e2a\u72b6\u6001\u673a\u3002\u7531\u4e8e\u5b9e\u9645\u5b9e\u73b0\u975e\u5e38\u590d\u6742\uff0c\u6240\u4ee5\u4ee3\u7801\u7ec6\u8282\u5c31\u4e0d\u5728\u8fd9\u91cc\u8d34\u4e86\u3002\u6982\u62ec\u4e00\u4e0b\uff0c\u5927\u6982\u662f\u4e0b\u9762\u7684\u8fd9\u4e2a\u72b6\u6001\u673a\u8f6c\u79fb\u56fe\u548c\u4e00\u4e9b\u8981\u70b9\uff1a<\/p>\n <\/p>\n \u5982\u4e0a\u56fe\uff1a<\/p>\n 1\uff09\u201c\u6b63\u5e38\u72b6\u6001\u201d\u53ef\u4ee5\u8ba4\u4e3a\u8fde\u63a5\u5f53\u524d\u662f\u7a7a\u95f2\u7684\uff0c\u4e0d\u9700\u8981\u6536\u53d1\u6570\u636e\uff1b \u5982\u6b64\uff0c\u4e00\u4e2a\u534a\u53cc\u5de5\u7684HTTPS\u5ba2\u6237\u7aef\u5b9e\u73b0\u5c31\u6709\u4e86\u3002\u4f46\u5b83\u7684\u7f3a\u9677\u5f88\u660e\u663e\uff1a\u6bcf\u6b21\u8bfb\u3001\u5199\u64cd\u4f5c\u90fd\u53ef\u80fd\u963b\u585e\u53e6\u4e00\u4e2a\u65b9\u5411\u4e0a\u7684\u6570\u636e\u4f20\u8f93\uff0c\u6027\u80fd\u4f1a\u6709\u6025\u5267\u7684\u4e0b\u964d\u3002\u7531\u4e8e\u901a\u5e38\u670d\u52a1\u5668\u7aef\u5e76\u4e0d\u63a8\u8350\u91cd\u534f\u5546\u7684\u8fc7\u7a0b\uff0c\u6240\u4ee5\u8fd9\u79cd\u60c5\u51b5\u4e5f\u662f\u5f88\u5c11\u89c1\u7684\u3002\u56e0\u800c\uff0c\u5168\u53cc\u5de5\u7684\u5b9e\u73b0\u52a0\u4e86\u5f00\u5173\uff0c\u5f53\u666e\u901aHTTPS\u670d\u52a1\u5668\u8fdb\u884c\u538b\u6d4b\u65f6\uff0c\u5173\u95ed\u5f00\u5173\uff0c\u4fdd\u8bc1\u6027\u80fd\uff1b\u5f53\u9762\u5bf9\u771f\u6709\u91cd\u534f\u5546\u8fd9\u79cd\u7279\u6b8a\u9700\u6c42\u7684\u670d\u52a1\u5668\u65f6\uff0c\u624d\u6253\u5f00\u5f00\u5173\u3002<\/p>\n \u4e94\u3001HTTPS\u6d4b\u8bd5\u529f\u80fd\u7684\u4f7f\u7528<\/strong><\/div>\n \u4e0b\u9762\uff0c\u6211\u4eec\u6765\u770b\u4e00\u4e0b\u5982\u4f55\u5728\u7b80\u5355\u6a21\u5f0f\u4e2d\u8fdb\u884cHTTPS\u9875\u9762\u7684\u670d\u52a1\u5668\u6027\u80fd\u6d4b\u8bd5\u3002<\/p>\n 1) \u70b9\u51fb\u670d\u52a1\u5668\u6027\u80fd\u6d4b\u8bd5\u4ea7\u54c1\u9996\u9875\uff08http:\/\/wetest.qq.com\/gaps\/\uff09\u4e2d\u7684\u5feb\u6377\u5165\u53e3\uff1aHTTP\u76f4\u538b\u3002\u6a21\u5f0f\u9009\u62e9\u7b80\u5355\u6a21\u5f0f\uff0c\u540d\u79f0\u548c\u63cf\u8ff0\u53ef\u4ee5\u81ea\u5df1\u586b\u5199\u3002\uff08\u56fe\u4e2d\u793a\u4f8b\u8d77\u59cb\u4eba\u657050\u4eba\uff0c\u6bcf\u969460\u79d2\u589e\u52a050\u4eba\uff0c\u52a0\u5230200\u4eba\u4e3a\u4e0a\u9650\uff09<\/p>\n \u70b9\u51fb\u5de6\u4fa7\u201cHTTP\u76f4\u538b\u201c\u8fdb\u5165\u538b\u6d4b<\/p>\n <\/p>\n \u8f93\u5165\u5408\u9002\u7684\u6d4b\u8bd5\u6807\u9898\u548c\u6d4b\u8bd5\u8bbe\u7f6e<\/p>\n \uff08\u6b64\u56fe\u4e3a\u52a8\u56fe\uff0c\u6a2a\u5c4f\u89c2\u770b\u6548\u679c\u66f4\u4f73\uff09<\/p>\n 2\uff09\u65b0\u5efa\u4e00\u4e2a\u5ba2\u6237\u7aef\u8bf7\u6c42\uff0c\u63a5\u53e3\u538b\u6d4b\u5305\u62ec\u8bfb\u5199\u63a5\u53e3\uff0c\u8bfb\u63a5\u53e3\u57fa\u672c\u662fGET\u8bf7\u6c42\uff0c\u5199\u63a5\u53e3\u57fa\u672c\u662fPOST\u8bf7\u6c42\u3002GET\u8bf7\u6c42\u4f7f\u7528url\u8bf7\u6c42\u53c2\u6570\uff0c\u586b\u5199\u6d4b\u8bd5\u7528\u4f8b\u7684\u57fa\u7840\u6570\u503c\uff0c\u9009\u62e9\u6b63\u786e\u7684URL<\/p>\n \u914d\u7f6e\u9875\u9762header\u4fe1\u606f<\/p>\n 3\uff09 \u968f\u540e\u8fdb\u884cHeader\u7684\u914d\u7f6e\uff0cHeader\u7684\u540d\u79f0\u5728\u9009\u5b9aURL\u7684\u5185\uff0c\u6253\u5f00URL\u7684\u94fe\u63a5\uff08\u63a8\u8350\u4f7f\u7528chrome\u6d4f\u89c8\u5668\uff09\uff0c\u6572\u51fbF12\u5e76\u5237\u65b0\u9875\u9762\uff0c\u9009\u5b9aNetwork-Name-Headers-Request Headers\uff08Header\u7684\u540d\u79f0\u4e0e\u503c\u5747\u5728\u5185\u67e5\u770b\uff0c\u5982\u4e0b\u56fe\u6240\u793a\uff09<\/p>\n \u67e5\u770b\u9875\u9762header\u4fe1\u606f<\/p>\n \u5230\u8fd9\u91cc\uff0c\u57fa\u672c\u5c31\u5b8c\u6210\u4e86\u5bf9HTTPS\u7684\u914d\u7f6e\u8fc7\u7a0b\u4e86\uff0c\u662f\u4e0d\u662f\u5f88\u7b80\u5355\uff1f\u4e0b\u9762\u52a8\u56fe\u53ef\u4ee5\u518d\u56de\u987e\u4e00\u4e0b\u64cd\u4f5c\u7684\u6d41\u7a0b\uff1a<\/p>\n <\/p>\n gif\u52a8\u6001\u56fe\u5c55\u793a\u64cd\u4f5c\u7684\u6d41\u7a0b<\/p>\n \uff08\u6b64\u56fe\u4e3a\u52a8\u56fe\uff0c\u6a2a\u5c4f\u89c2\u770b\u6548\u679c\u66f4\u4f73\uff09<\/p>\n \n |