Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8966811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:06:10+00:00 2026-06-15T17:06:10+00:00

When we send a http message with: res= curl_easy_perform(curl); How to detect the authentication

  • 0

When we send a http message with:

res= curl_easy_perform(curl);

How to detect the authentication failure from libcur in case that the http message was sent with wrong login or password?

I checked the value of res for both success and failure and I found it = to 0

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T17:06:11+00:00Added an answer on June 15, 2026 at 5:06 pm

    curl_easy_perform will return 0 if the request went through successfully.

    Bad authentication typically results in a 401 Unauthorized HTTP response code. However, cURL doesn’t count that as a request error. An example of request error is CURLE_URL_MALFORMAT, which would be returned if your request URL was incorrectly formatted, which would mean the request didn’t even hit the remote server.

    Some may advise you to use CURLOPT_FAILONERROR to make curl_easy_perform fail if the response code is greater or equal to 400. However, the libcurl documentation expressly warns you about that:

    This method is not fail-safe and there are occasions where non-successful response codes will slip through, especially when authentication is involved (response codes 401 and 407).

    The proper way to check for authentication errors would be to use curl_easy_getinfo to fetch the HTTP response code, e.g.:

    CURLcode res = curl_easy_perform(curl);
    long httpCode = 0;
    curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpCode);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I am trying to send a simple HTTP message from Flex to C#
In Java, How to compose an HTTP request message and send it to an
I need to send a http post request from my android device to a
I'm using curl to make php send an http request to some website somewhere
I am talking to a server that used to send me HTTP strings like
I have the following code that works on PHP5 to send a HTTP POST
I am attempting to create a simple app that can send a text message
Iv'e been working with some code that will send a sms message and when
I'm using DefaultHttpClient with a ThreadSafeClientConnManager on Android (2.3.x) to send HTTP requests to
How to send an http request with either post/get method using javascript as an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.