微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

c – 如何构建自定义libcurl以仅支持HTTP / HTTPS协议

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

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

在分析过程中,我发现libcurl的构建支持许多协议,包括HTTP.但我的具体用途是HTTP / HTTPS.

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

感谢您阅读帖子!!!

解决方法

看一看: 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.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐