Skip to content
FAQ 47.8 KiB
Newer Older
  * Adjust the system's config to check for libs in the directory where you've
    put the dir (like Linux's /etc/ld.so.conf)

  'man ld.so' and 'man ld' will tell you more details

Daniel Stenberg's avatar
Daniel Stenberg committed
  libcurl supports a large a number of different name resolve functions. One
  of them is picked at build-time and will be used unconditionally. Thus, if
  you want to change name resolver function you must rebuild libcurl and tell
  it to use a different function.

  - The non-ipv6 resolver that can use one out of four host name resolve calls
    (depending on what your system supports):

    A - gethostbyname()
    B - gethostbyname_r() with 3 arguments
    C - gethostbyname_r() with 5 arguments
    D - gethostbyname_r() with 6 arguments

  - The ipv6-resolver that uses getaddrinfo()

  - The c-ares based name resolver that uses the c-ares library for resolves.
Daniel Stenberg's avatar
Daniel Stenberg committed
    Using this offers asynchronous name resolves but it currently has no IPv6
    support.

  - The Windows threaded resolver. It use:

    A - gethostbyname() on plain ipv4 windows hosts
    B - getaddrinfo() on ipv6-enabled windows hosts
Daniel Stenberg's avatar
Daniel Stenberg committed
  Also note that libcurl never resolves or reverse-lookups addresses given as
  pure numbers, such as 127.0.0.1 or ::1.

  5.10 How do I prevent libcurl from writing the response to stdout?

  libcurl provides a default built-in write function that writes received data
Daniel Stenberg's avatar
Daniel Stenberg committed
  to stdout. Set the CURLOPT_WRITEFUNCTION to receive the data, or possibly
  set CURLOPT_WRITEDATA to a different FILE * handle.
  5.11 How do I make libcurl not receive the whole HTTP response?

  You make the write callback (or progress callback) return an error and
  libcurl will then abort the transfer.

  5.12 Can I make libcurl fake or hide my real IP address?

  No. libcurl operates on a higher level than so. Besides, faking IP address
  would imply sending IP packages with a made-up source address, and then you
  normally get a problem with intercepting the packages sent back as they
  would then not be routed to you!

  If you use a proxy to access remote sites, the sites will not see your local
  IP address but instead the address of the proxy.

  Also note that on many networks NATs or other IP-munging techniques are used
  that makes you see and use a different IP address locally than what the
  remote server will see you coming from.

  5.13 How do I stop an ongoing transfer?

  There are several ways, but none of them are instant. There is no function
  you can call from another thread or similar that will stop it immediately.
  Instead you need to make sure that one of the callbacks you use return an
  appropriate value that will stop the transfer.

  Suitable callbacks that you can do this with include the progress callback,
  the read callback and the write callback.

  If you're using the multi interface, you also stop a transfer by removing
  the particular easy handle from the multi stack.
Daniel Stenberg's avatar
Daniel Stenberg committed
6. License Issues
  Curl and libcurl are released under a MIT/X derivate license. The license is
  very liberal and should not impose a problem for your project. This section
  is just a brief summary for the cases we get the most questions. (Parts of
  this section was much enhanced by Bjorn Reese.)
Daniel Stenberg's avatar
Daniel Stenberg committed
  We are not lawyers and this is not legal advice. You should probably consult
  one if you want true and accurate legal insights without our prejudice.

  6.1 I have a GPL program, can I use the libcurl library?
Daniel Stenberg's avatar
Daniel Stenberg committed
  Yes!
Daniel Stenberg's avatar
Daniel Stenberg committed
  Since libcurl may be distributed under the MIT/X derivate license, it can be
  used together with GPL in any software.
  6.2 I have a closed-source program, can I use the libcurl library?
Daniel Stenberg's avatar
Daniel Stenberg committed

  libcurl does not put any restrictions on the program that uses the library.
  6.3 I have a BSD licensed program, can I use the libcurl library?
Daniel Stenberg's avatar
Daniel Stenberg committed

  libcurl does not put any restrictions on the program that uses the library.
  6.4 I have a program that uses LGPL libraries, can I use libcurl?
  The LGPL license doesn't clash with other licenses.
Daniel Stenberg's avatar
Daniel Stenberg committed

  6.5 Can I modify curl/libcurl for my program and keep the changes secret?
Daniel Stenberg's avatar
Daniel Stenberg committed

  The MIT/X derivate license practically allows you to do almost anything with
  the sources, on the condition that the copyright texts in the sources are
  left intact.
  6.6 Can you please change the curl/libcurl license to XXXX?
  We have carefully picked this license after years of development and
  discussions and a large amount of people have contributed with source code
  knowing that this is the license we use. This license puts the restrictions
  we want on curl/libcurl and it does not spread to other programs or
  libraries that use it. It should be possible for everyone to use libcurl or
  curl in their projects, no matter what license they already have in use.
Daniel Stenberg's avatar
Daniel Stenberg committed

Daniel Stenberg's avatar
Daniel Stenberg committed
  6.7 What are my obligations when using libcurl in my commerical apps?

  Next to none. All you need to adhere to is the MIT-style license (stated in
  the COPYING file) which basically says you have to include the copyright
  notice in "all copies" and that you may not use the copyright holder's name
  when promoting your software.

  You do not have to release any of your source code.

  You do not have to reveal or make public any changes to the libcurl source
  code.

  You do not have to reveal or make public that you are using libcurl within
  your app.

  As can be seen here: http://curl.haxx.se/docs/companies.html and
  elsewhere, more and more companies are dicovering the power
  of libcurl and take advantage of it even in commercial environments.


Daniel Stenberg's avatar
Daniel Stenberg committed
7. PHP/CURL Issues

  7.1 What is PHP/CURL?

  The module for PHP that makes it possible for PHP programs to access curl-
  functions from within PHP.

  In the cURL project we call this module PHP/CURL to differentiate it from
  curl the command line tool and libcurl the library. The PHP team however
  does not refer to it like this (for unknown reasons). They call it plain
  CURL (often using all caps) or sometimes ext/curl, but both cause much
  confusion to users which in turn gives us a higher question load.
Daniel Stenberg's avatar
Daniel Stenberg committed

  7.2 Who write PHP/CURL?

  PHP/CURL is a module that comes with the regular PHP package. It depends and
  uses libcurl, so you need to have libcurl installed properly first before
  PHP/CURL can be used. PHP/CURL was initially written by Sterling Hughes.
Daniel Stenberg's avatar
Daniel Stenberg committed

  7.3 Can I perform multiple requests using the same handle?

  Yes - at least in PHP version 4.3.8 and later (this has been known to not
  work in earlier versions, but the exact version when it started to work is
  unknown to me).
Daniel Stenberg's avatar
Daniel Stenberg committed

  After a transfer, you just set new options in the handle and make another
  transfer. This will make libcurl to re-use the same connection if it can.