cloudflare / quiche

šŸ„§ Savoury implementation of the QUIC transport protocol and HTTP/3

Home Page:https://docs.quic.tech/quiche/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`enum quiche_h3_event_type` miscounted?

icing opened this issue Ā· comments

In quiche.h, line 857:

enum quiche_h3_event_type {
    QUICHE_H3_EVENT_HEADERS,
    QUICHE_H3_EVENT_DATA,
    QUICHE_H3_EVENT_FINISHED,
    QUICHE_H3_EVENT_GOAWAY,
    QUICHE_H3_EVENT_RESET,
    QUICHE_H3_EVENT_PRIORITY_UPDATE,
};

but in h3/ffi.rs, line 138:

pub extern fn quiche_h3_event_type(ev: &h3::Event) -> u32 {
    match ev {
        h3::Event::Headers { .. } => 0,
        h3::Event::Data { .. } => 1,
        h3::Event::Finished { .. } => 2,
        h3::Event::GoAway { .. } => 4,
        h3::Event::Reset { .. } => 5,
        h3::Event::PriorityUpdate { .. } => 6,
    }
}

which would explain why curl sees a QUICHE_H3_EVENT_PRIORITY_UPDATE instead of a QUICHE_H3_EVENT_RESET in out testing?

Am I reading this correct? Then either the enum declaration or the mapping functions needs a fix.

Ugh, yeah, I think you are right. It seems we forgot to re-number after 48aac48#diff-01e2668bd2e111037779ba42e4e7f7eddf58ad2cc35d800090dda6f971191fca

We could also explicitly number the C enum so we can avoid this going forward...

Made #1652 for now, we can figure out later how to improve this.