Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with curl_easy_perform #3

Open
hamishbobcares opened this issue Jul 31, 2015 · 0 comments
Open

Problem with curl_easy_perform #3

hamishbobcares opened this issue Jul 31, 2015 · 0 comments

Comments

@hamishbobcares
Copy link

Hi Atiti,
Thanks for your work on this module. I understand that development of this module has been dropped, but I can't find any alternatives :(

The problem I'm having with this module is that the call to the CAS server to validate the ticket is not happening. Specifically in this part of the code:

int URL_GET_request(struct URL_Request u, char *url, struct string *out) {
int len = 0;
FILE
filep;
filep = fopen("/var/log/curllog", "wb");

ifdef URL_DEBUG

    LOG_MSG(LOG_INFO, "GET URL: %s\n", url);

endif

    curl_easy_setopt(u->curl, CURLOPT_URL, url);
    curl_easy_setopt(u->curl, CURLOPT_WRITEFUNCTION, URL_writefunc);
    curl_easy_setopt(u->curl, CURLOPT_WRITEDATA, out);
    curl_easy_setopt(u->curl, CURLOPT_FOLLOWLOCATION, 1);
    curl_easy_setopt(u->curl, CURLOPT_VERBOSE, 1L);
    curl_easy_setopt(u->curl, CURLOPT_STDERR, filep);

ifdef SKIP_PEER_VERIFICATION

    curl_easy_setopt(u->curl, CURLOPT_SSL_VERIFYPEER, 0L);

endif

ifdef SKIP_HOSTNAME_VERIFICATION

    curl_easy_setopt(u->curl, CURLOPT_SSL_VERIFYHOST, 0L);

endif

    u->res = curl_easy_perform(u->curl);
    return len;

}

I've added a few extra lines to increase verbosity. The URL is generated properly, but no requests reach the CAS server. The output in /var/log/curllog is:

  • Hostname was NOT found in DNS cache
  • Could not resolve host: mydomain.com
  • Closing connection 0

I tested the same URL in another simple C program, that works fine and the request reaches the CAS server:

include <curl/curl.h>

size_t curl_write( void _ptr, size_t size, size_t nmemb, void *stream)
{
return fwrite(ptr, size, nmemb, stdout);
}
int main(int argc, char *_argv)
{
FILE* filep;
filep = fopen("/var/log/curllog", "wb");
CURL *curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_URL, "https://mydomain.com:8443/cas/serviceValidate?service=https%3A%2F%2Flocalhost%2Fsomething&ticket=ST-28-e7ItglFQ7ljwasdfaswldi7QWEWGFSasdgsa-mydomain.com");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_write);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_STDERR, filep);

curl_easy_perform(curl);
curl_easy_cleanup(curl);
}

I checked for all possible DNS issues, but could not find any. I feel its something simple, but just can't identify what it is. Any help you could provide on this would be extremely appreciated!!

Oscar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant