You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "Xzhhhhhh (via GitHub)" <gi...@apache.org> on 2023/08/21 17:55:12 UTC
[GitHub] [dubbo] Xzhhhhhh commented on pull request #12921: modify the judgment logic of httpMethodMatch
Xzhhhhhh commented on PR #12921:
URL: https://github.com/apache/dubbo/pull/12921#issuecomment-1686778447
@suncairong163
我在阅读这段代码时,发现它似乎与注释说明的效果不符。1. fasle的情况下,它能做到不比较httpMethod 2. 都是true的情况下,它能做到比较httpMethod 3. 一个true,一个false的情况下它就不会去httpMethod,这样会导致很多地方有错误。

我提pr之前 #12890 提交的代码还未 `mr,我现在发现你提交此次代码后,我目前这个issues已经得到了解决。主要得益于这段代码

在获取restMethodMetadataPair时将 RestRPCInvocationUtil.createPathMatcher(request);获取的pathMatcher的compareHttpMethod字段设置为了true。这样在你原有的httpMethodMatch逻辑中,就可以获取到比较httpMethod之后的结果了。从而避免了一个为true一个为false的情况。但是在执行它之前,有404 405 的判断,它们都是使用一个true一个false进行判断的,会出现一定问题。

比如这里是一个除了httpMethod字段不一样的几个示例,其他字段都一样的一个示例。这样只需要有一样的路径,不论httpMethod都会返回true,使得404和405的判断有误。

以上是我的一些理解,有误的地方还望多多指教。希望能给你提供帮助。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org