-
Notifications
You must be signed in to change notification settings - Fork 69
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
Safer interface for module configuration access. #142
Conversation
414e1e7
to
90eab04
Compare
d82c211
to
22547da
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 like the changes in the examples.
Looks good to me.
|
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.
Since we're still following the conventional commits spec, please mark the commit as breaking by changing prefix to refactor!:
.
Please, also add some description and migration guide for all the breaking changes to the commit message.
Done as requested. One remark: should we keep two almost identical implementations of |
be6dd4e
to
9a62461
Compare
* original version was prepared by Aleksei Bavshin
Breaking changes:
|
Proposed changes
Safer interface for module configuration access; this PR resolves #105.
Public objects added for several standard HTTP modules from nginx: core, SSL, upstream, HTTP V2, and HTTP V3. New public traits are defined for each module configuration type (main, server, location) and appropriate access functions. These traits are implemented for HTTP module objects mentioned above. New modules should implement necessary traits to use new configuration interface.
New internal trait
HttpModuleConfExt
is defined to access configuration data in nginx types. It is implemented forngx_cycle_t
,ngx_conf_t
,ngx_http_core_srv_conf_t
,ngx_http_request_t
,ngx_http_upstream_srv_conf_t
, and for Rust shell typengx::http::Request
.Original version was prepared by Aleksei Bavshin
Changes required to access configuration from standard HTTP modules
Sample changes needed to get main configuration of core module are shown below:
Note that the type of
cmcf
variable changed from* mut ngx_http_core_main_conf_t
to&mut ngx_http_core_main_conf_t
.These changes can be viewed in any module in
examples
.Changes necessary to use new interface in Rust modules
http::HttpModule
. It shall be implemented for each module:Similar traits can be defined for main and server-specific configurations.