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

Use nghttp2 to decode response only #2139

Open
ganeshmurthy opened this issue Apr 5, 2024 · 2 comments
Open

Use nghttp2 to decode response only #2139

ganeshmurthy opened this issue Apr 5, 2024 · 2 comments

Comments

@ganeshmurthy
Copy link

Is there a way to use nghttp2 to only look at the response to find response headers ?
I have the response data in my buffers that I want to feed into nghttp2 so it can make callbacks to the callback set via nghttp2_session_callbacks_set_on_header_callback
nghttp2 is not used to send the http2 request, I want to use it to only look at the response to look at response headers like :status

@ganeshmurthy
Copy link
Author

ganeshmurthy commented Apr 26, 2024

Hear me out here. As mentioned above, I want to use nghttp2 to only look at the response headers from nginx, I am not using nghttp2 to generate the requests. I cleverly thought I could use a "server" session (created using nghttp2_session_server_new()) and call nghttp2_option_set_no_recv_client_magic() to not have nghttp2 look for a client magic. I received the following sequence of frames from the nginx server:

Initial SETTINGS frame
WINDOW_UPDATE frame
SETTINGS frame (this is the ACK SETTINGS frame)
HEADERS (response headers)

Since I am reading the response from nginx on a "server" session, on seeing the ACK SETTINGS frame, nghttp2 exits with error "SETTINGS: unexpected ACK" which is correct but unfortunate for me. All I want is to get all the response headers but nghttp2 errors out before getting to the headers and making those header callbacks.

What would be the easiest way for me to ignore this SETTINGS ACK and proceed to process the request headers ?

@tatsuhiro-t
Copy link
Member

Because the traffic is coming from server, nghttp2_session_client_new should be used.
That said, nghttp2 does not support this kind of usage.

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

No branches or pull requests

2 participants