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

Websocket simple proxy protocol implementation #1595

Merged
merged 11 commits into from
May 5, 2022

Conversation

ttaym
Copy link
Contributor

@ttaym ttaym commented Mar 18, 2022

Contributes to #755

Signed-off-by: Aleksey Mikhaylov [email protected]

@ttaym ttaym changed the base branch from master to am-755-update-srv-shceduler March 18, 2022 11:34
@ttaym ttaym force-pushed the am-755-update-srv-shceduler branch from baa327a to eac58dd Compare March 18, 2022 13:00
@ttaym ttaym force-pushed the am-755-websocket-proxy-proto branch 5 times, most recently from f14cdf8 to 168129c Compare March 24, 2022 14:08
@ttaym ttaym marked this pull request as ready for review March 24, 2022 14:08
@ttaym ttaym requested a review from krizhanovsky March 24, 2022 14:09
Copy link
Contributor

@krizhanovsky krizhanovsky left a comment

Choose a reason for hiding this comment

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

Looks like quite a few places should be reworked

fw/http.c Show resolved Hide resolved
fw/http.h Outdated Show resolved Hide resolved
fw/http.c Outdated Show resolved Hide resolved
fw/http.c Outdated Show resolved Hide resolved
fw/http.c Outdated Show resolved Hide resolved
fw/websocket.c Show resolved Hide resolved
fw/websocket.c Outdated Show resolved Hide resolved
fw/websocket.c Show resolved Hide resolved
fw/http.c Outdated Show resolved Hide resolved
fw/websocket.c Outdated Show resolved Hide resolved
@ttaym ttaym changed the base branch from am-755-update-srv-shceduler to master March 28, 2022 15:09
@ttaym ttaym marked this pull request as draft March 29, 2022 14:15
@ttaym ttaym force-pushed the am-755-websocket-proxy-proto branch from 53dc7c6 to c7e76e4 Compare March 30, 2022 17:42
@ttaym ttaym marked this pull request as ready for review March 30, 2022 18:08
@ttaym ttaym requested a review from krizhanovsky March 30, 2022 18:09
Copy link
Contributor

@krizhanovsky krizhanovsky left a comment

Choose a reason for hiding this comment

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

Just reviewed #1594 comments in application to this PR.

fw/connection.h Show resolved Hide resolved
fw/websocket.c Outdated Show resolved Hide resolved
fw/http.c Show resolved Hide resolved
fw/http.c Show resolved Hide resolved
fw/sock_srv.c Outdated Show resolved Hide resolved
fw/sock_srv.c Outdated Show resolved Hide resolved
fw/http_sched_ratio.c Outdated Show resolved Hide resolved
@ttaym
Copy link
Contributor Author

ttaym commented Apr 7, 2022

This answers #1595 (comment)

While for backend connection state field not needed, but we use client connection as is with adapted websocket type. And we call for it for example tfw_http_conn_drop() -> tfw_http_resp_terminate() -> tfw_http_resp_cache() -> tfw_gfsm_move() that use state. I think here not safe to union with it.

@ttaym ttaym requested a review from krizhanovsky April 8, 2022 09:10
@ttaym ttaym force-pushed the am-755-websocket-proxy-proto branch from f460505 to 8dd6b95 Compare April 8, 2022 09:11
Copy link
Contributor

@krizhanovsky krizhanovsky left a comment

Choose a reason for hiding this comment

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

There are still several issues and several cleanups are also desired.

fw/websocket.c Outdated Show resolved Hide resolved
fw/websocket.c Outdated Show resolved Hide resolved
fw/cfg.c Show resolved Hide resolved
fw/http.c Outdated Show resolved Hide resolved
fw/http.c Outdated Show resolved Hide resolved
fw/websocket.c Outdated Show resolved Hide resolved
fw/websocket.c Outdated Show resolved Hide resolved
fw/websocket.c Show resolved Hide resolved
fw/http_sched_hash.c Outdated Show resolved Hide resolved
fw/server.h Outdated Show resolved Hide resolved
@ttaym ttaym force-pushed the am-755-websocket-proxy-proto branch 3 times, most recently from e7eda18 to 18a1c47 Compare April 21, 2022 11:49
@ttaym ttaym force-pushed the am-755-websocket-proxy-proto branch 2 times, most recently from a0b51d2 to 6fe99b0 Compare April 21, 2022 13:25
Signed-off-by: Aleksey Mikhaylov <[email protected]>
@ttaym ttaym force-pushed the am-755-websocket-proxy-proto branch from 73779c5 to 6ef6324 Compare April 21, 2022 13:56
@ttaym ttaym requested a review from krizhanovsky April 21, 2022 14:11
@ttaym ttaym force-pushed the am-755-websocket-proxy-proto branch from 0d27705 to 147ef9a Compare April 22, 2022 14:03
fw/websocket.c Outdated Show resolved Hide resolved
fw/cfg.c Show resolved Hide resolved
Co-authored-by: Alexander Krizhanovsky <[email protected]>
@ttaym ttaym requested a review from krizhanovsky April 23, 2022 17:49
Copy link
Contributor

@krizhanovsky krizhanovsky left a comment

Choose a reason for hiding this comment

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

One more race in the new design, hopefully the last one. Please carefully verify my conclusions for any other hidden issues.

fw/http.c Outdated Show resolved Hide resolved
fw/http.c Outdated Show resolved Hide resolved
fw/http_sched_hash.c Outdated Show resolved Hide resolved
fw/http.c Outdated Show resolved Hide resolved
fw/http_sched_ratio.c Show resolved Hide resolved
@ttaym ttaym force-pushed the am-755-websocket-proxy-proto branch 3 times, most recently from fb89d02 to 4057450 Compare April 27, 2022 14:44
Signed-off-by: Aleksey Mikhaylov <[email protected]>
@ttaym ttaym force-pushed the am-755-websocket-proxy-proto branch from 4057450 to ac84d06 Compare April 28, 2022 09:22
@ttaym ttaym requested a review from krizhanovsky April 29, 2022 08:41
Copy link
Contributor

@krizhanovsky krizhanovsky left a comment

Choose a reason for hiding this comment

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

Good to merge. Just several minor cleanups/fixes are required.

@@ -200,7 +200,7 @@ typedef struct {
unsigned char data_off;
} TfwH2Ctx;

typedef struct TfwConn TfwConn;
typedef struct tfw_conn_t TfwConn;

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems some unnecessary change

Copy link
Contributor Author

@ttaym ttaym May 5, 2022

Choose a reason for hiding this comment

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

This line of code i had introduced in my earlier commits in previous PRs. It goes againts widly used practice in tempesta code. Mostly type named in snake case with _t suffix. I have just fixed style.

? tfw_http_req_process(conn, stream, data->skb)
: tfw_http_resp_process(conn, stream, data->skb);
/* That is paired request, it may be freed after resp processing */
req = ((TfwHttpMsg *)stream->msg)->pair;
Copy link
Contributor

Choose a reason for hiding this comment

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

req is also needed under the if only

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It cannot be moved inside clause because it may be freed after resp processing.

fw/http.c Outdated Show resolved Hide resolved
fw/websocket.c Show resolved Hide resolved
fw/http.c Show resolved Hide resolved
Co-authored-by: Alexander Krizhanovsky <[email protected]>
@ttaym ttaym force-pushed the am-755-websocket-proxy-proto branch from e50dc91 to 67cdf28 Compare May 5, 2022 12:15
Signed-off-by: Aleksey Mikhaylov <[email protected]>
@ttaym ttaym force-pushed the am-755-websocket-proxy-proto branch from 67cdf28 to 6b4edba Compare May 5, 2022 12:24
@ttaym ttaym merged commit f550823 into master May 5, 2022
@ttaym ttaym deleted the am-755-websocket-proxy-proto branch May 9, 2022 08:50
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.

3 participants