* �ɹ�����HTTP����ͷ��Ļص����� */
| 1153 | * �ɹ�����HTTP����ͷ��Ļص����� |
| 1154 | */ |
| 1155 | static int request_header_ready(int status, void *arg) |
| 1156 | { |
| 1157 | const char *myname = "request_header_ready"; |
| 1158 | HTTP_CLIENT_REQ *req = (HTTP_CLIENT_REQ *) arg; |
| 1159 | HTTP_CLIENT *http_client = req->http_client; |
| 1160 | const char *via; |
| 1161 | static char *via_static = NULL; |
| 1162 | static int via_max = 256; |
| 1163 | |
| 1164 | /* ȡ���ͻ�����������״̬ */ |
| 1165 | http_client->flag &= ~HTTP_FLAG_CLIENT_LOCKED; |
| 1166 | |
| 1167 | if (status != HTTP_CHAT_OK) { |
| 1168 | http_proxy_complete(http_client, -1); |
| 1169 | return (0); |
| 1170 | } |
| 1171 | |
| 1172 | if (http_hdr_req_parse3(req->hdr_req, 0 , 0) < 0) { |
| 1173 | acl_msg_error("%s: parse hdr_req error", myname); |
| 1174 | http_proxy_complete(http_client, -1); |
| 1175 | return (0); |
| 1176 | } |
| 1177 | |
| 1178 | #ifdef WIN32 |
| 1179 | #define snprintf _snprintf |
| 1180 | #endif |
| 1181 | |
| 1182 | if (via_static == NULL) { |
| 1183 | via_static = (char*) acl_mycalloc(1, via_max); |
| 1184 | snprintf(via_static, via_max, "jaws-%d", getpid()); |
| 1185 | } |
| 1186 | |
| 1187 | /* ����Ƿ������·���� */ |
| 1188 | |
| 1189 | via = http_hdr_entry_value(&req->hdr_req->hdr, "x-via-jaws"); |
| 1190 | if (via == NULL) { |
| 1191 | http_hdr_put_str(&req->hdr_req->hdr, "x-via-jaws", via_static); |
| 1192 | } else if (strcasecmp(via, via_static) == 0) { |
| 1193 | acl_msg_warn("%s(%d): loop tested, via(%s), url(http://%s%s)", |
| 1194 | myname, __LINE__, via, req->hdr_req->host, |
| 1195 | acl_vstring_str(req->hdr_req->url_part)); |
| 1196 | |
| 1197 | /* �����ͻ����� */ |
| 1198 | http_client->flag |= HTTP_FLAG_CLIENT_LOCKED; |
| 1199 | |
| 1200 | acl_aio_writen(http_client->entry.client, |
| 1201 | HTTP_REQUEST_LOOP, |
| 1202 | (int) strlen(HTTP_REQUEST_LOOP)); |
| 1203 | |
| 1204 | /* ȡ���ͻ�����������״̬ */ |
| 1205 | http_client->flag &= ~HTTP_FLAG_CLIENT_LOCKED; |
| 1206 | http_proxy_complete(http_client, -1); |
| 1207 | return (0); |
| 1208 | } |
| 1209 | |
| 1210 | /* �������Ѿ���ɣ�ȡ����ȴ�״̬ */ |
| 1211 | req->flag &= ~CLIENT_READ_WAIT; |
| 1212 |
nothing calls this directly
no test coverage detected
searching dependent graphs…