[GH-ISSUE #1608] 服务端插件接收不到frps请求的json数据 #1272

Closed
opened 2026-05-05 12:48:39 -06:00 by gitea-mirror · 6 comments
Owner

Originally created by @hsk-story on GitHub (Jan 10, 2020).
Original GitHub issue: https://github.com/fatedier/frp/issues/1608

Issue is only used for submiting bug report and documents typo. If there are same issues or answers can be found in documents, we will close it directly.
(为了节约时间,提高处理问题的效率,不按照格式填写的 issue 将会直接关闭。)
(请不要在 issue 评论中出现无意义的 加1我也是 等内容,将会被直接删除。)
(由于个人精力有限,和系统环境,网络环境等相关的求助问题请转至其他论坛或社交平台。)

Use the commands below to provide key information from your environment:
You do NOT have to include this information if this is a FEATURE REQUEST

What version of frp are you using (./frpc -v or ./frps -v)?
0.31.1

What operating system and processor architecture are you using (go env)?
linux/window(都不行)
服务端插件运行在PHP环境上

Configures you used:

[common]
bind_port = 7000
token = 123

[plugin.user-manager]
addr = backend.house
path = /api/tl
ops = Login

Steps to reproduce the issue:
1.配置frps
2.frpc连接
3.服务端插件记录request请求

Describe the results you received:
服务端插件记录的request的json数据为空

Describe the results you expected:

Additional information you deem important (e.g. issue happens only occasionally):
翻阅了源码, 猜测是在frps在请求服务端插件时, 未带Content-Type=application/json的请求头? 由于个人不熟悉go语言, 也不清楚如何编译, 只能提交个issue看看

Can you point out what caused this issue (optional)

Originally created by @hsk-story on GitHub (Jan 10, 2020). Original GitHub issue: https://github.com/fatedier/frp/issues/1608 Issue is only used for submiting bug report and documents typo. If there are same issues or answers can be found in documents, we will close it directly. (为了节约时间,提高处理问题的效率,不按照格式填写的 issue 将会直接关闭。) (请不要在 issue 评论中出现无意义的 **加1**,**我也是** 等内容,将会被直接删除。) (由于个人精力有限,和系统环境,网络环境等相关的求助问题请转至其他论坛或社交平台。) Use the commands below to provide key information from your environment: You do NOT have to include this information if this is a FEATURE REQUEST **What version of frp are you using (./frpc -v or ./frps -v)?** 0.31.1 **What operating system and processor architecture are you using (`go env`)?** linux/window(都不行) 服务端插件运行在PHP环境上 **Configures you used:** ``` [common] bind_port = 7000 token = 123 [plugin.user-manager] addr = backend.house path = /api/tl ops = Login ``` **Steps to reproduce the issue:** 1.配置frps 2.frpc连接 3.服务端插件记录request请求 **Describe the results you received:** 服务端插件记录的request的json数据为空 **Describe the results you expected:** **Additional information you deem important (e.g. issue happens only occasionally):** 翻阅了源码, 猜测是在frps在请求服务端插件时, 未带`Content-Type=application/json`的请求头? 由于个人不熟悉go语言, 也不清楚如何编译, 只能提交个issue看看 **Can you point out what caused this issue (optional)**
Author
Owner

@hsk-story commented on GitHub (Jan 10, 2020):

我刚刚在postman试了一下, 如果请求内容数据json. 请求头没带Content-Type:application/json至少php是肯定接收不到请求内容的

<!-- gh-comment-id:572911636 --> @hsk-story commented on GitHub (Jan 10, 2020): 我刚刚在postman试了一下, 如果请求内容数据json. 请求头没带`Content-Type:application/json`至少php是肯定接收不到请求内容的
Author
Owner

@fatedier commented on GitHub (Jan 10, 2020):

不要依赖 content-type,直接从 request body 中读取数据。

<!-- gh-comment-id:572921808 --> @fatedier commented on GitHub (Jan 10, 2020): 不要依赖 content-type,直接从 request body 中读取数据。
Author
Owner

@hsk-story commented on GitHub (Jan 10, 2020):

不要依赖 content-type,直接从 request body 中读取数据。

这个也是一个办法, 不过从之后从规范的角度来说, 会增加这个请求头吗?

<!-- gh-comment-id:572951958 --> @hsk-story commented on GitHub (Jan 10, 2020): > 不要依赖 content-type,直接从 request body 中读取数据。 这个也是一个办法, 不过从之后从规范的角度来说, 会增加这个请求头吗?
Author
Owner

@QQ2017 commented on GitHub (Jan 10, 2020):

我测试使用易语言(和C语法类似)引用的HP-HTTP Server 组件,是可以接受到数据的。

<!-- gh-comment-id:572976344 --> @QQ2017 commented on GitHub (Jan 10, 2020): 我测试使用易语言(和C语法类似)引用的HP-HTTP Server 组件,是可以接受到数据的。
Author
Owner

@fatedier commented on GitHub (Jan 12, 2020):

@hsk-story 有可能会加,也有可能不会,所以不要强依赖,这不是一个明确的定义。

<!-- gh-comment-id:573388334 --> @fatedier commented on GitHub (Jan 12, 2020): @hsk-story 有可能会加,也有可能不会,所以不要强依赖,这不是一个明确的定义。
Author
Owner

@NemoAlex commented on GitHub (Mar 2, 2020):

还是建议加一下。服务端对不明类型的请求做JSON解析,是比较不合适的。

<!-- gh-comment-id:593358659 --> @NemoAlex commented on GitHub (Mar 2, 2020): 还是建议加一下。服务端对不明类型的请求做JSON解析,是比较不合适的。
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#1272
No description provided.