Skip to content

Instantly share code, notes, and snippets.

@bagder
Last active March 27, 2020 13:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bagder/1f3b654a78f126eb1054056cb0d016d4 to your computer and use it in GitHub Desktop.
Save bagder/1f3b654a78f126eb1054056cb0d016d4 to your computer and use it in GitHub Desktop.
A list of common mistakes when using libcurl

Common libcurl mistakes

I'm planning a talk (video) on this topic and here I'm collecting the most common mistakes we've seen reported, discussed and revealed in recent years. What other mistakes do you see happen repeatedly?

  1. Skipping the documentation!
  2. Failure to check return codes
  3. Forgetting the verbose option
  4. There's a global init function
    • that isn't thread-safe
  5. Let users set (parts of) the URL
  6. Consider the redirects
  7. Unnecessary setting HTTP method
  8. Disabled certificate checks
  9. Assume zero terminated data in callbacks
  10. C++ strings are not C strings
  11. Threading mistakes
  12. Understanding CURLOPT_NOSIGNAL
  13. Forgetting -DCURL_STATICLIB
@gvanem
Copy link

gvanem commented Mar 27, 2020

Forgetting a -DCURL_STATICLIB is pretty common (when using a static libcurl).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment