python-hyper / python-hyper/h2

Wanted to extend hpack encoders or allow different Encoder and Decoders to be used.

未关闭
#1,312 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Python
星标
1k
派生
187
PR 合并指标
30 天内没有已合并 PR

描述

I have a library coming out which I made as a drop in replacement for python hpack called cyhpack and I wanted to try developing a better solution for injecting my own Decoder and Encoder which runs ls-hpack under the hood. As of currently, here is my workaround but I was wondering if a better implementation could be implemented such as a factory attribute or an Abstract class could be made to accommodate my version and the pure python one as well?

from __future__ import annotations

from h2.config import H2Configuration
from h2.connection import H2Connection as _H2Connection

from .hpack import Decoder, Encoder


class H2Connection(_H2Connection):
    """
    Contains an overridable version of H2Connection that drops
    python hpack in exchange for cyhpack for faster performance
    and speed.
    """

    def __init__(self, config: H2Configuration | None = None):
        super().__init__(config)
        self.encoder = Encoder()
        self.decoder = Decoder()

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先阅读 h2.connection.H2Connection 和 H2Configuration,然后将当前 Encoder 和 Decoder 的初始化方式与 issue 中所示的子类变通方案进行比较。当调用方无需维护自定义 H2Connection 子类即可使用替代的 Encoder 和 Decoder 实现,并且配置路径有覆盖时,工作就完成了。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
api, networking
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。