Skip to content
Permalink
Browse files
Provider path parse compatible with version 2.5.x
  • Loading branch information
DLive committed Aug 13, 2019
1 parent 6dbb46e commit 9e22b0f6cfa32e182e73e79eea391fb176981457
Showing 3 changed files with 9 additions and 3 deletions.
@@ -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(),
@@ -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(),
@@ -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]).
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.

0 comments on commit 9e22b0f

Please sign in to comment.