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

  • Home
  • SEARCH
  • 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 54563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:14:23+00:00 2026-05-10T17:14:23+00:00

I am writing a command-line tool for Windows that uses libcurl to download files

  • 0

I am writing a command-line tool for Windows that uses libcurl to download files from the internet.

Obviously, the downloading doesn’t work when the user is behind a proxy server, because the proxy needs to be configured. I want to keep my tool as simple as possible however, and not have to burden the user with having to configure the proxy. My tool doesn’t even have a config file, so the user would otherwise have to pass in the proxy settings on every command, or set an environment variable or somesuch — way too much hassle.

So I thought, everyone’s browser will usually already be set up properly, proxy configured and everything. This will be true for even the most basic user because otherwise ‘their internet wouldn’t work’.

So I figure that I can find out whether to use a proxy by looking at IE’s proxy settings.

How do I go about this? More specifically:

  • Is there one set of ‘proxy settings’ in Windows, used by all browsers (probably IE’s), or would I have to write different routines for IE, Firefox, Opera, etc?
  • I know that I can probably read the values directly out of the appropriate registry locations if they are configured manually, but does this also work with ‘automatically detect proxy server?’ Do I even have to bother with that option, or is it (almost) never used?

Before people start suggesting alternatives: I’m using C, so I’m limited to the Win32 API, and I really really want to keep using C and libcurl.

  • 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. 2026-05-10T17:14:23+00:00Added an answer on May 10, 2026 at 5:14 pm

    The function you’re looking for is WinHttpGetIEProxyConfigForCurrentUser(), which is documented at http://msdn.microsoft.com/en-us/library/aa384096(VS.85).aspx. This function is used by Firefox and Opera to get their proxy settings by default, although you can override them per-browser. Don’t do that, though. The right thing to do (which is what everybody else does) is to just get the IE settings and assume that they’re correct, since they almost always are.

    Here’s a sample of the relevant logic, which you should adapt for your needs:

    if( WinHttpGetIEProxyConfigForCurrentUser( &ieProxyConfig ) ) {     if( ieProxyConfig.fAutoDetect )     {         fAutoProxy = TRUE;     }      if( ieProxyConfig.lpszAutoConfigUrl != NULL )     {         fAutoProxy = TRUE;         autoProxyOptions.lpszAutoConfigUrl = ieProxyConfig.lpszAutoConfigUrl;     } } else {     // use autoproxy     fAutoProxy = TRUE; }  if( fAutoProxy ) {     if ( autoProxyOptions.lpszAutoConfigUrl != NULL )     {         autoProxyOptions.dwFlags = WINHTTP_AUTOPROXY_CONFIG_URL;     }     else     {         autoProxyOptions.dwFlags = WINHTTP_AUTOPROXY_AUTO_DETECT;         autoProxyOptions.dwAutoDetectFlags = WINHTTP_AUTO_DETECT_TYPE_DHCP | WINHTTP_AUTO_DETECT_TYPE_DNS_A;     }      // basic flags you almost always want     autoProxyOptions.fAutoLogonIfChallenged = TRUE;      // here we reset fAutoProxy in case an auto-proxy isn't actually     // configured for this url     fAutoProxy = WinHttpGetProxyForUrl( hiOpen, pwszUrl, &autoProxyOptions, &autoProxyInfo ); }  if ( fAutoProxy ) {     // set proxy options for libcurl based on autoProxyInfo } else {     if( ieProxyConfig.lpszProxy != NULL )     {         // IE has an explicit proxy. set proxy options for libcurl here         // based on ieProxyConfig         //         // note that sometimes IE gives just a single or double colon         // for proxy or bypass list, which means 'no proxy'     }     else     {         // there is no auto proxy and no manually configured proxy     } } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 58k
  • Answers 58k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Try: dospath=`echo $unixpath | sed 's/\//\\\\/g'` Thanks to David Wolever… May 11, 2026 at 8:54 am
  • added an answer I would search all of the files in your solution… May 11, 2026 at 8:54 am
  • added an answer you could use concat. concat [ [(n*2),(n*3)] | n <-… May 11, 2026 at 8:54 am

Related Questions

No related questions found

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.