Github user iilyak commented on a diff in the pull request:
https://github.com/apache/couchdb-chttpd/pull/53#discussion_r36744201
--- Diff: src/chttpd.erl ---
@@ -195,30 +191,46 @@ handle_request_int(MochiReq) ->
Other -> Other
end,
- HttpReq = #httpd{
+ Nonce = couch_util:to_hex(crypto:rand_bytes(5)),
+
+ HttpReq0 = #httpd{
mochi_req = MochiReq,
+ begin_ts = Begin,
+ peer = Peer,
+ original_method = Method1,
+ nonce = Nonce,
method = Method,
path_parts = [list_to_binary(chttpd:unquote(Part))
|| Part <- string:tokens(Path, "/")]
},
+ {ok, HttpReq} = chttpd_plugin:before_request(HttpReq0),
+
+ HandlerKey =
--- End diff --
This change is related to PR. Previously HandlerKey was constructed using
`mochiweb_util:partition(Path, "/")`.
I had to change the logic to use first part from `path_parts` field of
`#httpd{}` record because `#httpd{}` record doesn't have field for full path. I
couldn't just use old way either since plugin might want to manipulate Path in
order to affect handler selection. Therefore HandlerKey calculation has to
happen after `chttpd_plugin:before_request` and it should be based on the value
returned from that call.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---