-
Notifications
You must be signed in to change notification settings - Fork 104
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
Custom HTTP redirects (Unification) #1628
Conversation
70b8716
to
30de466
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate the effort to aggregate all the response functions - the code now looks much better! There are still places to improve and/or discuss. Also please see new comments in #1618
fw/http.c
Outdated
} | ||
body_len = tfw_str_to_cstr(body, body_val, BODY_BUF_LEN); | ||
if (!body_len) | ||
return TFW_BLOCK; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, tfw_h1_prep_resp()
-> tfw_msg_write()
and tfw_h2_prep_resp()
-> tfw_h2_frame_local_resp()
-> tfw_h2_append_predefined_body()
do allocate skb memory and copy the msg
chunks into it, so we're good with many chunks at this layer, so we can just append body
chunks to msg
and don't need to copy them
I see your comment
Remark:
The body of the js challenge redirect can consist of chunks (tfw_http_sticky_build_redirect()), but tfw_h2_frame_local_resp() is not ready to work with such a body, therefore, to avoid problems, it was temporarily decided to expand such a body into a plain tfw string
, but tfw_h2_frame_local_resp()
accepts body
as TfwStr
, which confuses me. Let's discuss this on the call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tfw_h2_append_predefined_body() for some reason expects a plain string
The function is designed for @body preallocated during
configuration processing thus no chunked body allowed, only plain TfwStr is accepted there
b26974e
to
028430c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made several minor code cleanups and add comment by our discussions.
#856
Remark:
The body of the js challenge redirect can consist of chunks (
tfw_http_sticky_build_redirect()
), buttfw_h2_frame_local_resp()
is not ready to work with such a body, therefore, to avoid problems, it was temporarily decided to expand such a body into a plain tfw string