コード例 #1
0
int httpclient_set_header(HttpClient* httpClient, HttpHeader *httpHeader){
    if(httpClient == NULL || httpHeader == NULL){
        printf("httpHeader and httpClient must not be null\n");
        return -1;
    }

    request_set_header(httpClient->request, httpHeader);
}
コード例 #2
0
ファイル: http-retriver.c プロジェクト: yanheven/stockmew
static struct request *prepare_request(char *host_name, char *full_path)
{
	const char *meth = "GET";
	struct request *req = NULL;

	req = (struct request *)malloc(sizeof(struct request));

	// Set method
	req->method = meth;
	req->arg = full_path;

	// Initialize header parameter
	req->hcapacity = 8;
	req->headers = (struct request_header*)malloc (sizeof(struct request_header*)*req->hcapacity);
	req->hcount = 0;

	//	request_set_header (req, "Referer", (char *) hs->referer, rel_none);
	request_set_header (req, "Accept", "*/*", rel_none);
	request_set_header (req, "Host", host_name, rel_value);
	request_set_header (req, "Connection", "Keep-Alive", rel_none);

	return req;
}