关于使用查询参数的 http 表单 GET 方法的问题

发布于 2024-08-27 18:19:22 字数 453 浏览 4 评论 0原文

我正在查看 WebSVN 中的一个错误,当我进入文件日志并单击比较时,它会丢失存储库名称作为请求的一部分。细节并不重要。

但是,我已经将错误追踪到一个 http 表单,如下所示:

<form method="get" action="comp.php?repname=Binaries&amp;" id="compare">
  ....
  <input type="hidden" name="KEY" value="VALUE">

这应该有效吗?指定为 URL 一部分的“repname”参数和隐藏值都会发送吗? Chrome 4.1 似乎只发送隐藏参数,并完全删除了repname 参数。这是正确的吗?

我暂时修复了它,等待更多信息,通过添加另一个具有相同值的repname隐藏字段,现在一切正常,我只是想知道Chrome或WebSVN是否在这里出错。

I am looking at a bug in WebSVN where when I get into a file log and click on compare, it looses the repository name as part of the request. The details are unimportant.

However, I've tracked down the bug to a http form that looks like this:

<form method="get" action="comp.php?repname=Binaries&" id="compare">
  ....
  <input type="hidden" name="KEY" value="VALUE">

Is this supposed to work? Will both the "repname" argument, specified as part of the URL, and the hidden value be sent? It seems Chrome 4.1 only sends the hidden argument, and removes the repname parameter altogether. Is this correct?

I fixed it temporarily, pending more information, by adding another hidden field for repname with the same value, and now everything works, I'm just wondering if Chrome or WebSVN is in fault here.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

花间憩 2024-09-03 18:19:22

你应该删除 &从操作值的末尾开始,这可能会给您带来麻烦。如果你需要传递一个 & 符号,你应该将其 url-encode 为 %26

编辑:你绝对应该按照你修复它的方式来做 - 通过将repname作为另一个隐藏变量传递 - 因为某些浏览器在处理显式时确实有奇怪的行为和 get 中的隐式 url 变量:)

you should remove the & from the end of the action value, that will likely just cause you trouble. if you need to pass an ampersand through, you should url-encode it as %26

edit: you should definitely do it the way you fixed it - by passing repname as another hidden variable - since some browsers do have weird behaviour when dealing with explicit and implicit url vars in a get :)

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