📄 pop.txt
字号:
Request For Comments: draft Post Office Protocol (revised) Wed Jan 14 18:47:59 1987 Marshall T. Rose Computer Science Laboratory Northrop Research and Technical Center Palos Verdes Peninsula MRose@NRTC.NORTHROP.COM This memo suggests a simple method for workstations to dynamically access mail from a mailbox server. This RFC specifies a proposed protocol for the ARPA Internet community, and requests discussion and suggestions for improvements. Acknowledgements This memo is based on RFC918. Although similar in form to the original POP proposed for the ARPA Internet community, the protocol discussed in this memo is similar in spirit to the ideas investigated by the MZnet project at the University of California, Irvine. Further, substantial work was done on examining POP in a PC-based environment. This work, which resulted in additional functionality in this protocol, was performed by the ACIS Networking Systems Group at Stanford University. The author gratefully acknowledges their interest.Request For Comments: draft M. RosePost Office Protocol (revised) UDel Introduction On certain types of smaller nodes in the ARPA Internet it is often impractical to maintain a message transport system(MTS). For example, a workstation may not have sufficient resources (cycles, disk space) in order to permit a SMTP server and associated local mail delivery system to be kept resident and continuously running. Similarly, it may be expensive (or impossible) to keep a personal computer interconnected to an IP-style network for long amounts of time (the node is lacking the resource known as "connectivity"). Despite this, it is often very useful to be able to manage mail on these smaller nodes, and they often support a user agent(UA) to aid the tasks of mail handling. To solve this problem, a node which can support an MTS entity offers a maildrop service to these less endowned nodes. The Post Office Protocol (POP) is intended to permit a workstation to dynamically access a maildrop on a server host in a useful fashion. Usually, this means that the POP is used to allow a workstation to retrieve mail that the server is holding for it. For the remainder of this memo, the term "client host" refers to a host making use of the POP service, while the term "server host" refers to a host which offers the POP service. A Short Digression This memo does not specify how a client host enters mail into the transport system, although a method consistent with the philosophy of this memo is presented here: When the user agent on a client host wishes to enter a message into the transport system, it establishes an SMTP connection to its relay host (this relay host could be, but need not be, the POP server host for the client host). If this method is followed, then the client host appears to the MTS as a user agent, and should NOT be regarded as a "trusted" MTS entity in any sense whatsoever. This concept, along with the role of the POP as a part of a split-UA model is discussed later in this memo. The Protocol Initially the server host starts the POP service by listening on TCP port 109. When a client host wishes to make use of the service it establishes a TCP connection with the server host. When the connection is established, the POP server sends a greeting. The client and POP server then exchange commands and responses (respectively) until the connection is closed or aborted. Commands in the POP consist of a keyword possibly followed by an argument. All commands are terminated by a CRLF pair. Responses in the POP consist of a success indicator and a keyword possibly followed by additional information. All responses are terminated by a CRLF pair. There are currently two success indicators: positive ("+OK") and negative ("-ERR"). Responses to certain commands are multi-line. In these cases, which are clearly indicated below, after sending the first line of the response and a CRLF, any additional lines are sent, each terminated by a CRLF pair. When all lines of the response have been sent, a final line is sent, consisting of a termination octet (octal code 056, ".") and a CRLF pair. If any line of the multi-line response begins with the termination octet, the line is "bit-stuffed" by pre-pending the termination octet to that line of the response. Hence a multi-line response is terminated with the five octets "CRLF.CRLF". When examining a multi-line response, the client checks to see if the line begins with the termination octet. If so and if octets other than CRLF follow, the the first octet of the line (the termination octet) is stripped away. If so and if CRLF immediately follows the termination character, then the response from the POP server is ended and the line containing ".CRLF" is not considered part of the multi-line response. A POP session progresses through a number of states during its lifetime. Once the TCP connection has been opened and the POP server has sent the greeting, the session enters the AUTHORIZATION state. In this state, the client must identify itself to the POP server. Once the client has successfully done this, the server acquires resources associated with the client's maildrop, and the session enters the TRANSACTION state. In this state, the client requests actions on the part of the POP server. When the client has finished its transactions, the session enters the UPDATE state. In this state, the POP server releases any resources acquired during the TRANSACTION state and says goodbye. The TCP connection is then closed. The AUTHORIZATION State Once the TCP connection has been opened by a POP client, the POP server issues a one line greeting. This can be any string terminated by CRLF. An example might be: S: +OK dewey POP server ready (Comments to: PostMaster@UDel) Note that this greeting is a POP reply. The POP server should always give a positive response as the greeting. The POP session is now in the AUTHORIZATION state. The client must now issue the USER command. If the POP server responds with a positive success indicator ("+OK"), then the client may issue either the PASS command to complete the authorization, or the QUIT command to terminate the POP session. If the POP server responds with a negative success indicator ("-ERR") to the USER command, then the client may either issue a new USER command or may issue the QUIT command. When the client issues the PASS command, the POP server uses the argument pair from the USER and PASS commands to determine if the client should be given access to the appropriate maildrop. If so, the POP server then acquires an exclusive-access lock on the maildrop. If the lock is successfully acquired, the POP server parses the maildrop into individual messages (read note below), determines the last message (if any) present in the maildrop that was referenced by the RETR command, and responds with a positive success indicator. The POP session now enters the TRANSACTION state. If the lock can not be acquired or the client should is denied access to the appropriate maildrop or the maildrop can't be parsed for some reason, the POP server responds with a negative success indicator. (If a lock was acquired but the POP server intends to respond with a negative success indicator, the POP server must release the lock prior to rejecting the command.) At this point, the client may either issue a new USER command and start again, or the client may issue the QUIT command. NOTE: Minimal implementations of the POP need only be able to break a maildrop into its component messages; they need NOT be able to parse individual messages. More advanced implementations may wish to have this capability, for reasons discussed later. After the POP server has parsed the maildrop into individual messages, it assigns a message-id to each message, and notes the size of the message in octets. The first message in the maildrop is assigned a message-id of "1", the second is assigned "2", and so on, so that the n'th message in a maildrop is assigned a message-id of "n". In POP commands and responses, all message-id's and message sizes are expressed in base-10. It sets the "highest number accessed" to be that of the last message referenced by the RETR command. Here are summaries for the three POP command discussed thus far: USER name Arguments: a server specific user-id (required) Restrictions: may only be given in the AUTHORIZATION state after the POP greeting or after an unsuccessful USER or PASS command Possible Responses: +OK name is welcome here -ERR never heard of name Examples: C: USER mrose S: +OK mrose is a real hoopy frood ... C: USER frated S: -ERR sorry, frated doesn't get his mail here PASS string Arguments: a server/user-id specific password (required) Restrictions: may only be given in the AUTHORIZATION state after a successful USER command Possible Responses: +OK maildrop locked and ready -ERR invalid password -ERR unable to lock maildrop Examples: C: USER mrose S: +OK mrose is a real hoopy frood C: PASS secret S: +OK mrose's maildrop has 2 messages (320 octets) ... C: USER mrose S: +OK mrose is a real hoopy frood C: PASS secret S: -ERR unable to lock mrose's maildrop, file already locked QUIT Arguments: none Restrictions: none Possible Responses: +OK Examples: C: QUIT S: +OK dewey POP server signing off The TRANSACTION State Once the client has successfully identified itself to the POP server and the POP server has locked and burst the appropriate maildrop, the POP session is now in the TRANSACTION state. The client may now issue any of the following POP commands repeatedly. After each command, the POP server issues a response. Eventually, the client issues the QUIT command and the POP session enters the UPDATE state. Here are the POP commands valid in the TRANSACTION state: STAT Arguments: none Restrictions: may only be given in the TRANSACTION state. Discussion: The POP server issues a positive response with a line containing information for the maildrop. This line is called a "drop listing" for that maildrop. In order to simplify parsing, all POP servers are required to use a certain format for drop listings. The first octets present must indicate the number of messages in the maildrop. Following this is the size of the maildrop in octets. This memo makes no requirement on what follows the maildrop size. Minimal implementations should just end that line of the response with a CRLF pair. More advanced implementations may include other information. NOTE: This memo STRONGLY discourages implementations from supplying additional information in the drop listing. Other, optional, facilities are discussed later on which permit the client to parse the messages in the maildrop. Note that messages marked as deleted are not counted in either total. Possible Responses: +OK nn mm Examples: C: STAT S: +OK 2 320 LIST [msg] Arguments: a message-id (optionally) If a message-id is given, it may NOT refer to a message marked as deleted. Restrictions: may only be given in the TRANSACTION state. Discussion: If an argument was given and the POP server issues a positive response with a line containing information for that message. This line is called a "scan listing" for that message. If no argument was given and the POP server issues a positive response, then the response given is multi-line. After the initial +OK, for each message in the maildrop, the POP server responds with a line containing information for that message. This line is called a "scan listing" for that message. In order to simplify parsing, all POP servers are required to use a certain format for scan listings. The first octets present must be the message-id of the message. Following the message-id is the size of the message in octets. This memo makes no requirement on what follows the message size in the scan listing. Minimal implementations should just end that line of the response with a CRLF pair. More advanced implementations may include other information, as parsed from the message. NOTE: This memo STRONGLY discourages implementations from supplying additional information in the scan listing. Other, optional, facilities are discussed later on which permit the client to parse the messages in the maildrop. Note that messages marked as deleted are not listed. Possible Responses: +OK scan listing follows -ERR no such message Examples: C: LIST S: +OK 2 messages (320 octets) S: 1 120 S: 2 200 S: . ... C: LIST 2 S: +OK 2 200 ... C: LIST 3 S: -ERR no such message, only 2 messages in maildrop RETR msg Arguments: a message-id (required) This message-id may NOT refer to a message marked as deleted. Restrictions: may only be given in the TRANSACTION state. Discussion: If the POP server issues a positive response, then the response given is multi-line. After the initial +OK, the POP server sends the message corresponding to the given message-id, being careful to bit-stuff the termination character (as with all multi-line responses). If the number associated with this message is higher than the "highest number accessed" in the maildrop, the POP server updates the "highest number accessed" to the number associated with this message. Possible Responses: +OK message follows -ERR no such message Examples: C: RETR 1 S: +OK 120 octets S: <the POP server sends the entire message here> S: . DELE msg Arguments: a message-id (required) This message-id may NOT refer to a message marked as deleted. Restrictions: may only be given in the TRANSACTION state. Discussion: The POP server marks the message as deleted. Any future reference to the message-id associated with the message in a POP command generates an error. The POP server does not actually delete the message until the POP session enters the UPDATE state.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -