I need clarifications on using libcurl for the following:
I need to send an http HEAD request shown as below ::
HEAD /mshare/3/30002:12:primary/stream_xNKNVH.mpeg HTTP/1.1
Host: 192.168.70.1:8080
Accept: */*
User-Agent: Kreatel_IP-STB
getcontentFeatures.dlna.org: 1
The code I wrote (shown below) , sends the HEAD Request in slightly different way:
curl_global_init(CURL_GLOBAL_ALL);
CURL* ctx = NULL;
const char *url = "http://192.168.70.1:8080/mshare/3/30002:12:primary/stream_xNKNVH.mpeg" ;
char *returnString;
struct curl_slist *headers = NULL;
ctx = curl_easy_init();
headers = curl_slist_append(headers,"Accept: */*");
headers = curl_slist_append(headers,"User-Agent: Kreatel_IP-STB");\
headers = curl_slist_append(headers,"getcontentFeatures.dlna.org: 1");
headers = curl_slist_append(headers,"Pragma:");
headers = curl_slist_append(headers,"Proxy-Connection:");
curl_easy_setopt(ctx,CURLOPT_HTTPHEADER , headers );
curl_easy_setopt(ctx,CURLOPT_NOBODY ,1 );
curl_easy_setopt(ctx,CURLOPT_VERBOSE, 1);
curl_easy_setopt(ctx,CURLOPT_URL,url );
curl_easy_setopt(ctx,CURLOPT_NOPROGRESS ,1 );
curl_easy_perform(ctx);
curl_easy_cleanup(ctx);
curl_global_cleanup();
The code shown above sends the HEAD Request in slightly different form, adding a Proxy-Connection
header (shown below)
HEAD http://192.168.70.1:8080/mshare/3/30002:12:primary/stream_xNKNVH.mpeg HTTP/1.1
Host: 192.168.70.1:8080
Proxy-Connection: Keep-Alive
Accept: */*
User-Agent: Kreatel_IP-STB
getcontentFeatures.dlna.org: 1
Can any one , share the appropriate code ?