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

Function http_util_req_open

lib_protocol/src/http/http_util.c:210–246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

208}
209
210int http_util_req_open(HTTP_UTIL *http_util)
211{
212 const char *myname = "http_util_req_open";
213 int ret;
214
215 /* ����Զ�� http ������ */
216
217 http_util->stream = acl_vstream_connect(http_util->server_addr,
218 ACL_BLOCKING /* ����������ʽ */,
219 http_util->conn_timeout /* ���ӳ�ʱʱ�� */,
220 http_util->rw_timeout /* ���� IO ������ʱʱ�� */,
221 4096 /* stream ����������СΪ 4096 �ֽ� */);
222 if (http_util->stream == NULL) {
223 acl_msg_error("%s(%d): connect %s error(%s)",
224 myname, __LINE__, http_util->server_addr,
225 acl_last_serror());
226 return (-1);
227 }
228
229 /* ���� HTTP ����ͷ���� */
230
231 http_hdr_build_request(http_util->hdr_req, http_util->req_buf);
232
233 /* �� HTTP �������������� */
234
235 ret = acl_vstream_writen(http_util->stream,
236 acl_vstring_str(http_util->req_buf),
237 ACL_VSTRING_LEN(http_util->req_buf));
238 if (ret == ACL_VSTREAM_EOF) {
239 acl_msg_error("%s(%d): send request to server(%s) error(%s)",
240 myname, __LINE__, http_util->server_addr,
241 acl_last_serror());
242 return (-1);
243 }
244
245 return (0);
246}
247
248int http_util_put_req_data(HTTP_UTIL *http_util, const char *data, size_t dlen)
249{

Callers 3

get_urlFunction · 0.85
http_util_dump_urlFunction · 0.85

Calls 5

acl_vstream_connectFunction · 0.85
acl_msg_errorFunction · 0.85
acl_last_serrorFunction · 0.85
http_hdr_build_requestFunction · 0.85
acl_vstream_writenFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…