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

Issue #1498: Initial framework for HTTP/1.x observer #1501

Merged
merged 2 commits into from
May 23, 2024

Conversation

kgiusti
Copy link
Contributor

@kgiusti kgiusti commented May 15, 2024

This patch just checkpoints the start of the decoder implementation. Does not resolve Issue #1498.

@kgiusti kgiusti requested a review from ganeshmurthy May 15, 2024 17:33
Comment on lines 64 to 65
observers/http1/http1_observer.c
observers/http1/decoder.c
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is one file prefixed but not the other?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call - I'll add the http1_ prefix to the decoder.c file

@@ -0,0 +1,141 @@
#ifndef http1_observer_decoder_H
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the convention to make these all caps?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding the location of the decoder code, where it is now under the observer does not enforce any kind of separation. Maybe that's a desired coupling? If it stays here, it's easy to see how it would grow mutual dependencies with the other observer code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the convention to make these all caps?

I don't believe the convention is all caps but I'll update the ifdef to be consistent with other existing header files.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding the location of the decoder code, where it is now under the observer does not enforce any kind of separation. Maybe that's a desired coupling? If it stays here, it's easy to see how it would grow mutual dependencies with the other observer code.

That's a good point - I'll follow up with a separate PR to re-organize the file layout to make the decoupling clearer. Stay tuned.

#define HTTP1_VERSION_1_1 "HTTP/1.1"
#define HTTP1_VERSION_1_0 "HTTP/1.0"

typedef struct h1_decode_config_t h1_decode_config_t;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want two conventions for HTTP stuff: h1 and http1 (h2 and http2) with no principled distinction.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Existing precedent (adaptors) use the full "http1_" and "http2_" prefix for API. I'll update this code to follow that convention.

// Invoked when the HTTP request/response messages have been completely encoded/decoded and the transaction is complete.
// The request_context will never be used by the decoder again on return from this call.
//
int (*transaction_complete)(h1_decode_connection_t *hconn, uintptr_t request_context);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is "transaction" the conventional term here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ChatGPT says yes, transaction is the convention.

Comment on lines 53 to 60
struct h1_decode_config_t {
//
// Decoder callbacks
//
// Callbacks invoked when parsing incoming raw connection data. These callbacks are invoked from the
// h1_decode_connection_rx_data() call. These callbacks should return 0 on success or non-zero on error. A non-zero
// return code is used as the return code from h1_decode_connection_rx_data()
//
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs say this is decoder configuration, and it's in a decoder.h file, but it's called h1_decode_config (note no R).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call - I'm going to rename this to qd_http1_decoder_config_t.

This patch just checkpoints the start of the decoder implementation.
Does not resolve Issue skupperproject#1498.
@kgiusti kgiusti merged commit dd6e44b into skupperproject:main May 23, 2024
35 of 39 checks passed
@kgiusti kgiusti deleted the ISSUE-1498-TURBO branch May 23, 2024 17:08
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

Successfully merging this pull request may close these issues.

None yet

3 participants