Native client: libcurl say Host_could_not_resolved when trying http Get operation.

49 views
Skip to first unread message

Rajeev Kumar

unread,
Jul 25, 2015, 9:30:31 AM7/25/15
to Native-Client-Discuss
HI I am writting a NaCl application using Ubuntu. My http Get operation get failed and says Host could not be resolved using the libCurl library.
Can you please add some advice if anyone faced the same issue.

here is my code taken from Curl example:

  CURL *curl;
  CURLcode res;
 
  /* In windows, this will init the winsock stuff */ 
  curl_global_init(CURL_GLOBAL_ALL);
 
  /* get a curl handle */ 
  curl = curl_easy_init();
  if(curl) {
    /* First set the URL that is about to receive our POST. This URL can
       just as well be a https:// URL if that is what should receive the
       data. */ 
    curl_easy_setopt(curl, CURLOPT_URL, "http://postit.example.com/moo.cgi");
    /* Now specify the POST data */ 
    curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "name=daniel&project=curl");
 
    /* Perform the request, res will get the return code */ 
    res = curl_easy_perform(curl);
    /* Check for errors */ 
    if(res != CURLE_OK)
      fprintf(stderr, "curl_easy_perform() failed: %s\n",
              curl_easy_strerror(res));
 
    /* always cleanup */ 
    curl_easy_cleanup(curl);
  }
  curl_global_cleanup();

Sam Clegg

unread,
Jul 27, 2015, 8:27:46 PM7/27/15
to native-cli...@googlegroups.com
Are you trying to run the NaCl module in a chrome app or in normal
tab? For the former you need to specify the require permissions in
your manifest.json. For the latter you need run chrome with the
--allow-nacl-socket-api=<origin> flag where origin is the origin that
hosts the nacl module. BTW this flag is for testing only, there is no
generally available way to use the socket API outside of chrome apps.

Also, make sure you are not running on the main thread (if you use the
ppapi_simple library this is taken care of for you).

cheers,
sam
> --
> You received this message because you are subscribed to the Google Groups
> "Native-Client-Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to native-client-di...@googlegroups.com.
> To post to this group, send email to native-cli...@googlegroups.com.
> Visit this group at http://groups.google.com/group/native-client-discuss.
> For more options, visit https://groups.google.com/d/optout.

Venkatachalapathi Garapani

unread,
Jul 27, 2015, 10:21:26 PM7/27/15
to Native-Client-Discuss, s...@chromium.org
Hi sam,

I am also facing the same problem. Is curl is limited to chrome packed app or we can use it in extension. My project needs to be in extension.
Regarding the permissions, what permissions we need to give in manifest.json. during deubgging , will it consider manifest.json file.

Thanks in advance.
Venkat

Venkatachalapathi Garapani

unread,
Jul 27, 2015, 10:22:40 PM7/27/15
to Native-Client-Discuss, rak...@ipass.com
Hi sam,

I am also facing the same problem. Is curl is limited to chrome packed app or we can use it in extension. My project needs to be in extension.
Regarding the permissions, what permissions we need to give in manifest.json. during deubgging , will it consider manifest.json file.

Thanks in advance.
Venkat


Rajeev Kumar

unread,
Jul 28, 2015, 1:06:54 AM7/28/15
to Native-Client-Discuss, s...@chromium.org

Sam,
I already tried what you suggested, but that  work only for the socket(Chrome SDK sample socket). For libCurl no luck with the provided settings.
one more thing, if i execute libCirl in standalone linux there is no such issue so i guss there should not be any system related like DNS issue.
Any suggestion why Socket is working but not the libCurl.

Rajeev Kumar

unread,
Jul 28, 2015, 1:08:06 AM7/28/15
to Native-Client-Discuss, rak...@ipass.com
Sam,
I already tried what you suggested, but that  work only for the socket(Chrome SDK sample socket). For libCurl no luck with the provided settings.
one more thing, if i execute libCirl in standalone linux there is no such issue so i guss there should not be any system related like DNS issue.
Any suggestion why Socket is working but not the libCurl.

thanks.
Reply all
Reply to author
Forward
0 new messages