sách gpt4 ai đã đi

ftp - ftp 回复如何工作

In lại 作者:行者123 更新时间:2023-12-03 10:03:13 30 4
mua khóa gpt4 Nike

我一直在阅读 FTP 规范并使用 Wireshark 来捕获我的 FTP 客户端发送/接收的数据包,并有一些关于它们的问题。
首先是来自我的 FTP 服务器的“连接问候语”(如 FTP RFC 所称):

220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 2 of 50 allowed.
220-Local time is now 15:22. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
RFC959#page-35如果在三位数字后面有 - 则表示它是多行响应。因此,后续的 220- 似乎是不必要的,上面的内容可以改写如下:
220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
You are user number 2 of 50 allowed.
Local time is now 15:22. Server port: 21.
This is a private system - No anonymous login
IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
那是对的吗?
另外,线的长度有限制吗? RFC 只提到了一次“行长”。这里:
  A reply is defined to contain the 3-digit code, followed by Space
, followed by one line of text (where some maximum line length
has been specified)
然而,RFC 没有讨论如何或何时指定这样的“最大行长度”。它为这些多行响应提供的特定用例是 STAT 回复,但在我看来,该示例有点人为,因为无论如何我认为 STAT 响应中都没有新行。
最后,人们应该如何知道何时收到回复?以下是 phpBB 的做法:
https://github.com/phpbb/phpbb3/blob/develop/phpBB/includes/functions_transfer.php#L885
LÀM
{
$result = @fgets($this->connection, 512);
$response .= $result;
}
while (substr($result, 3, 1) !== ' ');
他们对 512 的选择似乎是随意的*,然而,暂时忽略了他们的 substr($result, 3, 1) !== ' '也会打破我在这篇文章前面所做的“连接问候”重写。
  • 我说这是任意的,因为数字 512 出现在 RFC 中的唯一一次是在讨论不连续文件传输的页面结构时。

  • 任何见解将不胜感激 - 谢谢!

    1 Câu trả lời

    您对多行响应是正确的。但是许多服务器使用在每行开头重复代码的格式。因此,不幸的是,您需要能够同时处理两者。

    至于线长,我不知道。 phpBB 代码似乎确实没有遵循 RFC。

    关于ftp - ftp 回复如何工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15820936/

    30 4 0
    行者123
    Hồ sơ cá nhân

    Tôi là một lập trình viên xuất sắc, rất giỏi!

    Nhận phiếu giảm giá Didi Taxi miễn phí
    Mã giảm giá Didi Taxi
    Giấy chứng nhận ICP Bắc Kinh số 000000
    Hợp tác quảng cáo: 1813099741@qq.com 6ren.com