MCPcopy Create free account
hub / github.com/acl-dev/acl / request_header_ready

Function request_header_ready

app/jaws/module/mod_http/http_proxy.c:1155–1226  ·  view source on GitHub ↗

* �ɹ�����HTTP����ͷ��Ļص����� */

Source from the content-addressed store, hash-verified

1153 * �ɹ�����HTTP����ͷ��Ļص�����
1154 */
1155static 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

Callers

nothing calls this directly

Calls 9

http_proxy_completeFunction · 0.85
http_hdr_req_parse3Function · 0.85
acl_msg_errorFunction · 0.85
http_hdr_entry_valueFunction · 0.85
http_hdr_put_strFunction · 0.85
acl_msg_warnFunction · 0.85
acl_aio_writenFunction · 0.85
acl_msg_fatalFunction · 0.85
handle_oneFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…