【问题标题】:send forward slash "\" in http post在 http post 中发送正斜杠“\”
【发布时间】:2020-06-02 19:50:19
【问题描述】:

你好,我正在使用一个非常基本的 html 表单:

<!DOCTYPE html>
<html>
<body>

<h1>The form method="post" attribute</h1>

<form action="http://123.123.123.123" method="post" target="_blank">
<label for="key1">First name:</label>
  <input type="text" id="key1" name="key1"><br><br>
  <label for="key2">Last name:</label>
  <input type="text" id="key2" name="key2"><br><br>

    <label for="key3">First name:</label>
  <input type="text" id="key3" name="key3"><br><br>
  <label for="key4">Last name:</label>
 <input type="text" id="key4" name="key4"><br><br>



  <input type="submit" value="Submit">
</form>
</body>
</html>

我正在使用此表单接收到我的 python http 服务器的 http post 请求,问题是,在最后一个字段中,我需要在服务器上收到的请求中的 1\ 将其保存到变量中并在 os.path.join 中使用它,但是当我尝试发送包含“\”的请求时,我收到:1%5C 而不是,我该如何发送 \ 在此先感谢

【问题讨论】:

    标签: html http http-post webserver


    【解决方案1】:

    %5C 标准格式编码的\

    您需要在服务器上对其进行解码。你可以do it manually,但你应该使用一个自动为你做的HTTP服务器库。例如Django.

    【讨论】:

    • 我正在使用简单的http服务器来接收请求,那么有什么方法可以在一两行代码中解码它?
    猜你喜欢
    • 2012-12-09
    • 1970-01-01
    • 2020-12-20
    • 2015-02-27
    • 2018-01-10
    • 1970-01-01
    • 1970-01-01
    • 2013-11-04
    • 1970-01-01
    相关资源
    最近更新 更多