【发布时间】:2020-03-18 02:20:26
【问题描述】:
由于某种原因,我不知道 POST 请求不起作用。我很确定问题出在 POST 字符串 "POST /profile.php HTTP/1.1\r\nid=2323\r\nContent-Length: \r\n\r\n" 上。 GET 请求正常工作,但 POST 请求不能正常工作。
我使用 TLS VER 1.0 通过端口 443 连接到服务器
这是我从服务器获得的错误代码。编辑:我正在尝试编辑这篇文章以修复它,它告诉我我的帖子大部分是代码,但我希望不再是。
85 bytes of data sent
HTTP/1.1 400 Bad Request
Content-Type: text/html; charset=utf-8
Date: Fri, 22 Nov 2019 06:56:20 GMT
Connection: close
Content-Length: 2959
<!DOCTYPE html>
<html lang="en" id="facebook">
<head>
<title>Facebook | Error</title>
<meta charset="utf-8">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="cache-control" content="no-store">
<meta http-equiv="cache-control" content="max-age=0">
<meta http-equiv="expires" content="-1">
<meta http-equiv="pragma" content="no-cache">
<meta name="robots" content="noindex,nofollow">
<style>
html, body {
color: #141823;
background-color: #e9eaed;
font-family: Helvetica, Lucida Grande, Arial,
Tahoma, Verdana, sans-serif;
margin: 0;
padding: 0;
text-align: center;
}
#header {
height: 30px;
padding-bottom: 10px;
padding-top: 10px;
text-align: center;
}
#icon {
width: 30px;
}
h1 {
font-size: 18px;
}
p {
font-size: 13px;
}
#footer {
border-top: 1px solid #ddd;
color: #9197a3;
font-size: 12px;
padding: 5px 8px 6px 0;
}
</style>
</head>
<body>
<div id="header">
<a href="//www.facebook.com/">
<img id="icon" src="//static.facebook.com/images/logos/facebook_2x.png" />
</a>
</div>
<div id="core">
<h1 id="sorry">Sorry, something went wrong.</h1>
<p id="promise">
We're working on it and we'll get it fixed as soon as we can.
</p>
<p id="back-link">
<a id="back" href="//www.facebook.com/">Go Back</a>
</p>
<div id="footer">
Facebook
<span id="copyright">
© 2019
</span>
<span id="help-link">
·
<a id="help" href="//www.facebook.com/help/">Help Center</a>
</span>
</div>
</div>
<script>
document.getElementById('back').onclick = function() {
if (history.length > 1) {
history.back();
return false;
}
};
// Adjust the display based on the window size
if (window.innerHeight < 80 || window.innerWidth < 80) {
// Blank if window is too small
document.body.style.display = 'none';
};
if (window.innerWidth < 200 || window.innerHeight < 150) {
document.getElementById('back-link').style.display = 'none';
document.getElementById('help-link').style.display = 'none';
};
if (window.innerWidth < 200) {
document.getElementById('sorry').style.fontSize = '16px';
};
if (window.innerWidth < 150) {
document.getElementById('promise').style.display = 'none';
};
if (window.innerHeight < 150) {
document.getElementById('sorry').style.margin = '4px 0 0 0';
document.getElementById('sorry').style.fontSize = '14px';
document.getElementById('promise').style.display = 'none';
};
</script>
</body>
</html>
3215 bytes received
【问题讨论】:
-
为什么这个问题用 C++ 标记?
-
好吧,我可以将它标记为 C 或 C++,但由于我将 sspi schannel 与 C++ 一起使用,因此我将其标记为 C++
-
没有 C++ 代码。 C++ 开发人员如何帮助您?发布 C++ 代码或删除标签。
-
我不明白你背后的逻辑,“如果没有c++代码,那就不是c++”。为了让你在 C++ 中发送一个 POST 请求,它需要你正确地格式化它,就像在正确的新行和所有那些疯狂的东西中一样。其他编程语言不一样。几乎所有在 c++ 中使用 winsock 编程的人都明白,这个 "POST /profile.php HTTP/1.1\r\nid=2323\r\nContent-Length: \r\n\r\n" 仅适用于 C++ 和类似语言.
-
您用 C++ 标记了这个问题,以接触有 C++ 经验的人,但 C++ 经验对这个问题没有帮助。您还可以标记您的操作系统或显示器的制造商。当然,它在某种程度上是相关的,但它无济于事。使用 C++ 标准、C++ 库或 C++ 编译器的知识无法回答这个问题。它是特定于 Winsock 的。
标签: c++ network-programming winsock sspi schannel