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 7757373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:04:36+00:00 2026-06-01T13:04:36+00:00

I have a crawler that for HTTPs switches over to Wininet. This usually works

  • 0

I have a crawler that for HTTPs switches over to Wininet.

This usually works well, but for a website I get error
ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED

Example code:

vErrorNone := HttpSendRequest(HttpOpen_Request, nil, 0, nil, 0);
if vErrorNone = False then
  begin
    vErrorID := GetLastError;
    if (vErrorID = ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED) then
      begin
        // this error
      end
    ;
  end
;

I then tried an experiment with:

      TmpFakePointer := nil;
      vErrorNone :=
        InternetErrorDlg(
          GetDesktopWindow()
          ,
          HttpOpen_Request
          ,
          ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED
          ,
          0
          or FLAGS_ERROR_UI_FILTER_FOR_ERRORS
          or FLAGS_ERROR_UI_FLAGS_GENERATE_DATA
          or FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS
          ,
          TmpFakePointer
        )
        = ERROR_SUCCESS
      ;
      if vErrorNone then
        begin
          vErrorNone := HttpSendRequest(HttpOpen_Request, nil, 0, nil, 0);
        end
      ;

However, two things are odd here:

  • 1) No dialog shows
  • 2) It works
  • 2.1) No error on second HttpSendRequest
  • 2.2) Valid data returned

It find above combination very odd and contrary to documentation. Since user has not selected any certificate, why does this work? If Wininet falls back to anonymous client authentication certificate when the dialog can not be shown (I am assuming I have given it incorrect handle to show dialog? Although it errors if I explicitly give it a wrong handle) is there any way to pick that directly without the call to InternetErrorDlg?

  • 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-01T13:04:38+00:00Added an answer on June 1, 2026 at 1:04 pm

    Well

    There are two things you can do:

    1: Show the certificate error to the user and let him decide or not to continue.
    2: Ignore any certificate errors you get.

    I am gonna show you how to do the second option:

    When you get the ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED or any other certificate error you need to call InternetSetOptions to tell wininet that it should ignore the error and continue. After that, you have to re-send the request.

    function SetToIgnoreCerticateErrors(var aErrorMsg: string): Boolean;
    var
      vDWFlags: DWord;
      vDWFlagsLen: DWord;
    begin
      Result := False;
      try
        vDWFlagsLen := SizeOf(vDWFlags);
        if not InternetQueryOptionA(oRequestHandle, INTERNET_OPTION_SECURITY_FLAGS, @vDWFlags, vDWFlagsLen) then begin
          aErrorMsg := 'Internal error in SetToIgnoreCerticateErrors when trying to get wininet flags.' + GetWininetError;
          Exit;
        end;
        vDWFlags := vDWFlags or SECURITY_FLAG_IGNORE_UNKNOWN_CA or SECURITY_FLAG_IGNORE_CERT_DATE_INVALID or SECURITY_FLAG_IGNORE_CERT_CN_INVALID or SECURITY_FLAG_IGNORE_REVOCATION;
        if not InternetSetOptionA(oRequestHandle, INTERNET_OPTION_SECURITY_FLAGS, @vDWFlags, vDWFlagsLen) then begin
          aErrorMsg := 'Internal error in SetToIgnoreCerticateErrors when trying to set wininet INTERNET_OPTION_SECURITY_FLAGS flag .' + GetWininetError;
          Exit;
        end;
        Result := True;
      except
        on E: Exception do begin
          aErrorMsg := 'Unknown error in SetToIgnoreCerticateErrors.' + E.Message;
        end;
      end;
    end;
    
    
    vErrorNone := HttpSendRequest(HttpOpen_Request, nil, 0, nil, 0);
    if vErrorNone = False then
      begin
        vErrorID := GetLastError;
        if (vErrorID = ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED) then
        begin
          //call SetToIgnoreCerticateErrors
          //re-send the request 
        end
      end
    end;
    

    I have extracted the SetToIgnoreCerticateErrors from my wininet API and it may not compile exactly how it is.

    Those are the steps:

    1 – Get the error
    2 – Check if the error is an certificate error
    3 – If it is a certificate error, them call InternetSetOption as I did.
    4 – Re-send the request.

    I don’t know how to implement the first option “Show the certificate error to the user and let him decide or not to continue.” because I never had to do it.

    Also, check this out: How To Handle Invalid Certificate Authority Error with WinInet

    I hope it helps you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This might be a confusing question but I have written below a Directory crawler,
I get this error becouse i am using ccnet and i don't have installed
I have a question about how the google crawler (googlebot) will do in this
I have a simple web crawler that starts at root (given url) downloads the
I have implemented a web crawler that crawls and retrieves content from .edu TLD.
I have a php web page that now uses custom error pages when a
So, here's my question: I have a crawler that goes and downloads web pages
I have a DotNetNuke skin that has a single CSS file over 3,500 lines
I'm trying to get crawl to work on two separate farms I have but
I have a crawler that downloads webpages, scrapes specific content and then stores that

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.