我是否有充分的理由不应该在 CGI 查询中混合 POST 和 GET 参数?
我是否有充分的理由不应该混合使用 POST 和 GET?
例如:
<form action="http://example.com/?param1=foo¶m2=bar" method="post">
Is there a good reason why I shouldn't be mixing POST and GET?
For example:
<form action="http://example.com/?param1=foo¶m2=bar" method="post">
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如对您问题的评论所述,CGI.pm 可以
CGI::Simple 可以
EmbPerl 的
%fdat
没问题其他一切,你需要阅读文档或只是测试。
重要的问题是你为什么关心“大多数 CGI 库”?您应该选择要使用的库并询问有关该库的问题。
As noted by comments to your question, CGI.pm is OK
CGI::Simple is OK
EmbPerl's
%fdat
is OKEverything else, you need to read documentation or just test.
The important question is why do you care about "most CGI libraries"? You should pick the library you are going to use and ask that question about that library.
这样做有一个很好的理由,至少对于 CGI.pm 来说:
使用 url(无论是 cgi 参数还是路径信息)为文件上传等提供一些上下文非常重要,其中 $POST_MAX 可能会被超出并且所有发布数据被丢弃。只有当服务器知道尝试发布的内容时,它才能给出良好的错误消息。 (你可以使用 HTTP_REFERER 来猜测,但我讨厌依赖它。)
There is a good reason to do this, at least with CGI.pm:
It's important to use the url (whether cgi parameters or path info) to provide some context for things like file uploads, where the $POST_MAX may be exceeded and all the post data be thrown away. Only if the server knows what the attempted post was can it give a good error message. (You could use HTTP_REFERER to guess, but I hate to ever depend on that.)