From fc72e2c2928a4f09cda523b527248bb4b2a147b2 Mon Sep 17 00:00:00 2001 From: horizonlin Date: Tue, 11 Dec 2018 14:05:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0urlprotocol=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加urlprotocol启动方法 --- client/tp_assist_win/ts_http_rpc.h | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/client/tp_assist_win/ts_http_rpc.h b/client/tp_assist_win/ts_http_rpc.h index feea70c..2642462 100644 --- a/client/tp_assist_win/ts_http_rpc.h +++ b/client/tp_assist_win/ts_http_rpc.h @@ -15,28 +15,28 @@ /* //================================================================= -ӿʹ˵ +接口使用说明: -󣬼 127.0.0.1:50022httpʽҪ£ +本程序启动后,监听 127.0.0.1:50022,接收http请求,请求格式要求如下: -GET ʽ +GET 方式 http://127.0.0.1:50022/method/json_param -json_paramʹurl_encodeбjsonʽַ +其中json_param是使用url_encode进行编码后的json格式字符串 -POST ʽ +POST 方式 http://127.0.0.1:50022/method -postjson_param +post的数据区域是json_param -УURIΪ֣ -method ִе񷽷 -json_param 񷽷ĸӲûиӲⲿֿʡԡ +其中,URI分为三个部分: +method 请求执行的任务方法。 +json_param 此任务方法的附加参数,如果没有附加参数,这部分可以省略。 -ظʽִн󣬷һjsonʽַߣʽ£ +返回格式:执行结束后,返回一个json格式的字符串给请求者,格式如下: {"code":0,"data":varb} -УcodeDZеģֵһ룬0ʾɹʧܣûdata򡣲ɹʱdata -ķݣʽݾִе񷽷ͬͬ +其中,code是必有的,其值是一个错误编码,0表示成功。如果失败,则可能没有data域。操作成功时,data域就是 +操作的返回数据,其格式根据具体执行的任务方法不同而不同。 */ @@ -54,6 +54,7 @@ public: bool init(const char* ip, int port); void run(void); void stop(void); + void _rpc_func_url_protocol(const ex_astr& func_args, ex_astr& buf); ex_astr get_content_type(ex_astr file_suffix) {