Giter Site home page Giter Site logo

pylsqpack's Introduction

pylsqpack

License

Version

Python versions

Tests

Documentation

pylsqpack is a wrapper around the ls-qpack library. It provides Python Decoder and Encoder objects to read or write HTTP/3 headers compressed with QPACK.

To learn more about pylsqpack please read the documentation.

pylsqpack's People

Contributors

jlaine avatar mhils avatar msoxzw avatar unasuke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pylsqpack's Issues

Compilation error against ls-qpack-2.5.3

Hi all.

pylsqpack-0.3.17 is not compiling against ls-qpack-2.5.3:

gcc -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fPIC -Ivendor/ls-qpack -Ivendor/ls-qpack/deps/xxhash -I/usr/include/python3.11 -c src/pylsqpack/binding.c -o build/temp.linux-x86_64-cpython-311/src/pylsqpack/binding.o -std=c99
src/pylsqpack/binding.c: In function ‘header_block_free’:
src/pylsqpack/binding.c:47:9: warning: implicit declaration of function ‘lsqpack_dec_destroy_header_list’; did you mean ‘lsqpack_dec_header_in’? [-Wimplicit-function-declaration]
   47 |         lsqpack_dec_destroy_header_list(hblock->hlist);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |         lsqpack_dec_header_in
src/pylsqpack/binding.c: In function ‘hlist_to_headers’:
src/pylsqpack/binding.c:58:28: error: invalid use of undefined type ‘struct lsqpack_header_list’
   58 |     list = PyList_New(hlist->qhl_count);
      |                            ^~
src/pylsqpack/binding.c:59:33: error: invalid use of undefined type ‘struct lsqpack_header_list’
   59 |     for (size_t i = 0; i < hlist->qhl_count; ++i) {
      |                                 ^~
src/pylsqpack/binding.c:60:23: error: invalid use of undefined type ‘struct lsqpack_header_list’
   60 |         header = hlist->qhl_headers[i];
      |                       ^~
src/pylsqpack/binding.c:61:48: error: invalid use of undefined type ‘struct lsqpack_header’
   61 |         name = PyBytes_FromStringAndSize(header->qh_name, header->qh_name_len);
      |                                                ^~
src/pylsqpack/binding.c:61:65: error: invalid use of undefined type ‘struct lsqpack_header’
   61 |         name = PyBytes_FromStringAndSize(header->qh_name, header->qh_name_len);
      |                                                                 ^~
src/pylsqpack/binding.c:62:49: error: invalid use of undefined type ‘struct lsqpack_header’
   62 |         value = PyBytes_FromStringAndSize(header->qh_value, header->qh_value_len);
      |                                                 ^~
src/pylsqpack/binding.c:62:67: error: invalid use of undefined type ‘struct lsqpack_header’
   62 |         value = PyBytes_FromStringAndSize(header->qh_value, header->qh_value_len);
      |                                                                   ^~
src/pylsqpack/binding.c: In function ‘Decoder_init’:
src/pylsqpack/binding.c:93:77: warning: passing argument 5 of ‘lsqpack_dec_init’ from incompatible pointer type [-Wincompatible-pointer-types]
   93 |     lsqpack_dec_init(&self->dec, NULL, max_table_capacity, blocked_streams, header_unblocked);
      |                                                                             ^~~~~~~~~~~~~~~~
      |                                                                             |
      |                                                                             void (*)(void *)
In file included from src/pylsqpack/binding.c:4:
/usr/include/lsqpack.h:334:5: note: expected ‘const struct lsqpack_dec_hset_if *’ but argument is of type ‘void (*)(void *)’
  334 |     const struct lsqpack_dec_hset_if *, enum lsqpack_dec_opts);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/pylsqpack/binding.c:93:5: error: too few arguments to function ‘lsqpack_dec_init’
   93 |     lsqpack_dec_init(&self->dec, NULL, max_table_capacity, blocked_streams, header_unblocked);
      |     ^~~~~~~~~~~~~~~~
/usr/include/lsqpack.h:332:1: note: declared here
  332 | lsqpack_dec_init (struct lsqpack_dec *, void *logger_ctx,
      | ^~~~~~~~~~~~~~~~
src/pylsqpack/binding.c: In function ‘Decoder_feed_header’:
src/pylsqpack/binding.c:183:9: warning: passing argument 7 of ‘lsqpack_dec_header_in’ from incompatible pointer type [-Wincompatible-pointer-types]
  183 |         &hblock->hlist,
      |         ^~~~~~~~~~~~~~
      |         |
      |         struct lsqpack_header_list **
/usr/include/lsqpack.h:400:39: note: expected ‘unsigned char *’ but argument is of type ‘struct lsqpack_header_list **’
  400 |                        unsigned char *dec_buf, size_t *dec_buf_sz);
      |                        ~~~~~~~~~~~~~~~^~~~~~~
src/pylsqpack/binding.c:184:13: warning: passing argument 8 of ‘lsqpack_dec_header_in’ from incompatible pointer type [-Wincompatible-pointer-types]
  184 |         self->dec_buf,
      |         ~~~~^~~~~~~~~
      |             |
      |             unsigned char *
/usr/include/lsqpack.h:400:56: note: expected ‘size_t *’ {aka ‘long unsigned int *’} but argument is of type ‘unsigned char *’
  400 |                        unsigned char *dec_buf, size_t *dec_buf_sz);
      |                                                ~~~~~~~~^~~~~~~~~~
src/pylsqpack/binding.c:176:14: error: too many arguments to function ‘lsqpack_dec_header_in’
  176 |     status = lsqpack_dec_header_in(
      |              ^~~~~~~~~~~~~~~~~~~~~
/usr/include/lsqpack.h:397:1: note: declared here
  397 | lsqpack_dec_header_in (struct lsqpack_dec *, void *hblock_ctx,
      | ^~~~~~~~~~~~~~~~~~~~~
src/pylsqpack/binding.c: In function ‘Decoder_resume_header’:
src/pylsqpack/binding.c:252:13: warning: passing argument 5 of ‘lsqpack_dec_header_read’ from incompatible pointer type [-Wincompatible-pointer-types]
  252 |             &hblock->hlist,
      |             ^~~~~~~~~~~~~~
      |             |
      |             struct lsqpack_header_list **
/usr/include/lsqpack.h:412:41: note: expected ‘unsigned char *’ but argument is of type ‘struct lsqpack_header_list **’
  412 |                          unsigned char *dec_buf, size_t *dec_buf_sz);
      |                          ~~~~~~~~~~~~~~~^~~~~~~
src/pylsqpack/binding.c:253:17: warning: passing argument 6 of ‘lsqpack_dec_header_read’ from incompatible pointer type [-Wincompatible-pointer-types]
  253 |             self->dec_buf,
      |             ~~~~^~~~~~~~~
      |                 |
      |                 unsigned char *
/usr/include/lsqpack.h:412:58: note: expected ‘size_t *’ {aka ‘long unsigned int *’} but argument is of type ‘unsigned char *’
  412 |                          unsigned char *dec_buf, size_t *dec_buf_sz);
      |                                                  ~~~~~~~~^~~~~~~~~~
src/pylsqpack/binding.c:247:18: error: too many arguments to function ‘lsqpack_dec_header_read’
  247 |         status = lsqpack_dec_header_read(
      |                  ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/lsqpack.h:410:1: note: declared here
  410 | lsqpack_dec_header_read (struct lsqpack_dec *dec, void *hblock_ctx,
      | ^~~~~~~~~~~~~~~~~~~~~~~
src/pylsqpack/binding.c: In function ‘Encoder_encode’:
src/pylsqpack/binding.c:432:32: warning: passing argument 6 of ‘lsqpack_enc_encode’ from incompatible pointer type [-Wincompatible-pointer-types]
  432 |                                PyBytes_AsString(name), PyBytes_Size(name),
      |                                ^~~~~~~~~~~~~~~~~~~~~~
      |                                |
      |                                char *
/usr/include/lsqpack.h:233:5: note: expected ‘const struct lsxpack_header *’ but argument is of type ‘char *’
  233 |     const struct lsxpack_header *,
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/pylsqpack/binding.c:429:13: error: too many arguments to function ‘lsqpack_enc_encode’
  429 |         if (lsqpack_enc_encode(&self->enc,
      |             ^~~~~~~~~~~~~~~~~~
/usr/include/lsqpack.h:230:1: note: declared here
  230 | lsqpack_enc_encode (struct lsqpack_enc *,
      | ^~~~~~~~~~~~~~~~~~
error: command '/usr/lib64/ccache/gcc' failed with exit code 1

I'm using gcc-13.2.1 and Python-3.11

Potential memory leak

Memory leak occurs, at least for Python 3.10.3 on Windows.

import pylsqpack

for _ in range(65536):
    decoder = pylsqpack.Decoder(4096, 16)
    del decoder

import pylsqpack

for _ in range(65536):
    encoder = pylsqpack.Encoder()
    del encoder

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.