Commit Graph

1341 Commits

Author SHA1 Message Date
Joseph Henry
2e2a66c9f7 Move Python license into ext/THIRDPARTY.txt 2021-03-17 14:34:51 -07:00
Joseph Henry
73e26c1a79 Bugfix: Check argument types and encodings in zts_py_send() 2021-03-16 23:30:14 -07:00
Joseph Henry
9b79c2616d Merge branch 'linsomniac-py_recv_bytes' 2021-03-16 22:59:39 -07:00
Joseph Henry
bf1788919b Merge branch 'py_recv_bytes' of https://github.com/linsomniac/libzt into linsomniac-py_recv_bytes 2021-03-16 18:58:43 -07:00
Joseph Henry
ab32a827a4 Better random number generation in selftest 2021-03-16 18:02:13 -07:00
Sean Reifschneider
7dbf42d899 Attempt to fix zts_recv for Python.
There were a few I'm attempting to fix in zts_py_recv():

Was allocating a static buffer of 4096, but taking whatever
length the user passed in.  This change allocates a PyBytes
object of the size the user requests.

Was converting to a string without giving a size.  Which probably
led to the UnicodeDecodeError I was seeing below, trying to
decode a character beyond the received bytes.  Would also lead
to problems reading binary data that included embedded NULs.
Used the number of bytes received as the size of the returned data.

Variable "err" was being used, changed that to "bytes_read" as
that's what lwip_recv() returns, with <0 bytes read indicating
error.

Read data was being returned as a Unicode string, leading to this
response when I tried talking to my SSH server:

    UnicodeDecodeError: 'utf-8' codec can't decode
    byte 0xa1 in position 42: invalid start byte

My ssh banner is 40 bytes long, so I think position 42 was outside
the received buffer.  Changed it to a PyBytes response as is
normal for network data.  This code was cribbed from the Python
socketmodule

This was producing this error, as it was still returning the tuple:

    SystemError: <built-in function zts_py_recv> returned a
    result with an error set

This indicates that the UnicodeDecodeError had set an exception,
but a tuple was being returned instead of NULL.

In the case of a lwip_recv() error, the error response was not
being sent back to the wrapper code.  Instead, a "return NULL;"
was done.  I changed this case to return the tuple (err, None)
to the wrapper.

NOTE: this code built using "./build.sh host-python release", but
there was some sort of build problem I didn't understand which
produced a _libzt.so that I couldn't import, due to:

    ImportError: dynamic module does not define module export
    function (PyInit__libzt)

So I don't have a way to test these changes.
2021-03-16 15:52:55 -06:00
Joseph Henry
04c965f0e5 Buildfix: Missing type specifier 2021-03-16 14:42:59 -07:00
Joseph Henry
151b376539 Add libcurl4-gnutls-dev to selftest.yml 2021-03-16 14:27:24 -07:00
Joseph Henry
00b52d0910 Update version of libcurl used in Selftest workflow file from 3 to 4 2021-03-16 14:20:22 -07:00
Joseph Henry
1f981379ca Update Selftest workflow file 2021-03-16 14:18:36 -07:00
Joseph Henry
c5a31ba533 Attempt to circumvent GitHub's broken image caching service 2021-03-16 13:51:40 -07:00
Joseph Henry
b8c75c2d1b Add tests to selftest 2021-03-16 13:44:21 -07:00
Joseph Henry
d136d86263 Remove submodule (curl) 2021-03-16 13:00:41 -07:00
Joseph Henry
2c5c1a6a5f Expose lwIP's DNS API in zts_* API. Fix preprocessor build bug 2021-03-16 00:31:45 -07:00
Joseph Henry
2a515822c8 Remove networking functions that can be found elsewhere 2021-03-15 01:59:18 -07:00
Joseph Henry
986828a51f Split Java portion of socket API into its own file 2021-03-14 01:37:24 -08:00
Joseph Henry
4eb8304efe Change error behavior: Return ZTS_ERR_SERVICE in all cases before checking anything else 2021-03-14 01:02:43 -08:00
Joseph Henry
c220bb7d2f Improve Central API 2021-03-14 01:01:04 -08:00
Joseph Henry
26454d2939 Bugfix: calling zts_free() before zts_start() would enter infinite loop 2021-03-13 22:30:33 -08:00
Joseph Henry
575cfc364e Remove non-standard API function accept4() 2021-03-13 21:22:44 -08:00
Joseph Henry
9185af5426 Restore previous install behavior in CMakeLists 2021-03-13 18:05:25 -08:00
Joseph Henry
f4234fd1b0 Remove now-irrelevant makefile 2021-03-12 21:24:26 -08:00
Joseph Henry
07a5830302 Add Python extension module wrapper code 2021-03-12 21:17:37 -08:00
Joseph Henry
58ad7fafc0 Merge refactored dev into master 2021-03-12 20:32:08 -08:00
joseph-henry
4d5318800e Merge pull request #98 from erikh/fix-perms
Fix permissions on dist.sh
2021-03-12 20:26:16 -08:00
joseph-henry
b344b88a39 Merge pull request #99 from MoogleTroupe/c#-gc-fix
fix GC issue in c#
2021-03-12 20:25:32 -08:00
Joseph Henry
301cf9f41b Add GitHub workflow script to build Python wheels. Update PyPI package 2021-03-12 20:20:36 -08:00
Joseph Henry
0080bd0fdd Minor update to documentation 2021-03-10 11:20:00 -08:00
MoogleTroupe
5ba67d918d fix GC issue in c#
Store a reference to the unmanaged delegate so that the c# garbage collector doesn't wipe it out which causes a hard crash since the unmanaged dll is still referencing it.
2021-03-09 20:52:24 -05:00
Joseph Henry
dd6cf48d61 Run Python language bindings and example code through a linter and formatter 1.3.4 2021-03-07 21:11:21 -08:00
Joseph Henry
e1d0f92d61 Remove Android example. The Java example should suffice 2021-03-05 01:15:34 -08:00
Joseph Henry
5072d993b1 Implement more of the Python language binding. Minor adjustments to PyPI package 2021-03-05 00:18:11 -08:00
Joseph Henry
43ebeb2760 Update various READMEs 2021-03-05 00:07:54 -08:00
Joseph Henry
7bc690046a Add PyPI package (WIP) 2021-03-03 23:02:50 -08:00
Joseph Henry
9bca3270bc Overhaul build system and documentation 2021-03-02 01:53:03 -08:00
Joseph Henry
62354e142e Improvements to language binding facilities 2021-03-01 22:34:12 -08:00
Joseph Henry
66da0495a4 Change C# wrapper extension from cxx to cpp 2021-03-01 21:39:36 -08:00
Joseph Henry
64a0d5d0d7 Add working Python wrapper and examples (WIP) 2021-03-01 21:10:39 -08:00
Erik Hollensbe
ad68ded1d5 Fix permissions on dist.sh
They were 644 on my system

Signed-off-by: Erik Hollensbe <github@hollensbe.org>
2021-02-28 01:13:01 -08:00
Joseph Henry
32da07ccb7 Remove unnecessary Android example project resource files 2021-02-24 01:30:23 -08:00
Joseph Henry
7a82ef4a03 Improvements to language binding facilities. Add custom signal handler 2021-02-24 01:25:15 -08:00
Joseph Henry
cfe3811a4a Rename nodejs example directory 2021-02-23 21:32:02 -08:00
Joseph Henry
888030c827 Update Java example 2021-02-23 21:30:44 -08:00
Joseph Henry
4fd619b7cb Remove obsolete Java ports directory 2021-02-16 22:32:17 -08:00
Joseph Henry
842059aeef Remove incomplete rust wrapper files 2021-02-16 22:31:34 -08:00
Joseph Henry
e6b439acb5 Update C# wrapper 2021-02-16 21:56:44 -08:00
Joseph Henry
a055ee8012 Move C API documentation to include directory 2021-02-16 00:34:01 -08:00
Joseph Henry
2648a67331 Rename selftest 2021-02-16 00:24:38 -08:00
Joseph Henry
20fba7312b Remove errant gradle files 2021-02-16 00:23:22 -08:00
Joseph Henry
1afc8690d5 Move Apple framework projects into new pkg/ directory 2021-02-16 00:21:51 -08:00