| 1031 | } |
| 1032 | |
| 1033 | static int http_proxy_connect_complete(CLIENT_ENTRY *entry) |
| 1034 | { |
| 1035 | HTTP_CLIENT *http_client = (HTTP_CLIENT*) entry; |
| 1036 | const char *method = http_client->req_curr->hdr_req->method; |
| 1037 | |
| 1038 | /* ���ӷ������ر�ʱ�Ļص����� */ |
| 1039 | acl_aio_add_close_hook(http_client->entry.server, |
| 1040 | on_close_server, http_client); |
| 1041 | |
| 1042 | /* CONNECT ����, ת�� TCP ����ģʽ, �Ӷ�����֧�� SSL */ |
| 1043 | if (var_cfg_http_method_connect_enable && strcasecmp(method, "CONNECT") == 0) { |
| 1044 | if (entry->client == NULL) { |
| 1045 | acl_msg_warn("%s(%d): client null", __FILE__, __LINE__); |
| 1046 | http_proxy_complete(http_client, -1); |
| 1047 | return (0); |
| 1048 | } |
| 1049 | |
| 1050 | acl_aio_writen(entry->client, HTTP_CONNECT_FIRST, |
| 1051 | (int) strlen(HTTP_CONNECT_FIRST)); |
| 1052 | if (entry->client && entry->server) { |
| 1053 | tcp_start(entry); |
| 1054 | return (0); |
| 1055 | } else { |
| 1056 | http_proxy_complete(http_client, -1); |
| 1057 | return (0); |
| 1058 | } |
| 1059 | } |
| 1060 | |
| 1061 | if (strcasecmp(method, "GET") != 0 && strcasecmp(method, "POST") != 0) { |
| 1062 | if (entry->client == NULL) { |
| 1063 | acl_msg_error("%s(%d): client null", __FILE__, __LINE__); |
| 1064 | } else |
| 1065 | acl_aio_writen(entry->client, HTTP_REQUEST_INVALID, |
| 1066 | (int) strlen(HTTP_REQUEST_INVALID)); |
| 1067 | acl_msg_error("%s(%d): method(%s) invalid", |
| 1068 | __FILE__, __LINE__, method); |
| 1069 | http_proxy_complete(http_client, -1); |
| 1070 | return (0); /* ���أ�1��ʹ�첽��ܹرո��첽�� */ |
| 1071 | } |
| 1072 | |
| 1073 | /* ���� GET��POST ���� */ |
| 1074 | start_forward_request(http_client); |
| 1075 | return (0); |
| 1076 | } |
| 1077 | |
| 1078 | static void http_proxy_connect_timeout(CLIENT_ENTRY *entry) |
| 1079 | { |
nothing calls this directly
no test coverage detected
searching dependent graphs…