| 1 |
Unimplemented Options And Constants |
| 2 |
=================================== |
| 3 |
|
| 4 |
PycURL intentionally does not expose some of the libcurl options and constants. |
| 5 |
This document explains libcurl symbols that were omitted from PycURL. |
| 6 |
|
| 7 |
|
| 8 |
``*DATA`` options |
| 9 |
----------------- |
| 10 |
|
| 11 |
In libcurl, the ``*aDATA`` options set *client data* for various callbacks. |
| 12 |
Each callback has a corresponding ``*DATA`` option. |
| 13 |
|
| 14 |
In Python - a language with closures - such options are unnecessary. |
| 15 |
For example, the following code invokes an instance's ``write`` method |
| 16 |
which has full access to its class instance:: |
| 17 |
|
| 18 |
class Writer(object): |
| 19 |
def __init__(self): |
| 20 |
self.foo = True |
| 21 |
|
| 22 |
def write(chunk): |
| 23 |
# can use self.foo |
| 24 |
|
| 25 |
writer = Writer() |
| 26 |
curl = pycurl.Curl() |
| 27 |
curl.setopt(curl.WRITEFUNCTION, writer.write) |
| 28 |
|
| 29 |
As of version 7.19.3, PycURL does implement three ``*DATA`` options for |
| 30 |
convenience: |
| 31 |
``WRITEDATA``, ``HEADERDATA`` and ``READDATA``. These are equivalent to |
| 32 |
setting the respective callback option with either a ``write`` or ``read`` |
| 33 |
method, as appropriate:: |
| 34 |
|
| 35 |
# equivalent pairs: |
| 36 |
curl.setopt(curl.WRITEDATA, writer) |
| 37 |
curl.setopt(curl.WRITEFUNCTION, writer.write) |
| 38 |
|
| 39 |
curl.setopt(curl.HEADERDATA, writer) |
| 40 |
curl.setopt(curl.HEADERFUNCTION, writer.write) |
| 41 |
|
| 42 |
curl.setopt(curl.READDATA, reader) |
| 43 |
curl.setopt(curl.READFUNCTION, reader.read) |
| 44 |
|
| 45 |
|
| 46 |
``CURLINFO_TLS_SESSION`` |
| 47 |
------------------------ |
| 48 |
|
| 49 |
It is unclear how the SSL context should be exposed to Python code. |
| 50 |
This option can be implemented if it finds a use case. |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
Undocumented symbols |
| 55 |
-------------------- |
| 56 |
|
| 57 |
Some symbols are present in libcurl's `symbols in versions`_ document but |
| 58 |
are not documented by libcurl. These symbols are not implemented by PycURL. |
| 59 |
|
| 60 |
As of this writing, the following symbols are thusly omitted: |
| 61 |
|
| 62 |
- ``CURLPAUSE_RECV_CONT`` |
| 63 |
- ``CURLPAUSE_SEND_CONT`` |
| 64 |
|
| 65 |
.. _symbols in versions: https://curl.haxx.se/libcurl/c/symbols-in-versions.html |