Esempio n. 1
0
CgHttpRequest *cg_http_request_new()
{
    CgHttpRequest *httpReq;

    cg_log_debug_l4("Entering...\n");

    httpReq = (CgHttpRequest *)malloc(sizeof(CgHttpRequest));

    if ( NULL != httpReq )
    {
        cg_http_packet_init((CgHttpPacket *)httpReq);
        httpReq->method = cg_string_new();
        httpReq->version = cg_string_new();
        httpReq->uri = cg_string_new();
        httpReq->userAgent = cg_string_new();
        httpReq->httpRes = cg_http_response_new();
        httpReq->postURL = cg_net_url_new();

        cg_http_request_setversion(httpReq, CG_HTTP_VER11);
        cg_http_request_setuseragent(httpReq, CG_HTTP_USERAGENT_DEFAULT);

        cg_http_request_setsocket(httpReq, NULL);
        cg_http_request_setuserdata(httpReq, NULL);

        cg_http_request_settimeout(httpReq, CG_HTTP_CONN_TIMEOUT);
    }

    cg_log_debug_l4("Leaving...\n");

    return httpReq;
}
Esempio n. 2
0
CgHttpPacket *cg_http_packet_new()
{
	CgHttpPacket *httpPkt;

	cg_log_debug_l4("Entering...\n");

	httpPkt= (CgHttpPacket *)malloc(sizeof(CgHttpPacket));

	if ( NULL != httpPkt )
	{
		cg_http_packet_init(httpPkt);
	}

	cg_log_debug_l4("Leaving...\n");

	return httpPkt;
}