You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by dl...@apache.org on 2019/08/13 02:48:21 UTC

[dubbo-erlang] branch 0.4.0 updated: Provider path parse compatible with version 2.5.x

This is an automated email from the ASF dual-hosted git repository.

dlive pushed a commit to branch 0.4.0
in repository https://gitbox.apache.org/repos/asf/dubbo-erlang.git


The following commit(s) were added to refs/heads/0.4.0 by this push:
     new 9e22b0f  Provider path parse compatible with version 2.5.x
9e22b0f is described below

commit 9e22b0f6cfa32e182e73e79eea391fb176981457
Author: DLive <xs...@163.com>
AuthorDate: Tue Aug 13 10:47:31 2019 +0800

    Provider path parse compatible with version 2.5.x
---
 include/dubbo.hrl               | 1 +
 src/dubbo_common_fun.erl        | 2 +-
 src/dubbo_serializa_hessian.erl | 9 +++++++--
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/include/dubbo.hrl b/include/dubbo.hrl
index b6a32e9..cbf3e9e 100644
--- a/include/dubbo.hrl
+++ b/include/dubbo.hrl
@@ -38,6 +38,7 @@
 -define(REQUEST_TIME_OUT, 5000).
 
 -define(LINE_SEPERATOR, <<"\n"/utf8>>).
+-define(URL_PATH_SEPARATOR,47).  %% 47 == <<"/">>
 
 -record(dubbo_request, {
     serialize_type = 2 :: integer(),
diff --git a/src/dubbo_common_fun.erl b/src/dubbo_common_fun.erl
index fff65bb..4d1562a 100644
--- a/src/dubbo_common_fun.erl
+++ b/src/dubbo_common_fun.erl
@@ -17,10 +17,10 @@
 -module(dubbo_common_fun).
 
 -include("dubboerl.hrl").
+-include("dubbo.hrl").
 %% API
 -export([local_ip_v4/0, local_ip_v4_str/0, parse_url/1, url_to_binary/1, parse_url_parameter/1, binary_list_join/2]).
 
--define(URL_PATH_SEPARATOR,47).  %% 47 == <<"/">>
 
 local_ip_v4() ->
     {ok, Addrs} = inet:getifaddrs(),
diff --git a/src/dubbo_serializa_hessian.erl b/src/dubbo_serializa_hessian.erl
index 0b30e04..79a1b96 100644
--- a/src/dubbo_serializa_hessian.erl
+++ b/src/dubbo_serializa_hessian.erl
@@ -192,7 +192,7 @@ decode_request(Req, Data) ->
 decode_request(dubbo_rpc_invocation, Req, Data) ->
     {ResultList, _NewState, _RestData} = decode_request_body(Data, cotton_hessian:init(), [dubbo, path, version, method_name, desc_and_args, attachments]),
     [_DubboVersion, Path, Version, MethodName, Desc, ArgsObj, Attachments] = ResultList,
-    RpcData = #dubbo_rpc_invocation{className = Path, classVersion = Version, methodName = MethodName, parameterDesc = Data, parameters = ArgsObj, attachments = Attachments},
+    RpcData = #dubbo_rpc_invocation{className = trans_path_to_classname(Path), classVersion = Version, methodName = MethodName, parameterDesc = Data, parameters = ArgsObj, attachments = Attachments},
     Req2 = Req#dubbo_request{data = RpcData},
     {ok, Req2};
 decode_request(dubbo_event, Req, Data) ->
@@ -233,4 +233,9 @@ decode_request_body_args([ArgsType | RestList], Data, State, ArgsObjList) when A
 decode_request_body_args([_ArgsType | RestList], Data, State, ArgsObjList) ->
     {Rest, ArgObj, NewState} = cotton_hessian:decode(Data, State),
     ArgObj2 = dubbo_type_transfer:classobj_to_native(ArgObj, NewState),
-    decode_request_body_args(RestList, Rest, NewState, ArgsObjList ++ [ArgObj2]).
\ No newline at end of file
+    decode_request_body_args(RestList, Rest, NewState, ArgsObjList ++ [ArgObj2]).
+
+trans_path_to_classname(<<?URL_PATH_SEPARATOR:8,Rest/binary>>) ->
+    Rest;
+trans_path_to_classname(Path) ->
+    Path.