【问题标题】:how to build customize libcurl to support HTTP / HTTPS protocol only如何构建自定义 libcurl 以仅支持 HTTP / HTTPS 协议
【发布时间】:2013-03-06 15:17:01
【问题描述】:

我只使用 libcurl 来发出 HTTP / HTTPS 请求。我已经下载了源代码并构建为静态库。

我的最终可执行文件的大小有所增加。我正在尝试减少我的可执行 exe,因为我有其他限制。

在分析过程中,我观察到 libcurl 构建时支持包括 HTTP 在内的许多协议。但是我的具体用途是 HTTP/HTTPS。

有没有办法在构建 libcurl 时定义编译标志以禁用其他协议?

感谢您阅读这篇文章!!!

【问题讨论】:

  • 试试./configure --disable-ftp --disable-file --...,所有你不想要的协议。
  • 忘了提及:我正在尝试在 WIN 环境中获取库,并且我正在构建 VC++。

标签: c++ visual-c++ curl libcurl


【解决方案1】:

看一看:http://curl.haxx.se/docs/install.html

    Disabling Specific Protocols in Win32 builds
   --------------------------------------------

   The configure utility, unfortunately, is not available for the Windows
   environment, therefore, you cannot use the various disable-protocol
   options of the configure utility on this platform.

   However, you can use the following defines to disable specific
   protocols:

   HTTP_ONLY             disables all protocols except HTTP
   CURL_DISABLE_FTP      disables FTP
   CURL_DISABLE_LDAP     disables LDAP
   CURL_DISABLE_TELNET   disables TELNET
   CURL_DISABLE_DICT     disables DICT
   CURL_DISABLE_FILE     disables FILE
   CURL_DISABLE_TFTP     disables TFTP
   CURL_DISABLE_HTTP     disables HTTP

   If you want to set any of these defines you have the following
   possibilities:

   - Modify lib/config-win32.h
   - Modify lib/curl_setup.h
   - Modify lib/Makefile.vc6
   - Add defines to Project/Settings/C/C++/General/Preprocessor Definitions
     in the vc6libcurl.dsw/vc6libcurl.dsp Visual C++ 6 IDE project.

【讨论】:

    猜你喜欢
    • 2019-08-06
    • 2012-03-24
    • 2017-01-10
    • 2017-09-14
    • 2020-01-22
    • 2017-09-08
    • 2020-04-09
    • 2015-03-16
    • 2019-03-28
    相关资源
    最近更新 更多