我是否有充分的理由不应该在 CGI 查询中混合 POST 和 GET 参数?

发布于 2024-08-22 02:18:49 字数 155 浏览 2 评论 0原文

我是否有充分的理由不应该混合使用 POST 和 GET?

例如:

<form action="http://example.com/?param1=foo&param2=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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

征棹 2024-08-29 02:18:49
  • 正如对您问题的评论所述,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 OK

  • Everything 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.

橘虞初梦 2024-08-29 02:18:49

这样做有一个很好的理由,至少对于 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.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文