Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] sub接口支持post请求 #720

Open
3 tasks done
zhzLuke96 opened this issue Mar 8, 2024 · 0 comments
Open
3 tasks done

[Feature] sub接口支持post请求 #720

zhzLuke96 opened this issue Mar 8, 2024 · 0 comments

Comments

@zhzLuke96
Copy link

zhzLuke96 commented Mar 8, 2024

verify

  • 我已经仔细阅读项目文档,确认现有功能无法解决我的需求
  • 我已经检索过现有issue,确认与现有issue的内容并不重复
  • 我已经尝试自行解决,确认自己没有能力解决

功能描述

需求

希望sub接口支持post请求

类似这样

POST /sub HTTP/1.1
...

{
  "target": "clash",
  "new_name": true,
  "url": [ ... ],
  "insert": false,
  "config": "..."
}

原因

由于一些特别的需求,我们在使用subconverter之前,需要把所有的订阅nodes都请求并解析、重写name以添加标记符
请求时类似这样

  const all_nodelist = [...] // 大概400+ nodes
  const local_nodes_url = encodeURIComponent(all_nodelist.join("|"));
  const local_sub = `http://${converter_server}/sub?target=clash&new_name=true&url=${local_nodes_url}&insert=false&config=${encoded_config_url}`;

之前(0.7.x版本)的服务端,对于这种超长nodes请求虽然处理慢但是服务端不会拒绝

现在更新到 0.8.1 版本的镜像之后,无法处理超长的节点url(大概400+ nodes),应该是框架层面阻止了解析超长URI的请求

HTTP/1.1 414 URI Too Long
Connection: close
Keep-Alive: timeout=5, max=5
Content-Length: 0

所以,/sub 接口 是否可以支持post请求,接收json或者query格式的参数数据,以支持超多nodes并避免 URI Too Long 错误

可能的解决方案

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant