如何设置默认的“期望”卷发头 [英] How to setup default "Expect" header for curl

查看:89
本文介绍了如何设置默认的“期望”卷发头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以将我的(CLI) curl 设置为未设置期望:100-继续 还是将其设置为 期望: 用于我的命令行浏览吗?



我遇到了这个问题,GCE负载均衡器返回502的curl,因为它与期望值混淆:100 并中断,现在我必须根据每个请求手动进行设置。 (好吧,不是手动的,我为我经常测试的东西提供了别名,但这不是重点。)

解决方案

创建一个〜/ .curlrc 文件,并将默认选项放入其中。在手册页部分中针对 -K,--config 进行了描述。 / p>

用于关闭Expect:标头的默认选项为:

  header =期望: 


Can I setup my (CLI) curl to either not set "Expect: 100-continue" or to set it to "Expect: " for my command-line browsing?

I've ran into this issue with GCE Load balancer returning 502 for curl because it's confused by Expect: 100 and breaks, and now I have to manually set it up on every request. (Well, not manually, I have aliases for the stuff I test frequently, but that's not the point.)

解决方案

You can create a ~/.curlrc file and put your default options in that. Described in the man page section for -K, --config.

A default option to switch off the Expect: header could be:

header = "Expect:"

这篇关于如何设置默认的“期望”卷发头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆