Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can lsquic provide an api to get connection sni? #203

Closed
wangfuyu opened this issue Dec 12, 2020 · 3 comments
Closed

Can lsquic provide an api to get connection sni? #203

wangfuyu opened this issue Dec 12, 2020 · 3 comments
Labels

Comments

@wangfuyu
Copy link
Contributor

wangfuyu commented Dec 12, 2020

When on_new_conn be called, I hope lsquic can have an api to get sni from conn, which same with the 3rd ea_lookup_cert para.
like: lsquic_conn_get_hostname or lsquic_conn_get_sni

I try to add new api, but I find enc_session->hs_ctx.sni.str maybe changed occasionally before on_new_conn be called.
I have following code by gdb, and sure that destroy_conn(mini conn) is called after on_new_conn be called, So I'm puzzled here.

What I have changed to lsquic:

  1. Add a new elem "hostname" to struct lsquic_conn

  2. in func get_sni_SSL_CTX, I save sni to mini conn;
    enc_session->es_conn->hostname = enc_session->hs_ctx.sni.str;

  3. in func lsquic_gquic_full_conn_server_new, deliver sni to full conn from mini conn
    conn->fc_conn.hostname = lconn_mini->hostname;

  4. on_new_conn, I get sni from conn

@dtikhonov
Copy link
Contributor

It would be easier to discuss your proposal if it were a PR: then we could look at actual code.

@lolsalat
Copy link

lolsalat commented Jan 9, 2021

I created a pull request that should implement this feature, providing a method

const char* lsquic_conn_get_sni(struct lsquic_conn*);

Cheers

litespeedtech pushed a commit that referenced this issue Jan 13, 2021
- [API] Add lsquic_conn_get_sni(), fixes issue #203.
@dtikhonov
Copy link
Contributor

Fixed in 2.27.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants