-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
http请求去除connection header #1495
Comments
你好。我们目前已经支持对header的删除了,具体代码修改可以看这个PR:#1492 void f()
{
WFHttpTask *task = WFTaskFactory::create_http_task(...);
auto *client_task = static_cast<WFClientTask<protocol::HttpRequest, protocol::HttpResponse> *>task;
client_task->set_prepare([](WFHttpTask *t) {
protocol::HttpHeaderCursor cursor(t->get_req());
cursor.find_and_erase("Connection");
});
task->start();
} HttpHeaderCursor的find_and_erase()操作,删除这个名字下的第一个header,如果可能存在多个同名的header,则需要写成循环。例如: void f()
{
while (cursor.find_and_erase("Cookie"))
;
} |
@18328594608 你好,请问是否解决了问题? |
感谢支持! |
后续我在业务上验证过了。使用task新增prepare的方式能够解决我的问题. 感谢支持. |
请问一下,你那边为什么有这个删除connection header对需求呢?删除之后,对连接是否保持的协商可能不准确。 |
这边是因为对向服务器对于这个字段的支持有bug, 在这个字段存在的时候,多次发送请求,他那边服务会拒绝请求.暂时那边改不了就只能先把这个字段删除掉. 连接是否保持这个不考虑,只要能满足正常的回包response功能就行. |
好的。之后可以把服务器也改用workflow实现😂 |
那是一个windows 下的中间件服务 比较古老了 等后面淘汰哈哈😄 |
想要在发送http的时候禁用connection这个header pair 目前没有看到相应的接口 都是默认在发送请求时加上了这个header pair ,能新增一个接口去掉这个header pair么
The text was updated successfully, but these errors were encountered: