Internet Engineering Task Force (IETF)                    P. Saint-Andre
Request for Comments: 6120                                         Cisco
Obsoletes: 3920                                               March 2011
Category: Standards Track
ISSN: 2070-1721
        
Internet Engineering Task Force (IETF)                    P. Saint-Andre
Request for Comments: 6120                                         Cisco
Obsoletes: 3920                                               March 2011
Category: Standards Track
ISSN: 2070-1721
        

Extensible Messaging and Presence Protocol (XMPP): Core

可扩展消息和状态协议(XMPP):核心

Abstract

摘要

The Extensible Messaging and Presence Protocol (XMPP) is an application profile of the Extensible Markup Language (XML) that enables the near-real-time exchange of structured yet extensible data between any two or more network entities. This document defines XMPP's core protocol methods: setup and teardown of XML streams, channel encryption, authentication, error handling, and communication primitives for messaging, network availability ("presence"), and request-response interactions. This document obsoletes RFC 3920.

可扩展消息和状态协议(XMPP)是可扩展标记语言(XML)的应用程序配置文件,它支持在任意两个或多个网络实体之间近实时地交换结构化但可扩展的数据。本文档定义了XMPP的核心协议方法:XML流的设置和拆卸、通道加密、身份验证、错误处理以及用于消息传递、网络可用性(“存在”)和请求-响应交互的通信原语。本文件废除RFC 3920。

Status of This Memo

关于下段备忘

This is an Internet Standards Track document.

这是一份互联网标准跟踪文件。

This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 5741.

本文件是互联网工程任务组(IETF)的产品。它代表了IETF社区的共识。它已经接受了公众审查,并已被互联网工程指导小组(IESG)批准出版。有关互联网标准的更多信息,请参见RFC 5741第2节。

Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at http://www.rfc-editor.org/info/rfc6120.

有关本文件当前状态、任何勘误表以及如何提供反馈的信息,请访问http://www.rfc-editor.org/info/rfc6120.

Copyright Notice

版权公告

Copyright (c) 2011 IETF Trust and the persons identified as the document authors. All rights reserved.

版权所有(c)2011 IETF信托基金和确定为文件作者的人员。版权所有。

This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.

本文件受BCP 78和IETF信托有关IETF文件的法律规定的约束(http://trustee.ietf.org/license-info)自本文件出版之日起生效。请仔细阅读这些文件,因为它们描述了您对本文件的权利和限制。从本文件中提取的代码组件必须包括信托法律条款第4.e节中所述的简化BSD许可证文本,并提供简化BSD许可证中所述的无担保。

Table of Contents

目录

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   8
     1.1.   Overview . . . . . . . . . . . . . . . . . . . . . . . .   8
     1.2.   History  . . . . . . . . . . . . . . . . . . . . . . . .   8
     1.3.   Functional Summary . . . . . . . . . . . . . . . . . . .   9
     1.4.   Terminology  . . . . . . . . . . . . . . . . . . . . . .  11
   2.  Architecture  . . . . . . . . . . . . . . . . . . . . . . . .  13
     2.1.   Global Addresses . . . . . . . . . . . . . . . . . . . .  13
     2.2.   Presence . . . . . . . . . . . . . . . . . . . . . . . .  14
     2.3.   Persistent Streams . . . . . . . . . . . . . . . . . . .  14
     2.4.   Structured Data  . . . . . . . . . . . . . . . . . . . .  14
     2.5.   Distributed Network of Clients and Servers . . . . . . .  14
   3.  TCP Binding . . . . . . . . . . . . . . . . . . . . . . . . .  16
     3.1.   Scope  . . . . . . . . . . . . . . . . . . . . . . . . .  16
     3.2.   Resolution of Fully Qualified Domain Names . . . . . . .  17
       3.2.1.   Preferred Process: SRV Lookup  . . . . . . . . . . .  17
       3.2.2.   Fallback Processes . . . . . . . . . . . . . . . . .  18
       3.2.3.   When Not to Use SRV  . . . . . . . . . . . . . . . .  18
       3.2.4.   Use of SRV Records with Add-On Services  . . . . . .  19
     3.3.   Reconnection . . . . . . . . . . . . . . . . . . . . . .  19
     3.4.   Reliability  . . . . . . . . . . . . . . . . . . . . . .  20
   4.  XML Streams . . . . . . . . . . . . . . . . . . . . . . . . .  20
     4.1.   Stream Fundamentals  . . . . . . . . . . . . . . . . . .  20
     4.2.   Opening a Stream . . . . . . . . . . . . . . . . . . . .  23
     4.3.   Stream Negotiation . . . . . . . . . . . . . . . . . . .  24
       4.3.1.   Basic Concepts . . . . . . . . . . . . . . . . . . .  24
       4.3.2.   Stream Features Format . . . . . . . . . . . . . . .  25
       4.3.3.   Restarts . . . . . . . . . . . . . . . . . . . . . .  27
       4.3.4.   Resending Features . . . . . . . . . . . . . . . . .  27
       4.3.5.   Completion of Stream Negotiation . . . . . . . . . .  27
       4.3.6.   Determination of Addresses . . . . . . . . . . . . .  28
       4.3.7.   Flow Chart . . . . . . . . . . . . . . . . . . . . .  29
     4.4.   Closing a Stream . . . . . . . . . . . . . . . . . . . .  31
     4.5.   Directionality . . . . . . . . . . . . . . . . . . . . .  32
     4.6.   Handling of Silent Peers . . . . . . . . . . . . . . . .  33
       4.6.1.   Dead Connection  . . . . . . . . . . . . . . . . . .  34
       4.6.2.   Broken Stream  . . . . . . . . . . . . . . . . . . .  34
       4.6.3.   Idle Peer  . . . . . . . . . . . . . . . . . . . . .  34
       4.6.4.   Use of Checking Methods  . . . . . . . . . . . . . .  35
     4.7.   Stream Attributes  . . . . . . . . . . . . . . . . . . .  35
       4.7.1.   from . . . . . . . . . . . . . . . . . . . . . . . .  35
       4.7.2.   to . . . . . . . . . . . . . . . . . . . . . . . . .  37
       4.7.3.   id . . . . . . . . . . . . . . . . . . . . . . . . .  38
       4.7.4.   xml:lang . . . . . . . . . . . . . . . . . . . . . .  39
       4.7.5.   version  . . . . . . . . . . . . . . . . . . . . . .  41
       4.7.6.   Summary of Stream Attributes . . . . . . . . . . . .  43
     4.8.   XML Namespaces . . . . . . . . . . . . . . . . . . . . .  43
        
   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   8
     1.1.   Overview . . . . . . . . . . . . . . . . . . . . . . . .   8
     1.2.   History  . . . . . . . . . . . . . . . . . . . . . . . .   8
     1.3.   Functional Summary . . . . . . . . . . . . . . . . . . .   9
     1.4.   Terminology  . . . . . . . . . . . . . . . . . . . . . .  11
   2.  Architecture  . . . . . . . . . . . . . . . . . . . . . . . .  13
     2.1.   Global Addresses . . . . . . . . . . . . . . . . . . . .  13
     2.2.   Presence . . . . . . . . . . . . . . . . . . . . . . . .  14
     2.3.   Persistent Streams . . . . . . . . . . . . . . . . . . .  14
     2.4.   Structured Data  . . . . . . . . . . . . . . . . . . . .  14
     2.5.   Distributed Network of Clients and Servers . . . . . . .  14
   3.  TCP Binding . . . . . . . . . . . . . . . . . . . . . . . . .  16
     3.1.   Scope  . . . . . . . . . . . . . . . . . . . . . . . . .  16
     3.2.   Resolution of Fully Qualified Domain Names . . . . . . .  17
       3.2.1.   Preferred Process: SRV Lookup  . . . . . . . . . . .  17
       3.2.2.   Fallback Processes . . . . . . . . . . . . . . . . .  18
       3.2.3.   When Not to Use SRV  . . . . . . . . . . . . . . . .  18
       3.2.4.   Use of SRV Records with Add-On Services  . . . . . .  19
     3.3.   Reconnection . . . . . . . . . . . . . . . . . . . . . .  19
     3.4.   Reliability  . . . . . . . . . . . . . . . . . . . . . .  20
   4.  XML Streams . . . . . . . . . . . . . . . . . . . . . . . . .  20
     4.1.   Stream Fundamentals  . . . . . . . . . . . . . . . . . .  20
     4.2.   Opening a Stream . . . . . . . . . . . . . . . . . . . .  23
     4.3.   Stream Negotiation . . . . . . . . . . . . . . . . . . .  24
       4.3.1.   Basic Concepts . . . . . . . . . . . . . . . . . . .  24
       4.3.2.   Stream Features Format . . . . . . . . . . . . . . .  25
       4.3.3.   Restarts . . . . . . . . . . . . . . . . . . . . . .  27
       4.3.4.   Resending Features . . . . . . . . . . . . . . . . .  27
       4.3.5.   Completion of Stream Negotiation . . . . . . . . . .  27
       4.3.6.   Determination of Addresses . . . . . . . . . . . . .  28
       4.3.7.   Flow Chart . . . . . . . . . . . . . . . . . . . . .  29
     4.4.   Closing a Stream . . . . . . . . . . . . . . . . . . . .  31
     4.5.   Directionality . . . . . . . . . . . . . . . . . . . . .  32
     4.6.   Handling of Silent Peers . . . . . . . . . . . . . . . .  33
       4.6.1.   Dead Connection  . . . . . . . . . . . . . . . . . .  34
       4.6.2.   Broken Stream  . . . . . . . . . . . . . . . . . . .  34
       4.6.3.   Idle Peer  . . . . . . . . . . . . . . . . . . . . .  34
       4.6.4.   Use of Checking Methods  . . . . . . . . . . . . . .  35
     4.7.   Stream Attributes  . . . . . . . . . . . . . . . . . . .  35
       4.7.1.   from . . . . . . . . . . . . . . . . . . . . . . . .  35
       4.7.2.   to . . . . . . . . . . . . . . . . . . . . . . . . .  37
       4.7.3.   id . . . . . . . . . . . . . . . . . . . . . . . . .  38
       4.7.4.   xml:lang . . . . . . . . . . . . . . . . . . . . . .  39
       4.7.5.   version  . . . . . . . . . . . . . . . . . . . . . .  41
       4.7.6.   Summary of Stream Attributes . . . . . . . . . . . .  43
     4.8.   XML Namespaces . . . . . . . . . . . . . . . . . . . . .  43
        
       4.8.1.   Stream Namespace . . . . . . . . . . . . . . . . . .  43
       4.8.2.   Content Namespace  . . . . . . . . . . . . . . . . .  43
       4.8.3.   XMPP Content Namespaces  . . . . . . . . . . . . . .  44
       4.8.4.   Other Namespaces . . . . . . . . . . . . . . . . . .  46
       4.8.5.   Namespace Declarations and Prefixes  . . . . . . . .  47
     4.9.   Stream Errors  . . . . . . . . . . . . . . . . . . . . .  48
       4.9.1.   Rules  . . . . . . . . . . . . . . . . . . . . . . .  48
         4.9.1.1.  Stream Errors Are Unrecoverable . . . . . . . . .  48
         4.9.1.2.  Stream Errors Can Occur During Setup  . . . . . .  49
         4.9.1.3.  Stream Errors When the Host Is Unspecified or
                   Unknown . . . . . . . . . . . . . . . . . . . . .  50
         4.9.1.4.  Where Stream Errors Are Sent  . . . . . . . . . .  50
       4.9.2.   Syntax . . . . . . . . . . . . . . . . . . . . . . .  51
       4.9.3.   Defined Stream Error Conditions  . . . . . . . . . .  52
         4.9.3.1.  bad-format  . . . . . . . . . . . . . . . . . . .  52
         4.9.3.2.  bad-namespace-prefix  . . . . . . . . . . . . . .  52
         4.9.3.3.  conflict  . . . . . . . . . . . . . . . . . . . .  53
         4.9.3.4.  connection-timeout  . . . . . . . . . . . . . . .  54
         4.9.3.5.  host-gone . . . . . . . . . . . . . . . . . . . .  54
         4.9.3.6.  host-unknown  . . . . . . . . . . . . . . . . . .  55
         4.9.3.7.  improper-addressing . . . . . . . . . . . . . . .  56
         4.9.3.8.  internal-server-error . . . . . . . . . . . . . .  56
         4.9.3.9.  invalid-from  . . . . . . . . . . . . . . . . . .  56
         4.9.3.10. invalid-namespace . . . . . . . . . . . . . . . .  57
         4.9.3.11. invalid-xml . . . . . . . . . . . . . . . . . . .  57
         4.9.3.12. not-authorized  . . . . . . . . . . . . . . . . .  58
         4.9.3.13. not-well-formed . . . . . . . . . . . . . . . . .  59
         4.9.3.14. policy-violation  . . . . . . . . . . . . . . . .  59
         4.9.3.15. remote-connection-failed  . . . . . . . . . . . .  60
         4.9.3.16. reset . . . . . . . . . . . . . . . . . . . . . .  60
         4.9.3.17. resource-constraint . . . . . . . . . . . . . . .  61
         4.9.3.18. restricted-xml  . . . . . . . . . . . . . . . . .  61
         4.9.3.19. see-other-host  . . . . . . . . . . . . . . . . .  62
         4.9.3.20. system-shutdown . . . . . . . . . . . . . . . . .  64
         4.9.3.21. undefined-condition . . . . . . . . . . . . . . .  64
         4.9.3.22. unsupported-encoding  . . . . . . . . . . . . . .  64
         4.9.3.23. unsupported-feature . . . . . . . . . . . . . . .  65
         4.9.3.24. unsupported-stanza-type . . . . . . . . . . . . .  65
         4.9.3.25. unsupported-version . . . . . . . . . . . . . . .  66
       4.9.4.   Application-Specific Conditions  . . . . . . . . . .  67
     4.10.  Simplified Stream Examples . . . . . . . . . . . . . . .  68
   5.  STARTTLS Negotiation  . . . . . . . . . . . . . . . . . . . .  69
     5.1.   Fundamentals . . . . . . . . . . . . . . . . . . . . . .  69
     5.2.   Support  . . . . . . . . . . . . . . . . . . . . . . . .  70
     5.3.   Stream Negotiation Rules . . . . . . . . . . . . . . . .  70
       5.3.1.   Mandatory-to-Negotiate . . . . . . . . . . . . . . .  70
       5.3.2.   Restart  . . . . . . . . . . . . . . . . . . . . . .  70
       5.3.3.   Data Formatting  . . . . . . . . . . . . . . . . . .  70
        
       4.8.1.   Stream Namespace . . . . . . . . . . . . . . . . . .  43
       4.8.2.   Content Namespace  . . . . . . . . . . . . . . . . .  43
       4.8.3.   XMPP Content Namespaces  . . . . . . . . . . . . . .  44
       4.8.4.   Other Namespaces . . . . . . . . . . . . . . . . . .  46
       4.8.5.   Namespace Declarations and Prefixes  . . . . . . . .  47
     4.9.   Stream Errors  . . . . . . . . . . . . . . . . . . . . .  48
       4.9.1.   Rules  . . . . . . . . . . . . . . . . . . . . . . .  48
         4.9.1.1.  Stream Errors Are Unrecoverable . . . . . . . . .  48
         4.9.1.2.  Stream Errors Can Occur During Setup  . . . . . .  49
         4.9.1.3.  Stream Errors When the Host Is Unspecified or
                   Unknown . . . . . . . . . . . . . . . . . . . . .  50
         4.9.1.4.  Where Stream Errors Are Sent  . . . . . . . . . .  50
       4.9.2.   Syntax . . . . . . . . . . . . . . . . . . . . . . .  51
       4.9.3.   Defined Stream Error Conditions  . . . . . . . . . .  52
         4.9.3.1.  bad-format  . . . . . . . . . . . . . . . . . . .  52
         4.9.3.2.  bad-namespace-prefix  . . . . . . . . . . . . . .  52
         4.9.3.3.  conflict  . . . . . . . . . . . . . . . . . . . .  53
         4.9.3.4.  connection-timeout  . . . . . . . . . . . . . . .  54
         4.9.3.5.  host-gone . . . . . . . . . . . . . . . . . . . .  54
         4.9.3.6.  host-unknown  . . . . . . . . . . . . . . . . . .  55
         4.9.3.7.  improper-addressing . . . . . . . . . . . . . . .  56
         4.9.3.8.  internal-server-error . . . . . . . . . . . . . .  56
         4.9.3.9.  invalid-from  . . . . . . . . . . . . . . . . . .  56
         4.9.3.10. invalid-namespace . . . . . . . . . . . . . . . .  57
         4.9.3.11. invalid-xml . . . . . . . . . . . . . . . . . . .  57
         4.9.3.12. not-authorized  . . . . . . . . . . . . . . . . .  58
         4.9.3.13. not-well-formed . . . . . . . . . . . . . . . . .  59
         4.9.3.14. policy-violation  . . . . . . . . . . . . . . . .  59
         4.9.3.15. remote-connection-failed  . . . . . . . . . . . .  60
         4.9.3.16. reset . . . . . . . . . . . . . . . . . . . . . .  60
         4.9.3.17. resource-constraint . . . . . . . . . . . . . . .  61
         4.9.3.18. restricted-xml  . . . . . . . . . . . . . . . . .  61
         4.9.3.19. see-other-host  . . . . . . . . . . . . . . . . .  62
         4.9.3.20. system-shutdown . . . . . . . . . . . . . . . . .  64
         4.9.3.21. undefined-condition . . . . . . . . . . . . . . .  64
         4.9.3.22. unsupported-encoding  . . . . . . . . . . . . . .  64
         4.9.3.23. unsupported-feature . . . . . . . . . . . . . . .  65
         4.9.3.24. unsupported-stanza-type . . . . . . . . . . . . .  65
         4.9.3.25. unsupported-version . . . . . . . . . . . . . . .  66
       4.9.4.   Application-Specific Conditions  . . . . . . . . . .  67
     4.10.  Simplified Stream Examples . . . . . . . . . . . . . . .  68
   5.  STARTTLS Negotiation  . . . . . . . . . . . . . . . . . . . .  69
     5.1.   Fundamentals . . . . . . . . . . . . . . . . . . . . . .  69
     5.2.   Support  . . . . . . . . . . . . . . . . . . . . . . . .  70
     5.3.   Stream Negotiation Rules . . . . . . . . . . . . . . . .  70
       5.3.1.   Mandatory-to-Negotiate . . . . . . . . . . . . . . .  70
       5.3.2.   Restart  . . . . . . . . . . . . . . . . . . . . . .  70
       5.3.3.   Data Formatting  . . . . . . . . . . . . . . . . . .  70
        
       5.3.4.   Order of TLS and SASL Negotiations . . . . . . . . .  71
       5.3.5.   TLS Renegotiation  . . . . . . . . . . . . . . . . .  71
       5.3.6.   TLS Extensions . . . . . . . . . . . . . . . . . . .  72
     5.4.   Process  . . . . . . . . . . . . . . . . . . . . . . . .  72
       5.4.1.   Exchange of Stream Headers and Stream Features . . .  72
       5.4.2.   Initiation of STARTTLS Negotiation . . . . . . . . .  73
         5.4.2.1.  STARTTLS Command  . . . . . . . . . . . . . . . .  73
         5.4.2.2.  Failure Case  . . . . . . . . . . . . . . . . . .  73
         5.4.2.3.  Proceed Case  . . . . . . . . . . . . . . . . . .  74
       5.4.3.   TLS Negotiation  . . . . . . . . . . . . . . . . . .  74
         5.4.3.1.  Rules . . . . . . . . . . . . . . . . . . . . . .  74
         5.4.3.2.  TLS Failure . . . . . . . . . . . . . . . . . . .  75
         5.4.3.3.  TLS Success . . . . . . . . . . . . . . . . . . .  76
   6.  SASL Negotiation  . . . . . . . . . . . . . . . . . . . . . .  77
     6.1.   Fundamentals . . . . . . . . . . . . . . . . . . . . . .  77
     6.2.   Support  . . . . . . . . . . . . . . . . . . . . . . . .  77
     6.3.   Stream Negotiation Rules . . . . . . . . . . . . . . . .  77
       6.3.1.   Mandatory-to-Negotiate . . . . . . . . . . . . . . .  77
       6.3.2.   Restart  . . . . . . . . . . . . . . . . . . . . . .  78
       6.3.3.   Mechanism Preferences  . . . . . . . . . . . . . . .  78
       6.3.4.   Mechanism Offers . . . . . . . . . . . . . . . . . .  78
       6.3.5.   Data Formatting  . . . . . . . . . . . . . . . . . .  79
       6.3.6.   Security Layers  . . . . . . . . . . . . . . . . . .  80
       6.3.7.   Simple User Name . . . . . . . . . . . . . . . . . .  80
       6.3.8.   Authorization Identity . . . . . . . . . . . . . . .  80
       6.3.9.   Realms . . . . . . . . . . . . . . . . . . . . . . .  81
       6.3.10.  Round Trips  . . . . . . . . . . . . . . . . . . . .  81
     6.4.   Process  . . . . . . . . . . . . . . . . . . . . . . . .  82
       6.4.1.   Exchange of Stream Headers and Stream Features . . .  82
       6.4.2.   Initiation . . . . . . . . . . . . . . . . . . . . .  83
       6.4.3.   Challenge-Response Sequence  . . . . . . . . . . . .  84
       6.4.4.   Abort  . . . . . . . . . . . . . . . . . . . . . . .  84
       6.4.5.   SASL Failure . . . . . . . . . . . . . . . . . . . .  85
       6.4.6.   SASL Success . . . . . . . . . . . . . . . . . . . .  86
     6.5.   SASL Errors  . . . . . . . . . . . . . . . . . . . . . .  87
       6.5.1.   aborted  . . . . . . . . . . . . . . . . . . . . . .  88
       6.5.2.   account-disabled . . . . . . . . . . . . . . . . . .  88
       6.5.3.   credentials-expired  . . . . . . . . . . . . . . . .  88
       6.5.4.   encryption-required  . . . . . . . . . . . . . . . .  89
       6.5.5.   incorrect-encoding . . . . . . . . . . . . . . . . .  89
       6.5.6.   invalid-authzid  . . . . . . . . . . . . . . . . . .  89
       6.5.7.   invalid-mechanism  . . . . . . . . . . . . . . . . .  90
       6.5.8.   malformed-request  . . . . . . . . . . . . . . . . .  90
       6.5.9.   mechanism-too-weak . . . . . . . . . . . . . . . . .  90
       6.5.10.  not-authorized . . . . . . . . . . . . . . . . . . .  91
       6.5.11.  temporary-auth-failure . . . . . . . . . . . . . . .  91
     6.6.   SASL Definition  . . . . . . . . . . . . . . . . . . . .  91
   7.  Resource Binding  . . . . . . . . . . . . . . . . . . . . . .  92
        
       5.3.4.   Order of TLS and SASL Negotiations . . . . . . . . .  71
       5.3.5.   TLS Renegotiation  . . . . . . . . . . . . . . . . .  71
       5.3.6.   TLS Extensions . . . . . . . . . . . . . . . . . . .  72
     5.4.   Process  . . . . . . . . . . . . . . . . . . . . . . . .  72
       5.4.1.   Exchange of Stream Headers and Stream Features . . .  72
       5.4.2.   Initiation of STARTTLS Negotiation . . . . . . . . .  73
         5.4.2.1.  STARTTLS Command  . . . . . . . . . . . . . . . .  73
         5.4.2.2.  Failure Case  . . . . . . . . . . . . . . . . . .  73
         5.4.2.3.  Proceed Case  . . . . . . . . . . . . . . . . . .  74
       5.4.3.   TLS Negotiation  . . . . . . . . . . . . . . . . . .  74
         5.4.3.1.  Rules . . . . . . . . . . . . . . . . . . . . . .  74
         5.4.3.2.  TLS Failure . . . . . . . . . . . . . . . . . . .  75
         5.4.3.3.  TLS Success . . . . . . . . . . . . . . . . . . .  76
   6.  SASL Negotiation  . . . . . . . . . . . . . . . . . . . . . .  77
     6.1.   Fundamentals . . . . . . . . . . . . . . . . . . . . . .  77
     6.2.   Support  . . . . . . . . . . . . . . . . . . . . . . . .  77
     6.3.   Stream Negotiation Rules . . . . . . . . . . . . . . . .  77
       6.3.1.   Mandatory-to-Negotiate . . . . . . . . . . . . . . .  77
       6.3.2.   Restart  . . . . . . . . . . . . . . . . . . . . . .  78
       6.3.3.   Mechanism Preferences  . . . . . . . . . . . . . . .  78
       6.3.4.   Mechanism Offers . . . . . . . . . . . . . . . . . .  78
       6.3.5.   Data Formatting  . . . . . . . . . . . . . . . . . .  79
       6.3.6.   Security Layers  . . . . . . . . . . . . . . . . . .  80
       6.3.7.   Simple User Name . . . . . . . . . . . . . . . . . .  80
       6.3.8.   Authorization Identity . . . . . . . . . . . . . . .  80
       6.3.9.   Realms . . . . . . . . . . . . . . . . . . . . . . .  81
       6.3.10.  Round Trips  . . . . . . . . . . . . . . . . . . . .  81
     6.4.   Process  . . . . . . . . . . . . . . . . . . . . . . . .  82
       6.4.1.   Exchange of Stream Headers and Stream Features . . .  82
       6.4.2.   Initiation . . . . . . . . . . . . . . . . . . . . .  83
       6.4.3.   Challenge-Response Sequence  . . . . . . . . . . . .  84
       6.4.4.   Abort  . . . . . . . . . . . . . . . . . . . . . . .  84
       6.4.5.   SASL Failure . . . . . . . . . . . . . . . . . . . .  85
       6.4.6.   SASL Success . . . . . . . . . . . . . . . . . . . .  86
     6.5.   SASL Errors  . . . . . . . . . . . . . . . . . . . . . .  87
       6.5.1.   aborted  . . . . . . . . . . . . . . . . . . . . . .  88
       6.5.2.   account-disabled . . . . . . . . . . . . . . . . . .  88
       6.5.3.   credentials-expired  . . . . . . . . . . . . . . . .  88
       6.5.4.   encryption-required  . . . . . . . . . . . . . . . .  89
       6.5.5.   incorrect-encoding . . . . . . . . . . . . . . . . .  89
       6.5.6.   invalid-authzid  . . . . . . . . . . . . . . . . . .  89
       6.5.7.   invalid-mechanism  . . . . . . . . . . . . . . . . .  90
       6.5.8.   malformed-request  . . . . . . . . . . . . . . . . .  90
       6.5.9.   mechanism-too-weak . . . . . . . . . . . . . . . . .  90
       6.5.10.  not-authorized . . . . . . . . . . . . . . . . . . .  91
       6.5.11.  temporary-auth-failure . . . . . . . . . . . . . . .  91
     6.6.   SASL Definition  . . . . . . . . . . . . . . . . . . . .  91
   7.  Resource Binding  . . . . . . . . . . . . . . . . . . . . . .  92
        
     7.1.   Fundamentals . . . . . . . . . . . . . . . . . . . . . .  92
     7.2.   Support  . . . . . . . . . . . . . . . . . . . . . . . .  93
     7.3.   Stream Negotiation Rules . . . . . . . . . . . . . . . .  93
       7.3.1.   Mandatory-to-Negotiate . . . . . . . . . . . . . . .  93
       7.3.2.   Restart  . . . . . . . . . . . . . . . . . . . . . .  93
     7.4.   Advertising Support  . . . . . . . . . . . . . . . . . .  93
     7.5.   Generation of Resource Identifiers . . . . . . . . . . .  94
     7.6.   Server-Generated Resource Identifier . . . . . . . . . .  94
       7.6.1.   Success Case . . . . . . . . . . . . . . . . . . . .  94
       7.6.2.   Error Cases  . . . . . . . . . . . . . . . . . . . .  95
         7.6.2.1.  Resource Constraint . . . . . . . . . . . . . . .  95
         7.6.2.2.  Not Allowed . . . . . . . . . . . . . . . . . . .  96
     7.7.   Client-Submitted Resource Identifier . . . . . . . . . .  96
       7.7.1.   Success Case . . . . . . . . . . . . . . . . . . . .  96
       7.7.2.   Error Cases  . . . . . . . . . . . . . . . . . . . .  97
         7.7.2.1.  Bad Request . . . . . . . . . . . . . . . . . . .  97
         7.7.2.2.  Conflict  . . . . . . . . . . . . . . . . . . . .  97
       7.7.3.   Retries  . . . . . . . . . . . . . . . . . . . . . .  99
   8.  XML Stanzas . . . . . . . . . . . . . . . . . . . . . . . . .  99
     8.1.   Common Attributes  . . . . . . . . . . . . . . . . . . . 100
       8.1.1.   to . . . . . . . . . . . . . . . . . . . . . . . . . 100
         8.1.1.1.  Client-to-Server Streams  . . . . . . . . . . . . 100
         8.1.1.2.  Server-to-Server Streams  . . . . . . . . . . . . 101
       8.1.2.   from . . . . . . . . . . . . . . . . . . . . . . . . 101
         8.1.2.1.  Client-to-Server Streams  . . . . . . . . . . . . 101
         8.1.2.2.  Server-to-Server Streams  . . . . . . . . . . . . 102
       8.1.3.   id . . . . . . . . . . . . . . . . . . . . . . . . . 103
       8.1.4.   type . . . . . . . . . . . . . . . . . . . . . . . . 103
       8.1.5.   xml:lang . . . . . . . . . . . . . . . . . . . . . . 103
     8.2.   Basic Semantics  . . . . . . . . . . . . . . . . . . . . 105
       8.2.1.   Message Semantics  . . . . . . . . . . . . . . . . . 105
       8.2.2.   Presence Semantics . . . . . . . . . . . . . . . . . 105
       8.2.3.   IQ Semantics . . . . . . . . . . . . . . . . . . . . 105
     8.3.   Stanza Errors  . . . . . . . . . . . . . . . . . . . . . 107
       8.3.1.   Rules  . . . . . . . . . . . . . . . . . . . . . . . 108
       8.3.2.   Syntax . . . . . . . . . . . . . . . . . . . . . . . 109
       8.3.3.   Defined Conditions . . . . . . . . . . . . . . . . . 110
         8.3.3.1.  bad-request . . . . . . . . . . . . . . . . . . . 110
         8.3.3.2.  conflict  . . . . . . . . . . . . . . . . . . . . 111
         8.3.3.3.  feature-not-implemented . . . . . . . . . . . . . 111
         8.3.3.4.  forbidden . . . . . . . . . . . . . . . . . . . . 112
         8.3.3.5.  gone  . . . . . . . . . . . . . . . . . . . . . . 113
         8.3.3.6.  internal-server-error . . . . . . . . . . . . . . 113
         8.3.3.7.  item-not-found  . . . . . . . . . . . . . . . . . 114
         8.3.3.8.  jid-malformed . . . . . . . . . . . . . . . . . . 114
         8.3.3.9.  not-acceptable  . . . . . . . . . . . . . . . . . 115
         8.3.3.10. not-allowed . . . . . . . . . . . . . . . . . . . 116
         8.3.3.11. not-authorized  . . . . . . . . . . . . . . . . . 116
        
     7.1.   Fundamentals . . . . . . . . . . . . . . . . . . . . . .  92
     7.2.   Support  . . . . . . . . . . . . . . . . . . . . . . . .  93
     7.3.   Stream Negotiation Rules . . . . . . . . . . . . . . . .  93
       7.3.1.   Mandatory-to-Negotiate . . . . . . . . . . . . . . .  93
       7.3.2.   Restart  . . . . . . . . . . . . . . . . . . . . . .  93
     7.4.   Advertising Support  . . . . . . . . . . . . . . . . . .  93
     7.5.   Generation of Resource Identifiers . . . . . . . . . . .  94
     7.6.   Server-Generated Resource Identifier . . . . . . . . . .  94
       7.6.1.   Success Case . . . . . . . . . . . . . . . . . . . .  94
       7.6.2.   Error Cases  . . . . . . . . . . . . . . . . . . . .  95
         7.6.2.1.  Resource Constraint . . . . . . . . . . . . . . .  95
         7.6.2.2.  Not Allowed . . . . . . . . . . . . . . . . . . .  96
     7.7.   Client-Submitted Resource Identifier . . . . . . . . . .  96
       7.7.1.   Success Case . . . . . . . . . . . . . . . . . . . .  96
       7.7.2.   Error Cases  . . . . . . . . . . . . . . . . . . . .  97
         7.7.2.1.  Bad Request . . . . . . . . . . . . . . . . . . .  97
         7.7.2.2.  Conflict  . . . . . . . . . . . . . . . . . . . .  97
       7.7.3.   Retries  . . . . . . . . . . . . . . . . . . . . . .  99
   8.  XML Stanzas . . . . . . . . . . . . . . . . . . . . . . . . .  99
     8.1.   Common Attributes  . . . . . . . . . . . . . . . . . . . 100
       8.1.1.   to . . . . . . . . . . . . . . . . . . . . . . . . . 100
         8.1.1.1.  Client-to-Server Streams  . . . . . . . . . . . . 100
         8.1.1.2.  Server-to-Server Streams  . . . . . . . . . . . . 101
       8.1.2.   from . . . . . . . . . . . . . . . . . . . . . . . . 101
         8.1.2.1.  Client-to-Server Streams  . . . . . . . . . . . . 101
         8.1.2.2.  Server-to-Server Streams  . . . . . . . . . . . . 102
       8.1.3.   id . . . . . . . . . . . . . . . . . . . . . . . . . 103
       8.1.4.   type . . . . . . . . . . . . . . . . . . . . . . . . 103
       8.1.5.   xml:lang . . . . . . . . . . . . . . . . . . . . . . 103
     8.2.   Basic Semantics  . . . . . . . . . . . . . . . . . . . . 105
       8.2.1.   Message Semantics  . . . . . . . . . . . . . . . . . 105
       8.2.2.   Presence Semantics . . . . . . . . . . . . . . . . . 105
       8.2.3.   IQ Semantics . . . . . . . . . . . . . . . . . . . . 105
     8.3.   Stanza Errors  . . . . . . . . . . . . . . . . . . . . . 107
       8.3.1.   Rules  . . . . . . . . . . . . . . . . . . . . . . . 108
       8.3.2.   Syntax . . . . . . . . . . . . . . . . . . . . . . . 109
       8.3.3.   Defined Conditions . . . . . . . . . . . . . . . . . 110
         8.3.3.1.  bad-request . . . . . . . . . . . . . . . . . . . 110
         8.3.3.2.  conflict  . . . . . . . . . . . . . . . . . . . . 111
         8.3.3.3.  feature-not-implemented . . . . . . . . . . . . . 111
         8.3.3.4.  forbidden . . . . . . . . . . . . . . . . . . . . 112
         8.3.3.5.  gone  . . . . . . . . . . . . . . . . . . . . . . 113
         8.3.3.6.  internal-server-error . . . . . . . . . . . . . . 113
         8.3.3.7.  item-not-found  . . . . . . . . . . . . . . . . . 114
         8.3.3.8.  jid-malformed . . . . . . . . . . . . . . . . . . 114
         8.3.3.9.  not-acceptable  . . . . . . . . . . . . . . . . . 115
         8.3.3.10. not-allowed . . . . . . . . . . . . . . . . . . . 116
         8.3.3.11. not-authorized  . . . . . . . . . . . . . . . . . 116
        
         8.3.3.12. policy-violation  . . . . . . . . . . . . . . . . 117
         8.3.3.13. recipient-unavailable . . . . . . . . . . . . . . 117
         8.3.3.14. redirect  . . . . . . . . . . . . . . . . . . . . 118
         8.3.3.15. registration-required . . . . . . . . . . . . . . 119
         8.3.3.16. remote-server-not-found . . . . . . . . . . . . . 119
         8.3.3.17. remote-server-timeout . . . . . . . . . . . . . . 120
         8.3.3.18. resource-constraint . . . . . . . . . . . . . . . 121
         8.3.3.19. service-unavailable . . . . . . . . . . . . . . . 121
         8.3.3.20. subscription-required . . . . . . . . . . . . . . 122
         8.3.3.21. undefined-condition . . . . . . . . . . . . . . . 123
         8.3.3.22. unexpected-request  . . . . . . . . . . . . . . . 123
       8.3.4.   Application-Specific Conditions  . . . . . . . . . . 124
     8.4.   Extended Content . . . . . . . . . . . . . . . . . . . . 125
   9.  Detailed Examples . . . . . . . . . . . . . . . . . . . . . . 128
     9.1.   Client-to-Server Examples  . . . . . . . . . . . . . . . 128
       9.1.1.   TLS  . . . . . . . . . . . . . . . . . . . . . . . . 128
       9.1.2.   SASL . . . . . . . . . . . . . . . . . . . . . . . . 130
       9.1.3.   Resource Binding . . . . . . . . . . . . . . . . . . 132
       9.1.4.   Stanza Exchange  . . . . . . . . . . . . . . . . . . 133
       9.1.5.   Close  . . . . . . . . . . . . . . . . . . . . . . . 134
     9.2.   Server-to-Server Examples  . . . . . . . . . . . . . . . 134
       9.2.1.   TLS  . . . . . . . . . . . . . . . . . . . . . . . . 134
       9.2.2.   SASL . . . . . . . . . . . . . . . . . . . . . . . . 136
       9.2.3.   Stanza Exchange  . . . . . . . . . . . . . . . . . . 137
       9.2.4.   Close  . . . . . . . . . . . . . . . . . . . . . . . 137
   10. Server Rules for Processing XML Stanzas . . . . . . . . . . . 138
     10.1.  In-Order Processing  . . . . . . . . . . . . . . . . . . 138
     10.2.  General Considerations . . . . . . . . . . . . . . . . . 140
     10.3.  No 'to' Address  . . . . . . . . . . . . . . . . . . . . 141
       10.3.1.  Message  . . . . . . . . . . . . . . . . . . . . . . 141
       10.3.2.  Presence . . . . . . . . . . . . . . . . . . . . . . 141
       10.3.3.  IQ . . . . . . . . . . . . . . . . . . . . . . . . . 141
     10.4.  Remote Domain  . . . . . . . . . . . . . . . . . . . . . 142
       10.4.1.  Existing Stream  . . . . . . . . . . . . . . . . . . 142
       10.4.2.  No Existing Stream . . . . . . . . . . . . . . . . . 142
       10.4.3.  Error Handling . . . . . . . . . . . . . . . . . . . 143
     10.5.  Local Domain . . . . . . . . . . . . . . . . . . . . . . 143
       10.5.1.  domainpart . . . . . . . . . . . . . . . . . . . . . 143
       10.5.2.  domainpart/resourcepart  . . . . . . . . . . . . . . 143
       10.5.3.  localpart@domainpart . . . . . . . . . . . . . . . . 143
         10.5.3.1. No Such User  . . . . . . . . . . . . . . . . . . 144
         10.5.3.2. User Exists . . . . . . . . . . . . . . . . . . . 144
       10.5.4.  localpart@domainpart/resourcepart  . . . . . . . . . 144
   11. XML Usage . . . . . . . . . . . . . . . . . . . . . . . . . . 145
     11.1.  XML Restrictions . . . . . . . . . . . . . . . . . . . . 145
     11.2.  XML Namespace Names and Prefixes . . . . . . . . . . . . 146
     11.3.  Well-Formedness  . . . . . . . . . . . . . . . . . . . . 146
     11.4.  Validation . . . . . . . . . . . . . . . . . . . . . . . 147
        
         8.3.3.12. policy-violation  . . . . . . . . . . . . . . . . 117
         8.3.3.13. recipient-unavailable . . . . . . . . . . . . . . 117
         8.3.3.14. redirect  . . . . . . . . . . . . . . . . . . . . 118
         8.3.3.15. registration-required . . . . . . . . . . . . . . 119
         8.3.3.16. remote-server-not-found . . . . . . . . . . . . . 119
         8.3.3.17. remote-server-timeout . . . . . . . . . . . . . . 120
         8.3.3.18. resource-constraint . . . . . . . . . . . . . . . 121
         8.3.3.19. service-unavailable . . . . . . . . . . . . . . . 121
         8.3.3.20. subscription-required . . . . . . . . . . . . . . 122
         8.3.3.21. undefined-condition . . . . . . . . . . . . . . . 123
         8.3.3.22. unexpected-request  . . . . . . . . . . . . . . . 123
       8.3.4.   Application-Specific Conditions  . . . . . . . . . . 124
     8.4.   Extended Content . . . . . . . . . . . . . . . . . . . . 125
   9.  Detailed Examples . . . . . . . . . . . . . . . . . . . . . . 128
     9.1.   Client-to-Server Examples  . . . . . . . . . . . . . . . 128
       9.1.1.   TLS  . . . . . . . . . . . . . . . . . . . . . . . . 128
       9.1.2.   SASL . . . . . . . . . . . . . . . . . . . . . . . . 130
       9.1.3.   Resource Binding . . . . . . . . . . . . . . . . . . 132
       9.1.4.   Stanza Exchange  . . . . . . . . . . . . . . . . . . 133
       9.1.5.   Close  . . . . . . . . . . . . . . . . . . . . . . . 134
     9.2.   Server-to-Server Examples  . . . . . . . . . . . . . . . 134
       9.2.1.   TLS  . . . . . . . . . . . . . . . . . . . . . . . . 134
       9.2.2.   SASL . . . . . . . . . . . . . . . . . . . . . . . . 136
       9.2.3.   Stanza Exchange  . . . . . . . . . . . . . . . . . . 137
       9.2.4.   Close  . . . . . . . . . . . . . . . . . . . . . . . 137
   10. Server Rules for Processing XML Stanzas . . . . . . . . . . . 138
     10.1.  In-Order Processing  . . . . . . . . . . . . . . . . . . 138
     10.2.  General Considerations . . . . . . . . . . . . . . . . . 140
     10.3.  No 'to' Address  . . . . . . . . . . . . . . . . . . . . 141
       10.3.1.  Message  . . . . . . . . . . . . . . . . . . . . . . 141
       10.3.2.  Presence . . . . . . . . . . . . . . . . . . . . . . 141
       10.3.3.  IQ . . . . . . . . . . . . . . . . . . . . . . . . . 141
     10.4.  Remote Domain  . . . . . . . . . . . . . . . . . . . . . 142
       10.4.1.  Existing Stream  . . . . . . . . . . . . . . . . . . 142
       10.4.2.  No Existing Stream . . . . . . . . . . . . . . . . . 142
       10.4.3.  Error Handling . . . . . . . . . . . . . . . . . . . 143
     10.5.  Local Domain . . . . . . . . . . . . . . . . . . . . . . 143
       10.5.1.  domainpart . . . . . . . . . . . . . . . . . . . . . 143
       10.5.2.  domainpart/resourcepart  . . . . . . . . . . . . . . 143
       10.5.3.  localpart@domainpart . . . . . . . . . . . . . . . . 143
         10.5.3.1. No Such User  . . . . . . . . . . . . . . . . . . 144
         10.5.3.2. User Exists . . . . . . . . . . . . . . . . . . . 144
       10.5.4.  localpart@domainpart/resourcepart  . . . . . . . . . 144
   11. XML Usage . . . . . . . . . . . . . . . . . . . . . . . . . . 145
     11.1.  XML Restrictions . . . . . . . . . . . . . . . . . . . . 145
     11.2.  XML Namespace Names and Prefixes . . . . . . . . . . . . 146
     11.3.  Well-Formedness  . . . . . . . . . . . . . . . . . . . . 146
     11.4.  Validation . . . . . . . . . . . . . . . . . . . . . . . 147
        
     11.5.  Inclusion of XML Declaration . . . . . . . . . . . . . . 147
     11.6.  Character Encoding . . . . . . . . . . . . . . . . . . . 147
     11.7.  Whitespace . . . . . . . . . . . . . . . . . . . . . . . 148
     11.8.  XML Versions . . . . . . . . . . . . . . . . . . . . . . 148
   12. Internationalization Considerations . . . . . . . . . . . . . 148
   13. Security Considerations . . . . . . . . . . . . . . . . . . . 148
     13.1.  Fundamentals . . . . . . . . . . . . . . . . . . . . . . 148
     13.2.  Threat Model . . . . . . . . . . . . . . . . . . . . . . 149
     13.3.  Order of Layers  . . . . . . . . . . . . . . . . . . . . 150
     13.4.  Confidentiality and Integrity  . . . . . . . . . . . . . 150
     13.5.  Peer Entity Authentication . . . . . . . . . . . . . . . 151
     13.6.  Strong Security  . . . . . . . . . . . . . . . . . . . . 151
     13.7.  Certificates . . . . . . . . . . . . . . . . . . . . . . 152
       13.7.1.  Certificate Generation . . . . . . . . . . . . . . . 152
         13.7.1.1. General Considerations  . . . . . . . . . . . . . 152
         13.7.1.2. Server Certificates . . . . . . . . . . . . . . . 153
         13.7.1.3. Client Certificates . . . . . . . . . . . . . . . 156
         13.7.1.4. XmppAddr Identifier Type  . . . . . . . . . . . . 156
       13.7.2.  Certificate Validation . . . . . . . . . . . . . . . 157
         13.7.2.1. Server Certificates . . . . . . . . . . . . . . . 158
         13.7.2.2. Client Certificates . . . . . . . . . . . . . . . 158
         13.7.2.3. Checking of Certificates in Long-Lived Streams  . 160
         13.7.2.4. Use of Certificates in XMPP Extensions  . . . . . 160
     13.8.  Mandatory-to-Implement TLS and SASL Technologies . . . . 160
       13.8.1.  For Authentication Only  . . . . . . . . . . . . . . 161
       13.8.2.  For Confidentiality Only . . . . . . . . . . . . . . 161
       13.8.3.  For Confidentiality and Authentication with
                Passwords  . . . . . . . . . . . . . . . . . . . . . 162
       13.8.4.  For Confidentiality and Authentication without
                Passwords  . . . . . . . . . . . . . . . . . . . . . 163
     13.9.  Technology Reuse . . . . . . . . . . . . . . . . . . . . 163
       13.9.1.  Use of Base 64 in SASL . . . . . . . . . . . . . . . 163
       13.9.2.  Use of DNS . . . . . . . . . . . . . . . . . . . . . 163
       13.9.3.  Use of Hash Functions  . . . . . . . . . . . . . . . 164
       13.9.4.  Use of SASL  . . . . . . . . . . . . . . . . . . . . 164
       13.9.5.  Use of TLS . . . . . . . . . . . . . . . . . . . . . 165
       13.9.6.  Use of UTF-8 . . . . . . . . . . . . . . . . . . . . 165
       13.9.7.  Use of XML . . . . . . . . . . . . . . . . . . . . . 166
     13.10. Information Leaks  . . . . . . . . . . . . . . . . . . . 166
       13.10.1. IP Addresses . . . . . . . . . . . . . . . . . . . . 166
       13.10.2. Presence Information . . . . . . . . . . . . . . . . 166
     13.11. Directory Harvesting . . . . . . . . . . . . . . . . . . 166
     13.12. Denial of Service  . . . . . . . . . . . . . . . . . . . 167
     13.13. Firewalls  . . . . . . . . . . . . . . . . . . . . . . . 169
     13.14. Interdomain Federation . . . . . . . . . . . . . . . . . 169
     13.15. Non-Repudiation  . . . . . . . . . . . . . . . . . . . . 169
   14. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 170
     14.1.  XML Namespace Name for TLS Data  . . . . . . . . . . . . 170
        
     11.5.  Inclusion of XML Declaration . . . . . . . . . . . . . . 147
     11.6.  Character Encoding . . . . . . . . . . . . . . . . . . . 147
     11.7.  Whitespace . . . . . . . . . . . . . . . . . . . . . . . 148
     11.8.  XML Versions . . . . . . . . . . . . . . . . . . . . . . 148
   12. Internationalization Considerations . . . . . . . . . . . . . 148
   13. Security Considerations . . . . . . . . . . . . . . . . . . . 148
     13.1.  Fundamentals . . . . . . . . . . . . . . . . . . . . . . 148
     13.2.  Threat Model . . . . . . . . . . . . . . . . . . . . . . 149
     13.3.  Order of Layers  . . . . . . . . . . . . . . . . . . . . 150
     13.4.  Confidentiality and Integrity  . . . . . . . . . . . . . 150
     13.5.  Peer Entity Authentication . . . . . . . . . . . . . . . 151
     13.6.  Strong Security  . . . . . . . . . . . . . . . . . . . . 151
     13.7.  Certificates . . . . . . . . . . . . . . . . . . . . . . 152
       13.7.1.  Certificate Generation . . . . . . . . . . . . . . . 152
         13.7.1.1. General Considerations  . . . . . . . . . . . . . 152
         13.7.1.2. Server Certificates . . . . . . . . . . . . . . . 153
         13.7.1.3. Client Certificates . . . . . . . . . . . . . . . 156
         13.7.1.4. XmppAddr Identifier Type  . . . . . . . . . . . . 156
       13.7.2.  Certificate Validation . . . . . . . . . . . . . . . 157
         13.7.2.1. Server Certificates . . . . . . . . . . . . . . . 158
         13.7.2.2. Client Certificates . . . . . . . . . . . . . . . 158
         13.7.2.3. Checking of Certificates in Long-Lived Streams  . 160
         13.7.2.4. Use of Certificates in XMPP Extensions  . . . . . 160
     13.8.  Mandatory-to-Implement TLS and SASL Technologies . . . . 160
       13.8.1.  For Authentication Only  . . . . . . . . . . . . . . 161
       13.8.2.  For Confidentiality Only . . . . . . . . . . . . . . 161
       13.8.3.  For Confidentiality and Authentication with
                Passwords  . . . . . . . . . . . . . . . . . . . . . 162
       13.8.4.  For Confidentiality and Authentication without
                Passwords  . . . . . . . . . . . . . . . . . . . . . 163
     13.9.  Technology Reuse . . . . . . . . . . . . . . . . . . . . 163
       13.9.1.  Use of Base 64 in SASL . . . . . . . . . . . . . . . 163
       13.9.2.  Use of DNS . . . . . . . . . . . . . . . . . . . . . 163
       13.9.3.  Use of Hash Functions  . . . . . . . . . . . . . . . 164
       13.9.4.  Use of SASL  . . . . . . . . . . . . . . . . . . . . 164
       13.9.5.  Use of TLS . . . . . . . . . . . . . . . . . . . . . 165
       13.9.6.  Use of UTF-8 . . . . . . . . . . . . . . . . . . . . 165
       13.9.7.  Use of XML . . . . . . . . . . . . . . . . . . . . . 166
     13.10. Information Leaks  . . . . . . . . . . . . . . . . . . . 166
       13.10.1. IP Addresses . . . . . . . . . . . . . . . . . . . . 166
       13.10.2. Presence Information . . . . . . . . . . . . . . . . 166
     13.11. Directory Harvesting . . . . . . . . . . . . . . . . . . 166
     13.12. Denial of Service  . . . . . . . . . . . . . . . . . . . 167
     13.13. Firewalls  . . . . . . . . . . . . . . . . . . . . . . . 169
     13.14. Interdomain Federation . . . . . . . . . . . . . . . . . 169
     13.15. Non-Repudiation  . . . . . . . . . . . . . . . . . . . . 169
   14. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 170
     14.1.  XML Namespace Name for TLS Data  . . . . . . . . . . . . 170
        
     14.2.  XML Namespace Name for SASL Data . . . . . . . . . . . . 170
     14.3.  XML Namespace Name for Stream Errors . . . . . . . . . . 170
     14.4.  XML Namespace Name for Resource Binding  . . . . . . . . 171
     14.5.  XML Namespace Name for Stanza Errors . . . . . . . . . . 171
     14.6.  GSSAPI Service Name  . . . . . . . . . . . . . . . . . . 171
     14.7.  Port Numbers and Service Names . . . . . . . . . . . . . 171
   15. Conformance Requirements  . . . . . . . . . . . . . . . . . . 172
   16. References  . . . . . . . . . . . . . . . . . . . . . . . . . 181
     16.1.  Normative References . . . . . . . . . . . . . . . . . . 181
     16.2.  Informative References . . . . . . . . . . . . . . . . . 184
   Appendix A.  XML Schemas  . . . . . . . . . . . . . . . . . . . . 190
     A.1.   Stream Namespace . . . . . . . . . . . . . . . . . . . . 190
     A.2.   Stream Error Namespace . . . . . . . . . . . . . . . . . 192
     A.3.   STARTTLS Namespace . . . . . . . . . . . . . . . . . . . 193
     A.4.   SASL Namespace . . . . . . . . . . . . . . . . . . . . . 194
     A.5.   Client Namespace . . . . . . . . . . . . . . . . . . . . 196
     A.6.   Server Namespace . . . . . . . . . . . . . . . . . . . . 201
     A.7.   Resource Binding Namespace . . . . . . . . . . . . . . . 206
     A.8.   Stanza Error Namespace . . . . . . . . . . . . . . . . . 206
   Appendix B.  Contact Addresses  . . . . . . . . . . . . . . . . . 208
   Appendix C.  Account Provisioning . . . . . . . . . . . . . . . . 208
   Appendix D.  Differences from RFC 3920  . . . . . . . . . . . . . 208
   Appendix E.  Acknowledgements . . . . . . . . . . . . . . . . . . 210
        
     14.2.  XML Namespace Name for SASL Data . . . . . . . . . . . . 170
     14.3.  XML Namespace Name for Stream Errors . . . . . . . . . . 170
     14.4.  XML Namespace Name for Resource Binding  . . . . . . . . 171
     14.5.  XML Namespace Name for Stanza Errors . . . . . . . . . . 171
     14.6.  GSSAPI Service Name  . . . . . . . . . . . . . . . . . . 171
     14.7.  Port Numbers and Service Names . . . . . . . . . . . . . 171
   15. Conformance Requirements  . . . . . . . . . . . . . . . . . . 172
   16. References  . . . . . . . . . . . . . . . . . . . . . . . . . 181
     16.1.  Normative References . . . . . . . . . . . . . . . . . . 181
     16.2.  Informative References . . . . . . . . . . . . . . . . . 184
   Appendix A.  XML Schemas  . . . . . . . . . . . . . . . . . . . . 190
     A.1.   Stream Namespace . . . . . . . . . . . . . . . . . . . . 190
     A.2.   Stream Error Namespace . . . . . . . . . . . . . . . . . 192
     A.3.   STARTTLS Namespace . . . . . . . . . . . . . . . . . . . 193
     A.4.   SASL Namespace . . . . . . . . . . . . . . . . . . . . . 194
     A.5.   Client Namespace . . . . . . . . . . . . . . . . . . . . 196
     A.6.   Server Namespace . . . . . . . . . . . . . . . . . . . . 201
     A.7.   Resource Binding Namespace . . . . . . . . . . . . . . . 206
     A.8.   Stanza Error Namespace . . . . . . . . . . . . . . . . . 206
   Appendix B.  Contact Addresses  . . . . . . . . . . . . . . . . . 208
   Appendix C.  Account Provisioning . . . . . . . . . . . . . . . . 208
   Appendix D.  Differences from RFC 3920  . . . . . . . . . . . . . 208
   Appendix E.  Acknowledgements . . . . . . . . . . . . . . . . . . 210
        
1. Introduction
1. 介绍
1.1. Overview
1.1. 概述

The Extensible Messaging and Presence Protocol (XMPP) is an application profile of the Extensible Markup Language [XML] that enables the near-real-time exchange of structured yet extensible data between any two or more network entities. This document defines XMPP's core protocol methods: setup and teardown of XML streams, channel encryption, authentication, error handling, and communication primitives for messaging, network availability ("presence"), and request-response interactions.

可扩展消息和状态协议(XMPP)是可扩展标记语言[XML]的应用程序配置文件,它支持在任意两个或多个网络实体之间近实时地交换结构化但可扩展的数据。本文档定义了XMPP的核心协议方法:XML流的设置和拆卸、通道加密、身份验证、错误处理以及用于消息传递、网络可用性(“存在”)和请求-响应交互的通信原语。

1.2. History
1.2. 历史

The basic syntax and semantics of XMPP were developed originally within the Jabber open-source community, mainly in 1999. In late 2002, the XMPP Working Group was chartered with developing an adaptation of the base Jabber protocol that would be suitable as an IETF instant messaging (IM) and presence technology in accordance with [IMP-REQS]. In October 2004, [RFC3920] and [RFC3921] were published, representing the most complete definition of XMPP at that time.

XMPP的基本语法和语义最初是在Jabber开源社区内开发的,主要是在1999年。2002年末,XMPP工作组获得特许,负责根据[IMP-REQS]开发适用于IETF即时消息(IM)和存在技术的基本Jabber协议的改编。2004年10月,发布了[RFC3920]和[RFC3921],代表了当时最完整的XMPP定义。

Since 2004 the Internet community has gained extensive implementation and deployment experience with XMPP, including formal interoperability testing carried out under the auspices of the XMPP Standards Foundation (XSF). This document incorporates comprehensive feedback from software developers and XMPP service providers, including a number of backward-compatible modifications summarized under Appendix D. As a result, this document reflects the rough consensus of the Internet community regarding the core features of XMPP 1.0, thus obsoleting RFC 3920.

自2004以来,互联网社区已经获得了广泛的XMPP实现和部署经验,包括在XMPP标准基金会(XSF)主持下进行的正式互操作性测试。本文件综合了软件开发人员和XMPP服务提供商的综合反馈,包括附录D中总结的一些向后兼容的修改。因此,本文件反映了互联网社区对XMPP 1.0核心功能的大致共识,从而淘汰了RFC 3920。

1.3. Functional Summary
1.3. 功能摘要

This non-normative section provides a developer-friendly, functional summary of XMPP; refer to the sections that follow for a normative definition of XMPP.

本非规范性部分提供了一个开发人员友好的XMPP功能摘要;有关XMPP的规范性定义,请参阅以下章节。

The purpose of XMPP is to enable the exchange of relatively small pieces of structured data (called "XML stanzas") over a network between any two (or more) entities. XMPP is typically implemented using a distributed client-server architecture, wherein a client needs to connect to a server in order to gain access to the network and thus be allowed to exchange XML stanzas with other entities (which can be associated with other servers). The process whereby a client connects to a server, exchanges XML stanzas, and ends the connection is:

XMPP的目的是通过网络在任意两个(或多个)实体之间交换相对较小的结构化数据(称为“XML节”)。XMPP通常使用分布式客户机-服务器体系结构实现,其中客户机需要连接到服务器以获得对网络的访问,从而允许与其他实体(可以与其他服务器关联)交换XML节。客户端连接到服务器、交换XML节并结束连接的过程是:

1. Determine the IP address and port at which to connect, typically based on resolution of a fully qualified domain name (Section 3.2)

1. 确定要连接的IP地址和端口,通常基于完全限定域名的解析(第3.2节)

2. Open a Transmission Control Protocol [TCP] connection

2. 打开传输控制协议[TCP]连接

3. Open an XML stream over TCP (Section 4.2)

3. 通过TCP打开XML流(第4.2节)

4. Preferably negotiate Transport Layer Security [TLS] for channel encryption (Section 5)

4. 最好协商信道加密的传输层安全[TLS](第5节)

5. Authenticate using a Simple Authentication and Security Layer [SASL] mechanism (Section 6)

5. 使用简单的身份验证和安全层[SASL]机制进行身份验证(第6节)

6. Bind a resource to the stream (Section 7)

6. 将资源绑定到流(第7节)

7. Exchange an unbounded number of XML stanzas with other entities on the network (Section 8)

7. 与网络上的其他实体交换无限数量的XML节(第8节)

8. Close the XML stream (Section 4.4)

8. 关闭XML流(第4.4节)

9. Close the TCP connection

9. 关闭TCP连接

Within XMPP, one server can optionally connect to another server to enable inter-domain or inter-server communication. For this to happen, the two servers need to negotiate a connection between themselves and then exchange XML stanzas; the process for doing so is:

在XMPP中,一台服务器可以选择性地连接到另一台服务器以启用域间或服务器间通信。为了实现这一点,两个服务器需要协商它们之间的连接,然后交换XML节;这样做的过程是:

1. Determine the IP address and port at which to connect, typically based on resolution of a fully qualified domain name (Section 3.2)

1. 确定要连接的IP地址和端口,通常基于完全限定域名的解析(第3.2节)

2. Open a TCP connection

2. 打开TCP连接

3. Open an XML stream (Section 4.2)

3. 打开XML流(第4.2节)

4. Preferably negotiate TLS for channel encryption (Section 5)

4. 最好协商信道加密的TLS(第5节)

5. Authenticate using a Simple Authentication and Security Layer [SASL] mechanism (Section 6) *

5. 使用简单的身份验证和安全层[SASL]机制进行身份验证(第6节)*

6. Exchange an unbounded number of XML stanzas both directly for the servers and indirectly on behalf of entities associated with each server, such as connected clients (Section 8)

6. 直接为服务器和间接代表与每个服务器关联的实体(如连接的客户端)交换无限数量的XML节(第8节)

7. Close the XML stream (Section 4.4)

7. 关闭XML流(第4.4节)

8. Close the TCP connection

8. 关闭TCP连接

* Interoperability Note: At the time of writing, most deployed servers still use the Server Dialback protocol [XEP-0220] to provide weak identity verification instead of using SASL with PKIX certificates to provide strong authentication, especially in cases where SASL negotiation would not result in strong authentication anyway (e.g., because TLS negotiation was not mandated by the peer server, or because the PKIX certificate presented by the peer server during TLS negotiation is self-signed and has not been previously accepted); for details, see [XEP-0220]. The solutions specified in this document offer a significantly stronger level of security (see also Section 13.6).

* 互操作性说明:在撰写本文时,大多数部署的服务器仍然使用服务器回拨协议[XEP-0220]来提供弱身份验证,而不是使用带有PKIX证书的SASL来提供强身份验证,特别是在SASL协商无论如何都不会导致强身份验证的情况下(例如,因为TLS协商不是由对等服务器强制执行的,或者因为对等服务器在TLS协商期间提供的PKIX证书是自签名的,并且以前未被接受);有关详细信息,请参阅[XEP-0220]。本文档中指定的解决方案提供了更高级别的安全性(另请参阅第13.6节)。

This document specifies how clients connect to servers and specifies the basic semantics of XML stanzas. However, this document does not define the "payloads" of the XML stanzas that might be exchanged once a connection is successfully established; instead, those payloads are defined by various XMPP extensions. For example, [XMPP-IM] defines extensions for basic instant messaging and presence functionality. In addition, various specifications produced in the XSF's XEP series [XEP-0001] define extensions for a wide range of applications.

本文档指定客户端如何连接到服务器,并指定XML节的基本语义。但是,本文档没有定义一旦成功建立连接就可以交换的XML节的“有效负载”;相反,这些有效负载由各种XMPP扩展定义。例如,[XMPP-IM]定义了基本即时消息和状态功能的扩展。此外,XSF的XEP系列[XEP-0001]中产生的各种规范定义了广泛应用的扩展。

1.4. Terminology
1.4. 术语

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [KEYWORDS].

本文件中的关键词“必须”、“不得”、“必需”、“应”、“不得”、“应”、“不应”、“建议”、“不建议”、“可”和“可选”应按照RFC 2119[关键词]中的描述进行解释。

Certain security-related terms are to be understood in the sense defined in [SEC-TERMS]; such terms include, but are not limited to, "assurance", "attack", "authentication", "authorization", "certificate", "certification authority", "certification path", "confidentiality", "credential", "downgrade", "encryption", "hash value", "identity", "integrity", "signature", "self-signed certificate", "sign", "spoof", "tamper", "trust", "trust anchor", "validate", and "verify".

某些与安全相关的术语应理解为[证券交易委员会术语]中定义的含义;这些术语包括但不限于“保证”、“攻击”、“身份验证”、“授权”、“证书”、“证书颁发机构”、“证书路径”、“机密性”、“凭证”、“降级”、“加密”、“哈希值”、“身份”、“完整性”、“签名”、“自签名证书”、“签名”、“欺骗”、“篡改”、“信任”,“信任锚”、“验证”和“验证”。

Certain terms related to certificates, domains, and application service identity are to be understood in the sense defined in [TLS-CERTS]; these include, but are not limited to, "PKIX certificate", "source domain", "derived domain", and the identifier types "CN-ID", "DNS-ID", and "SRV-ID".

与证书、域和应用程序服务标识相关的某些术语应理解为[TLS-CERTS]中定义的含义;这些包括但不限于“PKIX证书”、“源域”、“派生域”和标识符类型“CN-ID”、“DNS-ID”和“SRV-ID”。

Other security-related terms are to be understood in the sense defined in the referenced specifications (for example, "denial of service" as described in [DOS] or "end entity certificate" as described in [PKIX]).

其他安全相关术语应理解为参考规范中定义的含义(例如,[DOS]中所述的“拒绝服务”或[PKIX]中所述的“最终实体证书”)。

The term "whitespace" is used to refer to any character or characters matching the "S" production from [XML], i.e., one or more instances of the SP, HTAB, CR, or LF rules defined in [ABNF].

术语“空白”用于指与[XML]中的“S”结果相匹配的任何字符,即[ABNF]中定义的SP、HTAB、CR或LF规则的一个或多个实例。

The terms "localpart", "domainpart", and "resourcepart" are defined in [XMPP-ADDR].

术语“localpart”、“domainpart”和“resourcepart”在[XMPP-ADDR]中定义。

The term "bare JID" refers to an XMPP address of the form <localpart@domainpart> (for an account at a server) or of the form <domainpart> (for a server).

术语“裸JID”是指表单的XMPP地址<localpart@domainpart>(对于服务器上的帐户)或<domainpart>形式(对于服务器)。

The term "full JID" refers to an XMPP address of the form <localpart@domainpart/resourcepart> (for a particular authorized client or device associated with an account) or of the form <domainpart/resourcepart> (for a particular resource or script associated with a server).

术语“完整JID”是指表单的XMPP地址<localpart@domainpart/resourcepart>(用于与帐户关联的特定授权客户端或设备)或<domainpart/resourcepart>格式(用于与服务器关联的特定资源或脚本)。

The term "XML stream" (also "stream") is defined under Section 4.1.

术语“XML流”(也称为“流”)在第4.1节中定义。

The term "XML stanza" (also "stanza") is defined under Section 4.1. There are three kinds of stanzas: message, presence, and IQ (short for "Info/Query"). These communication primitives are defined under Sections 8.2.1, 8.2.2, and 8.2.3, respectively.

术语“XML节”(也称为“节”)在第4.1节中定义。有三种小节:消息、状态和IQ(信息/查询的缩写)。这些通信原语分别在第8.2.1、8.2.2和8.2.3节中定义。

The term "originating entity" refers to the entity that first generates a stanza that is sent over an XMPP network (e.g., a connected client, an add-on service, or a server). The term "generated stanza" refers to the stanza so generated.

术语“原始实体”是指首先生成通过XMPP网络(例如,连接的客户端、附加服务或服务器)发送的节的实体。术语“生成的节”指这样生成的节。

The term "input stream" designates an XML stream over which a server receives data from a connected client or remote server, and the term "output stream" designates an XML stream over which a server sends data to a connected client or remote server. The following terms designate some of the actions that a server can perform when processing data received over an input stream:

术语“输入流”指定服务器通过其从连接的客户端或远程服务器接收数据的XML流,术语“输出流”指定服务器通过其向连接的客户端或远程服务器发送数据的XML流。以下术语指定了服务器在处理通过输入流接收的数据时可以执行的一些操作:

route: pass the data to a remote server for direct processing by the remote server or eventual delivery to a client associated with the remote server

路由:将数据传递到远程服务器,由远程服务器直接处理,或最终传递到与远程服务器关联的客户端

deliver: pass the data to a connected client

传递:将数据传递到连接的客户端

ignore: discard the data without acting upon it or returning an error to the sender

忽略:放弃数据而不对其进行操作或向发送方返回错误

When the term "ignore" is used with regard to client processing of data it receives, the phrase "without acting upon it" explicitly includes not presenting the data to a human user.

当术语“忽略”用于客户端对其接收的数据的处理时,短语“不对其采取行动”明确包括不向人类用户呈现数据。

   Following the "XML Notation" used in [IRI] to represent characters
   that cannot be rendered in ASCII-only documents, some examples in
   this document use the form "&#x...." as a notational device to
   represent [UNICODE] characters (e.g., the string "&#x0159;" stands
   for the Unicode character LATIN SMALL LETTER R WITH CARON); this form
   is definitely not to be sent over the wire in XMPP systems.
        
   Following the "XML Notation" used in [IRI] to represent characters
   that cannot be rendered in ASCII-only documents, some examples in
   this document use the form "&#x...." as a notational device to
   represent [UNICODE] characters (e.g., the string "&#x0159;" stands
   for the Unicode character LATIN SMALL LETTER R WITH CARON); this form
   is definitely not to be sent over the wire in XMPP systems.
        

Consistent with the convention used in [URI] to represent Uniform Resource Identifiers, XMPP addresses in running text are enclosed between '<' and '>' (although natively they are not URIs).

与[URI]中用于表示统一资源标识符的约定一致,运行文本中的XMPP地址包含在“<”和“>”之间(尽管它们本机不是URI)。

In examples, lines have been wrapped for improved readability, "[...]" means elision, and the following prepended strings are used (these prepended strings are not to be sent over the wire):

在示例中,为了提高可读性,对行进行了包装,“[…]”表示省略,并使用了以下带前缀的字符串(这些带前缀的字符串不通过导线发送):

o C: = a client

o C:=客户机

o E: = any XMPP entity

o E:=任何XMPP实体

o I: = an initiating entity

o I:=发起实体

o P: = a peer server

o P:=对等服务器

o R: = a receiving entity

o R:=接收实体

o S: = a server

o S:=服务器

o S1: = server1

o S1:=服务器1

o S2: = server2

o S2:=服务器2

Readers need to be aware that the examples are not exhaustive and that, in examples for some protocol flows, the alternate steps shown would not necessarily be triggered by the exact data sent in the previous step; in all cases the protocol definitions specified in this document or in normatively referenced documents rule over any examples provided here. All examples are fictional and the information exchanged (e.g., usernames and passwords) does not represent any existing users or servers.

读者需要意识到,示例并非详尽无遗,并且在一些协议流的示例中,所示的备选步骤不一定由在前一步骤中发送的确切数据触发;在所有情况下,本文件或规范性参考文件中规定的协议定义均优于此处提供的任何示例。所有示例都是虚构的,所交换的信息(例如用户名和密码)并不代表任何现有用户或服务器。

2. Architecture
2. 建筑学

XMPP provides a technology for the asynchronous, end-to-end exchange of structured data by means of direct, persistent XML streams among a distributed network of globally addressable, presence-aware clients and servers. Because this architectural style involves ubiquitous knowledge of network availability and a conceptually unlimited number of concurrent information transactions in the context of a given client-to-server or server-to-server session, we label it "Availability for Concurrent Transactions" (ACT) to distinguish it from the "Representational State Transfer" [REST] architectural style familiar from the World Wide Web. Although the architecture of XMPP is similar in important ways to that of email (see [EMAIL-ARCH]), it introduces several modifications to facilitate communication in close to real time. The salient features of this ACTive architectural style are as follows.

XMPP提供了一种技术,通过在一个由全局可寻址、感知状态的客户机和服务器组成的分布式网络中直接、持久的XML流,实现结构化数据的异步、端到端交换。由于这种体系结构风格涉及到网络可用性的无所不在的知识,以及在给定的客户机到服务器或服务器到服务器会话的上下文中,概念上无限数量的并发信息事务,因此我们将其标记为“并发事务可用性”(ACT),以区别于“代表性状态转移”[REST]是万维网中常见的架构风格。尽管XMPP的架构在重要方面与电子邮件的架构类似(请参见[email-ARCH]),它引入了一些修改,以便于接近实时的通信。

2.1. Global Addresses
2.1. 全球地址
   As with email, XMPP uses globally unique addresses (based on the
   Domain Name System) in order to route and deliver messages over the
   network.  All XMPP entities are addressable on the network, most
   particularly clients and servers but also various additional services
   that can be accessed by clients and servers.  In general, server
   addresses are of the form <domainpart> (e.g., <im.example.com>),
   accounts hosted at a server are of the form <localpart@domainpart>
   (e.g., <juliet@im.example.com>, called a "bare JID"), and a
        
   As with email, XMPP uses globally unique addresses (based on the
   Domain Name System) in order to route and deliver messages over the
   network.  All XMPP entities are addressable on the network, most
   particularly clients and servers but also various additional services
   that can be accessed by clients and servers.  In general, server
   addresses are of the form <domainpart> (e.g., <im.example.com>),
   accounts hosted at a server are of the form <localpart@domainpart>
   (e.g., <juliet@im.example.com>, called a "bare JID"), and a
        

particular connected device or resource that is currently authorized for interaction on behalf of an account is of the form <localpart@domainpart/resourcepart> (e.g., <juliet@im.example.com/balcony>, called a "full JID"). For historical reasons, XMPP addresses are often called Jabber IDs or JIDs. Because the formal specification of the XMPP address format depends on internationalization technologies that are in flux at the time of writing, the format is defined in [XMPP-ADDR] instead of this document. The terms "localpart", "domainpart", and "resourcepart" are defined more formally in [XMPP-ADDR].

当前授权代表帐户进行交互的特定连接设备或资源的形式为<localpart@domainpart/资源部分>(例如<juliet@im.example.com/阳台>,称为“完整JID”)。由于历史原因,XMPP地址通常称为Jabber ID或JID。由于XMPP地址格式的正式规范取决于编写本文时不断变化的国际化技术,因此该格式在[XMPP-ADDR]中定义,而不是在本文档中定义。术语“localpart”、“domainpart”和“resourcepart”在[XMPP-ADDR]中有更正式的定义。

2.2. Presence
2.2. 在场

XMPP includes the ability for an entity to advertise its network availability or "presence" to other entities. In XMPP, this availability for communication is signaled end-to-end by means of a dedicated communication primitive: the <presence/> stanza. Although knowledge of network availability is not strictly necessary for the exchange of XMPP messages, it facilitates real-time interaction because the originator of a message can know before initiating communication that the intended recipient is online and available. End-to-end presence is defined in [XMPP-IM].

XMPP包括实体向其他实体公布其网络可用性或“存在”的能力。在XMPP中,这种通信可用性通过专用通信原语(即<presence/>节)端到端地发出信号。尽管网络可用性的知识对于XMPP消息的交换不是严格必要的,但它有助于实时交互,因为消息的发起者可以在开始通信之前知道预期的接收者是在线且可用的。端到端存在在[XMPP-IM]中定义。

2.3. Persistent Streams
2.3. 持续流

Availability for communication is also built into each point-to-point "hop" through the use of persistent XML streams over long-lived TCP connections. These "always-on" client-to-server and server-to-server streams enable each party to push data to the other party at any time for immediate routing or delivery. XML streams are defined under Section 4.

通过在长期TCP连接上使用持久性XML流,通信可用性也内置于每个点对点“跃点”中。这些“始终开启”的客户机到服务器和服务器到服务器流使各方能够在任何时候将数据推送到另一方,以便立即路由或传递。XML流在第4节中定义。

2.4. Structured Data
2.4. 结构化数据

The basic protocol data unit in XMPP is not an XML stream (which simply provides the transport for point-to-point communication) but an XML "stanza", which is essentially a fragment of XML that is sent over a stream. The root element of a stanza includes routing attributes (such as "from" and "to" addresses), and the child elements of the stanza contain a payload for delivery to the intended recipient. XML stanzas are defined under Section 8.

XMPP中的基本协议数据单元不是XML流(它只是为点到点通信提供传输),而是XML“节”,它本质上是通过流发送的XML片段。节的根元素包括路由属性(例如“from”和“to”地址),节的子元素包含传递给预期收件人的有效负载。XML节在第8节中定义。

2.5. Distributed Network of Clients and Servers
2.5. 客户机和服务器的分布式网络

In practice, XMPP consists of a network of clients and servers that inter-communicate (however, communication between any two given deployed servers is strictly discretionary and a matter of local service policy). Thus, for example, the user <juliet@im.example.com>

实际上,XMPP由相互通信的客户端和服务器网络组成(但是,任何两个给定部署的服务器之间的通信都是严格自主的,并且是本地服务策略的问题)。因此,例如,用户<juliet@im.example.com>

associated with the server <im.example.com> might be able to exchange messages, presence, and other structured data with the user <romeo@example.net> associated with the server <example.net>. This pattern is familiar from messaging protocols that make use of global addresses, such as the email network (see [SMTP] and [EMAIL-ARCH]). As a result, end-to-end communication in XMPP is logically peer-to-peer but physically client-to-server-to-server-to-client, as illustrated in the following diagram.

与服务器关联的<im.example.com>可能能够与用户交换消息、状态和其他结构化数据<romeo@example.net>与服务器<example.net>关联。这种模式在使用全局地址的消息传递协议中很常见,例如电子邮件网络(请参见[SMTP]和[email-ARCH])。因此,XMPP中的端到端通信在逻辑上是对等的,但在物理上是客户端到服务器到服务器到客户端的,如下图所示。

     example.net <--------------> im.example.com
        ^                                ^
        |                                |
        v                                v
   romeo@example.net           juliet@im.example.com
        
     example.net <--------------> im.example.com
        ^                                ^
        |                                |
        v                                v
   romeo@example.net           juliet@im.example.com
        

Figure 1: Distributed Client-Server Architecture

图1:分布式客户机-服务器体系结构

Informational Note: Architectures that employ XML streams (Section 4) and XML stanzas (Section 8) but that establish peer-to-peer connections directly between clients using technologies based on [LINKLOCAL] have been deployed, but such architectures are not defined in this specification and are best described as "XMPP-like"; for details, see [XEP-0174]. In addition, XML streams can be established end-to-end over any reliable transport, including extensions to XMPP itself; however, such methods are out of scope for this specification.

信息性说明:已经部署了使用XML流(第4节)和XML节(第8节)但使用基于[LINKLOCAL]的技术在客户端之间直接建立对等连接的体系结构,但此类体系结构未在本规范中定义,最好描述为“类似XMPP”;有关详细信息,请参见[XEP-0174]。此外,XML流可以通过任何可靠的传输建立端到端,包括对XMPP本身的扩展;但是,此类方法不在本规范的范围内。

The following paragraphs describe the responsibilities of clients and servers on the network.

以下段落描述了网络上客户端和服务器的职责。

A client is an entity that establishes an XML stream with a server by authenticating using the credentials of a registered account (via SASL negotiation (Section 6)) and that then completes resource binding (Section 7) in order to enable delivery of XML stanzas between the server and the client over the negotiated stream. The client then uses XMPP to communicate with its server, other clients, and any other entities on the network, where the server is responsible for delivering stanzas to other connected clients at the same server or routing them to remote servers. Multiple clients can connect simultaneously to a server on behalf of the same registered account, where each client is differentiated by the resourcepart of an XMPP address (e.g., <juliet@im.example.com/balcony> vs. <juliet@im.example.com/chamber>), as defined under [XMPP-ADDR] and Section 7.

客户机是一个实体,它通过使用注册帐户的凭据进行身份验证(通过SASL协商(第6节))与服务器建立XML流,然后完成资源绑定(第7节),以便能够通过协商流在服务器和客户机之间传递XML节。然后,客户机使用XMPP与其服务器、其他客户机以及网络上的任何其他实体通信,其中服务器负责将节传递给同一服务器上的其他连接客户机或将它们路由到远程服务器。多个客户端可以代表同一注册帐户同时连接到服务器,其中每个客户端通过XMPP地址的resourcepart进行区分(例如<juliet@im.example.com/阳台>与<juliet@im.example.com/[XMPP-ADDR]和第7节中定义的。

A server is an entity whose primary responsibilities are to:

服务器是一个实体,其主要职责是:

o Manage XML streams (Section 4) with connected clients and deliver XML stanzas (Section 8) to those clients over the negotiated streams; this includes responsibility for ensuring that a client authenticates with the server before being granted access to the XMPP network.

o 使用连接的客户端管理XML流(第4节),并通过协商的流向这些客户端交付XML节(第8节);这包括确保客户机在被授予访问XMPP网络的权限之前与服务器进行身份验证的责任。

o Subject to local service policies on server-to-server communication, manage XML streams (Section 4) with remote servers and route XML stanzas (Section 8) to those servers over the negotiated streams.

o 根据服务器到服务器通信的本地服务策略,使用远程服务器管理XML流(第4节),并通过协商的流将XML节(第8节)路由到这些服务器。

Depending on the application, the secondary responsibilities of an XMPP server can include:

根据应用程序的不同,XMPP服务器的次要职责可以包括:

o Storing data that is used by clients (e.g., contact lists for users of XMPP-based instant messaging and presence applications as defined in [XMPP-IM]); in this case, the relevant XML stanza is handled directly by the server itself on behalf of the client and is not routed to a remote server or delivered to a connected client.

o 存储客户端使用的数据(例如,[XMPP-IM]中定义的基于XMPP的即时消息和状态应用程序用户的联系人列表);在这种情况下,相关的XML节由服务器本身代表客户机直接处理,而不是路由到远程服务器或传递到连接的客户机。

o Hosting add-on services that also use XMPP as the basis for communication but that provide additional functionality beyond that defined in this document or in [XMPP-IM]; examples include multi-user conferencing services as specified in [XEP-0045] and publish-subscribe services as specified in [XEP-0060].

o 托管附加服务,该附加服务也使用XMPP作为通信的基础,但提供本文档或[XMPP-IM]中定义之外的附加功能;示例包括[XEP-0045]中规定的多用户会议服务和[XEP-0060]中规定的发布-订阅服务。

3. TCP Binding
3. TCP绑定
3.1. Scope
3.1. 范围

As XMPP is defined in this specification, an initiating entity (client or server) MUST open a Transmission Control Protocol [TCP] connection to the receiving entity (server) before it negotiates XML streams with the receiving entity. The parties then maintain that TCP connection for as long as the XML streams are in use. The rules specified in the following sections apply to the TCP binding.

由于本规范中定义了XMPP,发起实体(客户端或服务器)必须在与接收实体协商XML流之前打开与接收实体(服务器)的传输控制协议[TCP]连接。然后,只要XML流在使用中,双方就会保持TCP连接。以下各节中指定的规则适用于TCP绑定。

Informational Note: There is no necessary coupling of XML streams to TCP, and other transports are possible. For example, two entities could connect to each other by means of [HTTP] as specified in [XEP-0124] and [XEP-0206]. However, this specification defines only a binding of XMPP to TCP.

信息性说明:没有必要将XML流耦合到TCP,也可以进行其他传输。例如,两个实体可以通过[XEP-0124]和[XEP-0206]中规定的[HTTP]相互连接。但是,此规范仅定义XMPP到TCP的绑定。

3.2. Resolution of Fully Qualified Domain Names
3.2. 完全限定域名的解析

Because XML streams are sent over TCP, the initiating entity needs to determine the IPv4 or IPv6 address (and port) of the receiving entity before it can attempt to open an XML stream. Typically this is done by resolving the receiving entity's fully qualified domain name or FQDN (see [DNS-CONCEPTS]).

由于XML流是通过TCP发送的,发起实体需要确定接收实体的IPv4或IPv6地址(和端口),然后才能尝试打开XML流。通常,这是通过解析接收实体的完全限定域名或FQDN(请参见[DNS-CONCEPTS])来完成的。

3.2.1. Preferred Process: SRV Lookup
3.2.1. 首选流程:SRV查找

The preferred process for FQDN resolution is to use [DNS-SRV] records as follows:

FQDN解析的首选过程是使用[DNS-SRV]记录,如下所示:

1. The initiating entity constructs a DNS SRV query whose inputs are:

1. 发起实体构造一个DNS SRV查询,其输入为:

* a Service of "xmpp-client" (for client-to-server connections) or "xmpp-server" (for server-to-server connections)

* “xmpp客户端”(用于客户端到服务器连接)或“xmpp服务器”(用于服务器到服务器连接)的服务

* a Proto of "tcp"

* “tcp”的原型

* a Name corresponding to the "origin domain" [TLS-CERTS] of the XMPP service to which the initiating entity wishes to connect (e.g., "example.net" or "im.example.com")

* 与发起实体希望连接的XMPP服务的“源域”[TLS-CERTS]相对应的名称(例如,“example.net”或“im.example.com”)

2. The result is a query such as "_xmpp-client._tcp.example.net." or "_xmpp-server._tcp.im.example.com.".

2. 结果是一个查询,如“\u xmpp-client.\u tcp.example.net.”或“\u xmpp-server.\u tcp.im.example.com.”。

3. If a response is received, it will contain one or more combinations of a port and FDQN, each of which is weighted and prioritized as described in [DNS-SRV]. (However, if the result of the SRV lookup is a single resource record with a Target of ".", i.e., the root domain, then the initiating entity MUST abort SRV processing at this point because according to [DNS-SRV] such a Target "means that the service is decidedly not available at this domain".)

3. 如果收到响应,它将包含端口和FDQN的一个或多个组合,每个组合都按照[DNS-SRV]中的描述进行加权和优先级排序。(但是,如果SRV查找的结果是目标为“.”的单个资源记录,即根域,则发起实体必须在此时中止SRV处理,因为根据[DNS-SRV],这样的目标“意味着服务在该域上肯定不可用”。)

4. The initiating entity chooses at least one of the returned FQDNs to resolve (following the rules in [DNS-SRV]), which it does by performing DNS "A" or "AAAA" lookups on the FDQN; this will result in an IPv4 or IPv6 address.

4. 发起实体通过在FDQN上执行DNS“A”或“AAAA”查找,选择至少一个返回的FQDN进行解析(遵循[DNS-SRV]中的规则);这将产生IPv4或IPv6地址。

5. The initiating entity uses the IP address(es) from the successfully resolved FDQN (with the corresponding port number returned by the SRV lookup) as the connection address for the receiving entity.

5. 发起实体使用成功解析的FDQN中的IP地址(SRV查找返回相应的端口号)作为接收实体的连接地址。

6. If the initiating entity fails to connect using that IP address but the "A" or "AAAA" lookups returned more than one IP address, then the initiating entity uses the next resolved IP address for that FDQN as the connection address.

6. 如果发起实体无法使用该IP地址进行连接,但“A”或“AAAA”查找返回了多个IP地址,则发起实体将该FDQN的下一个解析IP地址用作连接地址。

7. If the initiating entity fails to connect using all resolved IP addresses for a given FDQN, then it repeats the process of resolution and connection for the next FQDN returned by the SRV lookup based on the priority and weight as defined in [DNS-SRV].

7. 如果发起实体无法使用给定FDQN的所有解析IP地址进行连接,则它将根据[DNS-SRV]中定义的优先级和权重,对SRV查找返回的下一个FQDN重复解析和连接过程。

8. If the initiating entity receives a response to its SRV query but it is not able to establish an XMPP connection using the data received in the response, it SHOULD NOT attempt the fallback process described in the next section (this helps to prevent a state mismatch between inbound and outbound connections).

8. 如果发起实体接收到对其SRV查询的响应,但无法使用响应中接收的数据建立XMPP连接,则不应尝试下一节中描述的回退过程(这有助于防止入站和出站连接之间的状态不匹配)。

9. If the initiating entity does not receive a response to its SRV query, it SHOULD attempt the fallback process described in the next section.

9. 如果发起实体未收到对其SRV查询的响应,则应尝试下一节中描述的回退过程。

3.2.2. Fallback Processes
3.2.2. 回退过程

The fallback process SHOULD be a normal "A" or "AAAA" address record resolution to determine the IPv4 or IPv6 address of the origin domain, where the port used is the "xmpp-client" port of 5222 for client-to-server connections or the "xmpp-server" port of 5269 for server-to-server connections (these are the default ports as registered with the IANA as described under Section 14.7).

回退过程应该是正常的“a”或“AAAA”地址记录解析,以确定源域的IPv4或IPv6地址,其中使用的端口是用于客户端到服务器连接的“xmpp客户端”端口5222或用于服务器到服务器连接的“xmpp服务器”端口5269(这些是在IANA注册的默认端口,如第14.7节所述)。

If connections via TCP are unsuccessful, the initiating entity might attempt to find and use alternative connection methods such as the HTTP binding (see [XEP-0124] and [XEP-0206]), which might be discovered using [DNS-TXT] records as described in [XEP-0156].

如果通过TCP的连接不成功,发起实体可能会尝试查找并使用替代连接方法,如HTTP绑定(请参见[XEP-0124]和[XEP-0206]),该连接方法可能会使用[XEP-0156]中所述的[DNS-TXT]记录来查找。

3.2.3. When Not to Use SRV
3.2.3. 何时不使用SRV

If the initiating entity has been explicitly configured to associate a particular FQDN (and potentially port) with the origin domain of the receiving entity (say, to "hardcode" an association from an origin domain of example.net to a configured FQDN of apps.example.com), the initiating entity is encouraged to use the configured name instead of performing the preferred SRV resolution process on the origin domain.

如果发起实体已明确配置为将特定FQDN(以及可能的端口)与接收实体的源域相关联(例如,将从example.net的源域到apps.example.com的配置FQDN的关联“硬编码”),鼓励发起实体使用配置的名称,而不是在源域上执行首选SRV解析过程。

3.2.4. Use of SRV Records with Add-On Services
3.2.4. 将SRV记录与附加服务一起使用

Many XMPP servers are implemented in such a way that they can host add-on services (beyond those defined in this specification and [XMPP-IM]) at DNS domain names that typically are "subdomains" of the main XMPP service (e.g., conference.example.net for a [XEP-0045] service associated with the example.net XMPP service) or "subdomains" of the first-level domain of the underlying service (e.g., muc.example.com for a [XEP-0045] service associated with the im.example.com XMPP service). If an entity associated with a remote XMPP server wishes to communicate with such an add-on service, it would generate an appropriate XML stanza and the remote server would attempt to resolve the add-on service's DNS domain name via an SRV lookup on resource records such as "_xmpp-server._tcp.conference.example.net." or "_xmpp-server._tcp.muc.example.com.". Therefore, if the administrators of an XMPP service wish to enable entities associated with remote servers to access such add-on services, they need to advertise the appropriate "_xmpp-server" SRV records in addition to the "_xmpp-server" record for their main XMPP service. In case SRV records are not available, the fallback methods described under Section 3.2.2 can be used to resolve the DNS domain names of add-on services.

许多XMPP服务器的实现方式是,它们可以在DNS域名处承载附加服务(超出本规范和[XMPP-IM]中定义的附加服务),这些域名通常是主XMPP服务的“子域”(例如,conference.example.net,用于与example.net XMPP服务关联的[XEP-0045]服务)或“子域”基础服务的第一级域(例如,与im.example.com XMPP服务关联的[XEP-0045]服务的muc.example.com)。如果与远程XMPP服务器关联的实体希望与此类附加服务通信,则它将生成适当的XML节,远程服务器将尝试通过对资源记录(如“XMPP-server._tcp.conference.example.net.”的SRV查找来解析附加服务的DNS域名,或“_xmpp-server._tcp.muc.example.com.”。因此,如果xmpp服务的管理员希望使与远程服务器关联的实体能够访问此类附加服务,则除了“_xmpp-server”之外,他们还需要公布适当的“_xmpp-server”SRV记录“记录他们的主要XMPP服务。如果SRV记录不可用,可使用第3.2.2节中描述的回退方法解析附加服务的DNS域名。

3.3. Reconnection
3.3. 重联

It can happen that an XMPP server goes offline unexpectedly while servicing TCP connections from connected clients and remote servers. Because the number of such connections can be quite large, the reconnection algorithm employed by entities that seek to reconnect can have a significant impact on software performance and network congestion. If an entity chooses to reconnect, it:

XMPP服务器在为连接的客户端和远程服务器的TCP连接提供服务时,可能会意外脱机。由于此类连接的数量可能相当大,因此寻求重新连接的实体采用的重新连接算法可能会对软件性能和网络拥塞产生重大影响。如果实体选择重新连接,它将:

o SHOULD set the number of seconds that expire before reconnecting to an unpredictable number between 0 and 60 (this helps to ensure that not all entities attempt to reconnect at exactly the same number of seconds after being disconnected).

o 应将重新连接前过期的秒数设置为0到60之间的不可预测的数字(这有助于确保并非所有实体在断开连接后都尝试以完全相同的秒数重新连接)。

o SHOULD back off increasingly on the time between subsequent reconnection attempts (e.g., in accordance with "truncated binary exponential backoff" as described in [ETHERNET]) if the first reconnection attempt does not succeed.

o 如果第一次重新连接尝试未成功,则应在后续重新连接尝试之间逐渐后退(例如,根据[以太网]中所述的“截断二进制指数后退”)。

It is RECOMMENDED to make use of TLS session resumption [TLS-RESUME] when reconnecting. A future version of this document, or a separate specification, might provide more detailed guidelines regarding methods for speeding the reconnection process.

建议在重新连接时使用TLS会话恢复[TLS-RESUME]。本文档的未来版本或单独的规范可能会提供有关加快重新连接过程的方法的更详细指南。

3.4. Reliability
3.4. 可靠性

The use of long-lived TCP connections in XMPP implies that the sending of XML stanzas over XML streams can be unreliable, since the parties to a long-lived TCP connection might not discover a connectivity disruption in a timely manner. At the XMPP application layer, long connectivity disruptions can result in undelivered stanzas. Although the core XMPP technology defined in this specification does not contain features to overcome this lack of reliability, there exist XMPP extensions for doing so (e.g., [XEP-0198]).

在XMPP中使用长寿命TCP连接意味着通过XML流发送XML节可能不可靠,因为长寿命TCP连接的各方可能无法及时发现连接中断。在XMPP应用层,长时间的连接中断可能会导致无法交付的节。尽管本规范中定义的核心XMPP技术不包含克服这种可靠性不足的功能,但存在这样做的XMPP扩展(例如[XEP-0198])。

4. XML Streams
4. XML流
4.1. Stream Fundamentals
4.1. 河流基础

Two fundamental concepts make possible the rapid, asynchronous exchange of relatively small payloads of structured information between XMPP entities: XML streams and XML stanzas. These terms are defined as follows.

两个基本概念使XMPP实体之间相对较小的结构化信息有效负载的快速、异步交换成为可能:XML流和XML节。这些术语的定义如下。

Definition of XML Stream: An XML stream is a container for the exchange of XML elements between any two entities over a network. The start of an XML stream is denoted unambiguously by an opening "stream header" (i.e., an XML <stream> tag with appropriate attributes and namespace declarations), while the end of the XML stream is denoted unambiguously by a closing XML </stream> tag. During the life of the stream, the entity that initiated it can send an unbounded number of XML elements over the stream, either elements used to negotiate the stream (e.g., to complete TLS negotiation (Section 5) or SASL negotiation (Section 6)) or XML stanzas. The "initial stream" is negotiated from the initiating entity (typically a client or server) to the receiving entity (typically a server), and can be seen as corresponding to the initiating entity's "connection to" or "session with" the receiving entity. The initial stream enables unidirectional communication from the initiating entity to the receiving entity; in order to enable exchange of stanzas from the receiving entity to the initiating entity, the receiving entity MUST negotiate a stream in the opposite direction (the "response stream").

XML流的定义:XML流是通过网络在任意两个实体之间交换XML元素的容器。XML流的开始由开始的“流头”(即带有适当属性和名称空间声明的XML<stream>标记)明确表示,而XML流的结束由结束的XML<stream>标记明确表示。在流的生命周期内,发起它的实体可以通过流发送无限数量的XML元素,可以是用于协商流的元素(例如,完成TLS协商(第5节)或SASL协商(第6节))或XML节。“初始流”从发起实体(通常是客户端或服务器)协商到接收实体(通常是服务器),并且可以被视为对应于发起实体与接收实体的“连接”或“会话”。初始流实现从发起实体到接收实体的单向通信;为了实现从接收实体到发起实体的节交换,接收实体必须协商相反方向的流(“响应流”)。

Definition of XML Stanza: An XML stanza is the basic unit of meaning in XMPP. A stanza is a first-level element (at depth=1 of the stream) whose element name is "message", "presence", or "iq" and whose qualifying namespace is 'jabber:client' or 'jabber:server'. By contrast, a first-level element qualified by any other namespace is not an XML stanza (stream errors, stream features, TLS-related elements, SASL-related elements, etc.), nor is a

XML节的定义:XML节是XMPP中意义的基本单位。节是一个第一级元素(在流的深度=1处),其元素名称为“message”、“presence”或“iq”,其限定名称空间为“jabber:client”或“jabber:server”。相反,由任何其他名称空间限定的第一级元素不是XML节(流错误、流特征、TLS相关元素、SASL相关元素等),也不是XML节

<message/>, <presence/>, or <iq/> element that is qualified by the 'jabber:client' or 'jabber:server' namespace but that occurs at a depth other than one (e.g., a <message/> element contained within an extension element (Section 8.4) for reporting purposes), nor is a <message/>, <presence/>, or <iq/> element that is qualified by a namespace other than 'jabber:client' or 'jabber:server'. An XML stanza typically contains one or more child elements (with accompanying attributes, elements, and XML character data) as necessary in order to convey the desired information, which MAY be qualified by any XML namespace (see [XML-NAMES] as well as Section 8.4 in this specification).

<message/>、<presence/>或<iq/>元素,这些元素由“jabber:client”或“jabber:server”命名空间限定,但出现在一个深度以外的位置(例如,出于报告目的,扩展元素(第8.4节)中包含的<message/>元素),也不是<message/>、<presence/>,或<iq/>元素,该元素由“jabber:client”或“jabber:server”以外的命名空间限定。XML节通常包含一个或多个子元素(带有附带的属性、元素和XML字符数据),以便传递所需的信息,这些信息可以由任何XML名称空间限定(请参见[XML-NAMES]以及本规范第8.4节)。

There are three kinds of stanzas: message, presence, and IQ (short for "Info/Query"). These stanza types provide three different communication primitives: a "push" mechanism for generalized messaging, a specialized "publish-subscribe" mechanism for broadcasting information about network availability, and a "request-response" mechanism for more structured exchanges of data (similar to [HTTP]). Further explanations are provided under Section 8.2.1, Section 8.2.2, and Section 8.2.3, respectively.

有三种小节:消息、状态和IQ(信息/查询的缩写)。这些节类型提供了三种不同的通信原语:用于通用消息传递的“推送”机制、用于广播有关网络可用性的信息的专门“发布-订阅”机制以及用于更结构化的数据交换的“请求-响应”机制(类似于[HTTP])。第8.2.1节、第8.2.2节和第8.2.3节分别提供了进一步的解释。

Consider the example of a client's connection to a server. The client initiates an XML stream by sending a stream header to the server, preferably preceded by an XML declaration specifying the XML version and the character encoding supported (see Section 11.5 and Section 11.6). Subject to local policies and service provisioning, the server then replies with a second XML stream back to the client, again preferably preceded by an XML declaration. Once the client has completed SASL negotiation (Section 6) and resource binding (Section 7), the client can send an unbounded number of XML stanzas over the stream. When the client desires to close the stream, it simply sends a closing </stream> tag to the server as further described under Section 4.4.

考虑客户端与服务器的连接示例。客户机通过向服务器发送一个流头来启动一个XML流,最好在前面加一个XML声明,指定支持的XML版本和字符编码(参见第11.5节和第11.6节)。根据本地策略和服务供应,服务器然后用第二个XML流回复回客户机,最好在前面再加一个XML声明。一旦客户机完成SASL协商(第6节)和资源绑定(第7节),客户机就可以通过流发送无限数量的XML节。当客户端希望关闭流时,它只需向服务器发送一个关闭标记,如第4.4节所述。

In essence, then, one XML stream functions as an envelope for the XML stanzas sent during a session and another XML stream functions as an envelope for the XML stanzas received during a session. We can represent this in a simplistic fashion as follows.

实际上,一个XML流充当会话期间发送的XML节的信封,另一个XML流充当会话期间接收的XML节的信封。我们可以用一种简单的方式来表示这一点,如下所示。

   +--------------------+--------------------+
   | INITIAL STREAM     |  RESPONSE STREAM   |
   +--------------------+--------------------+
   | <stream>           |                    |
   |--------------------|--------------------|
   |                    | <stream>           |
   |--------------------|--------------------|
   | <presence>         |                    |
   |   <show/>          |                    |
   | </presence>        |                    |
   |--------------------|--------------------|
   | <message to='foo'> |                    |
   |   <body/>          |                    |
   | </message>         |                    |
   |--------------------|--------------------|
   | <iq to='bar'       |                    |
   |     type='get'>    |                    |
   |   <query/>         |                    |
   | </iq>              |                    |
   |--------------------|--------------------|
   |                    | <iq from='bar'     |
   |                    |     type='result'> |
   |                    |   <query/>         |
   |                    | </iq>              |
   |--------------------|--------------------|
   | [ ... ]            |                    |
   |--------------------|--------------------|
   |                    | [ ... ]            |
   |--------------------|--------------------|
   | </stream>          |                    |
   |--------------------|--------------------|
   |                    | </stream>          |
   +--------------------+--------------------+
        
   +--------------------+--------------------+
   | INITIAL STREAM     |  RESPONSE STREAM   |
   +--------------------+--------------------+
   | <stream>           |                    |
   |--------------------|--------------------|
   |                    | <stream>           |
   |--------------------|--------------------|
   | <presence>         |                    |
   |   <show/>          |                    |
   | </presence>        |                    |
   |--------------------|--------------------|
   | <message to='foo'> |                    |
   |   <body/>          |                    |
   | </message>         |                    |
   |--------------------|--------------------|
   | <iq to='bar'       |                    |
   |     type='get'>    |                    |
   |   <query/>         |                    |
   | </iq>              |                    |
   |--------------------|--------------------|
   |                    | <iq from='bar'     |
   |                    |     type='result'> |
   |                    |   <query/>         |
   |                    | </iq>              |
   |--------------------|--------------------|
   | [ ... ]            |                    |
   |--------------------|--------------------|
   |                    | [ ... ]            |
   |--------------------|--------------------|
   | </stream>          |                    |
   |--------------------|--------------------|
   |                    | </stream>          |
   +--------------------+--------------------+
        

Figure 2: A Simplistic View of Two Streams

图2:两条流的简化视图

Those who are accustomed to thinking of XML in a document-centric manner might find the following analogies useful:

那些习惯于以文档为中心的方式思考XML的人可能会发现以下类比很有用:

o The two XML streams are like two "documents" (matching the "document" production from [XML]) that are built up through the accumulation of XML stanzas.

o 这两个XML流类似于两个“文档”(与[XML]的“文档”产品相匹配),它们是通过积累XML节构建的。

o The root <stream/> element is like the "document entity" for each "document" (as described in Section 4.8 of [XML]).

o 根<stream/>元素类似于每个“文档”的“文档实体”(如[XML]第4.8节所述)。

o The XML stanzas sent over the streams are like "fragments" of the "documents" (as described in [XML-FRAG]).

o 通过流发送的XML节类似于“文档”的“片段”(如[XML-FRAG]中所述)。

However, these descriptions are merely analogies, because XMPP does not deal in documents and fragments but in streams and stanzas.

然而,这些描述仅仅是类比,因为XMPP不处理文档和片段,而是处理流和节。

The remainder of this section defines the following aspects of XML streams (along with related topics):

本节的其余部分定义了XML流的以下方面(以及相关主题):

o How to open a stream (Section 4.2)

o 如何打开溪流(第4.2节)

o The stream negotiation process (Section 4.3)

o 流协商过程(第4.3节)

o How to close a stream (Section 4.4)

o 如何关闭河流(第4.4节)

o The directionality of XML streams (Section 4.5)

o XML流的方向性(第4.5节)

o How to handle peers that are silent (Section 4.6)

o 如何处理沉默的对等方(第4.6节)

o The XML attributes of a stream (Section 4.7)

o 流的XML属性(第4.7节)

o The XML namespaces of a stream (Section 4.8)

o 流的XML名称空间(第4.8节)

o Error handling related to XML streams (Section 4.9)

o 与XML流相关的错误处理(第4.9节)

4.2. Opening a Stream
4.2. 开河

After connecting to the appropriate IP address and port of the receiving entity, the initiating entity opens a stream by sending a stream header (the "initial stream header") to the receiving entity.

在连接到接收实体的适当IP地址和端口后,发起实体通过向接收实体发送流头(“初始流头”)来打开流。

   I: <?xml version='1.0'?>
      <stream:stream
          from='juliet@im.example.com'
          to='im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   I: <?xml version='1.0'?>
      <stream:stream
          from='juliet@im.example.com'
          to='im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        

The receiving entity then replies by sending a stream header of its own (the "response stream header") to the initiating entity.

然后,接收实体通过向发起实体发送其自己的流报头(“响应流报头”)进行应答。

   R: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   R: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        

The entities can then proceed with the remainder of the stream negotiation process.

然后,实体可以继续流协商过程的剩余部分。

4.3. Stream Negotiation
4.3. 河流协商
4.3.1. Basic Concepts
4.3.1. 基本概念

Because the receiving entity for a stream acts as a gatekeeper to the domains it services, it imposes certain conditions for connecting as a client or as a peer server. At a minimum, the initiating entity needs to authenticate with the receiving entity before it is allowed to send stanzas to the receiving entity (for client-to-server streams this means using SASL as described under Section 6). However, the receiving entity can consider conditions other than authentication to be mandatory-to-negotiate, such as encryption using TLS as described under Section 5. The receiving entity informs the initiating entity about such conditions by communicating "stream features": the set of particular protocol interactions that the initiating entity needs to complete before the receiving entity will accept XML stanzas from the initiating entity, as well as any protocol interactions that are voluntary-to-negotiate but that might improve the handling of an XML stream (e.g., establishment of application-layer compression as described in [XEP-0138]).

因为流的接收实体充当它所服务的域的网守,所以它为作为客户端或对等服务器进行连接强加了某些条件。至少,在允许发起实体向接收实体发送节之前,发起实体需要与接收实体进行身份验证(对于客户端到服务器的流,这意味着使用第6节所述的SASL)。然而,接收实体可以考虑除了认证之外的条件进行强制协商,例如使用如第5节所述的TLS加密。接收实体通过通信“流特征”将此类条件通知发起实体:在接收实体接受发起实体的XML节之前,发起实体需要完成的一组特定协议交互,以及自愿协商但可能改进XML流处理的任何协议交互(例如,如[XEP-0138]中所述建立应用层压缩)。

The existence of conditions for connecting implies that streams need to be negotiated. The order of layers (TCP, then TLS, then SASL, then XMPP as described under Section 13.3) implies that stream negotiation is a multi-stage process. Further structure is imposed by two factors: (1) a given stream feature might be offered only to certain entities or only after certain other features have been negotiated (e.g., resource binding is offered only after SASL authentication), and (2) stream features can be either mandatory-to-negotiate or voluntary-to-negotiate. Finally, for security reasons the parties to a stream need to discard knowledge that they gained during the negotiation process after successfully completing the protocol interactions defined for certain features (e.g., TLS in all cases and SASL in the case when a security layer might be

连接条件的存在意味着需要协商流。层的顺序(TCP、TLS、SASL、XMPP,如第13.3节所述)意味着流协商是一个多阶段的过程。进一步的结构是由两个因素强加的:(1)给定的流特征可能仅提供给某些实体,或者仅在协商了某些其他特征之后提供(例如,只有在SASL身份验证之后才提供资源绑定),以及(2)流特征可以是强制协商的,也可以是自愿协商的。最后,出于安全原因,流的各方需要放弃他们在成功完成为某些特性定义的协议交互后在协商过程中获得的知识(例如,在所有情况下为TLS,在可能需要安全层的情况下为SASL)

established, as defined in the specification for the relevant SASL mechanism). This is done by flushing the old stream context and exchanging new stream headers over the existing TCP connection.

根据相关SASL机制规范中的定义建立)。这是通过刷新旧的流上下文并通过现有TCP连接交换新的流头来完成的。

4.3.2. Stream Features Format
4.3.2. 流要素格式

If the initiating entity includes in the initial stream header the 'version' attribute set to a value of at least "1.0" (see Section 4.7.5), after sending the response stream header the receiving entity MUST send a <features/> child element (typically prefixed by the stream namespace prefix as described under Section 4.8.5) to the initiating entity in order to announce any conditions for continuation of the stream negotiation process. Each condition takes the form of a child element of the <features/> element, qualified by a namespace that is different from the stream namespace and the content namespace. The <features/> element can contain one child, contain multiple children, or be empty.

如果发起实体在初始流标头中包含设置为至少“1.0”值的“版本”属性(参见第4.7.5节),则在发送响应流标头后,接收实体必须发送<features/>子元素(通常以第4.8.5节所述的流命名空间前缀作为前缀)通知发起实体,以便宣布继续流协商过程的任何条件。每个条件都采用<features/>元素的子元素的形式,由不同于流名称空间和内容名称空间的名称空间限定。<features/>元素可以包含一个子元素、多个子元素或为空。

Implementation Note: The order of child elements contained in any given <features/> element is not significant.

实现说明:任何给定的<features/>元素中包含的子元素的顺序都不重要。

If a particular stream feature is or can be mandatory-to-negotiate, the definition of that feature needs to do one of the following:

如果某个特定的流特征是或可能是必须协商的,则该特征的定义需要执行以下操作之一:

1. Declare that the feature is always mandatory-to-negotiate (e.g., this is true of resource binding for XMPP clients); or

1. 声明该特性始终是协商所必需的(例如,XMPP客户端的资源绑定也是如此);或

2. Specify a way for the receiving entity to flag the feature as mandatory-to-negotiate for this interaction (e.g., for STARTTLS, this is done by including an empty <required/> element in the advertisement for that stream feature, but that is not a generic format for all stream features); it is RECOMMENDED that stream feature definitions for new mandatory-to-negotiate features do so by including an empty <required/> element as is done for STARTTLS.

2. 为接收实体指定一种方式,将该特征标记为该交互协商的强制特征(例如,对于STARTTLS,这是通过在该流特征的公告中包含一个空的<required/>元素来实现的,但这不是所有流特征的通用格式);建议新强制协商功能的流功能定义包括一个空的<required/>元素,就像STARTTLS一样。

Informational Note: Because there is no generic format for indicating that a feature is mandatory-to-negotiate, it is possible that a feature that is not understood by the initiating entity might be considered mandatory-to-negotiate by the receiving entity, resulting in failure of the stream negotiation process. Although such an outcome would be undesirable, the working group deemed it rare enough that a generic format was not needed.

信息性说明:由于没有通用格式来指示功能必须协商,因此发起实体无法理解的功能可能被接收实体视为必须协商,从而导致流协商过程失败。虽然这样的结果是不可取的,但工作组认为,很少有人不需要通用格式。

For security reasons, certain stream features necessitate the initiating entity to send a new initial stream header upon successful negotiation of the feature (e.g., TLS in all cases and SASL in the case when a security layer might be established). If this is true of

出于安全原因,某些流特征要求发起实体在成功协商该特征时发送新的初始流报头(例如,在所有情况下为TLS,在可能建立安全层的情况下为SASL)。如果这是真的

a given stream feature, the definition of that feature needs to specify that a stream restart is expected after negotiation of the feature.

对于给定的流特性,该特性的定义需要指定在协商该特性后预期流重新启动。

A <features/> element that contains at least one mandatory-to-negotiate feature indicates that the stream negotiation is not complete and that the initiating entity MUST negotiate further features.

至少包含一个强制协商功能的<features/>元素表示流协商未完成,发起实体必须协商其他功能。

   R: <stream:features>
        <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'>
          <required/>
        </starttls>
      </stream:features>
        
   R: <stream:features>
        <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'>
          <required/>
        </starttls>
      </stream:features>
        

A <features/> element MAY contain more than one mandatory-to-negotiate feature. This means that the initiating entity can choose among the mandatory-to-negotiate features at this stage of the stream negotiation process. As an example, perhaps a future technology will perform roughly the same function as TLS, so the receiving entity might advertise support for both TLS and the future technology at the same stage of the stream negotiation process. However, this applies only at a given stage of the stream negotiation process and does not apply to features that are mandatory-to-negotiate at different stages (e.g., the receiving entity would not advertise both STARTTLS and SASL as mandatory-to-negotiate, or both SASL and resource binding as mandatory-to-negotiate, because TLS would need to be negotiated before SASL and because SASL would need to be negotiated before resource binding).

一个<features/>元素可能包含多个必须协商的特性。这意味着发起实体可以在流协商过程的这一阶段从强制协商功能中进行选择。例如,可能未来技术将执行与TLS大致相同的功能,因此接收实体可能在流协商过程的同一阶段宣传对TLS和未来技术的支持。但是,这仅适用于流协商过程的给定阶段,不适用于在不同阶段强制协商的功能(例如,接收实体不会宣布STARTTL和SASL都是谈判的强制性要求,或者SASL和资源绑定都是谈判的强制性要求,因为TLS需要在SASL之前谈判,而SASL需要在资源绑定之前谈判)。

A <features/> element that contains both mandatory-to-negotiate and voluntary-to-negotiate features indicates that the negotiation is not complete but that the initiating entity MAY complete the voluntary-to-negotiate feature(s) before it attempts to negotiate the mandatory-to-negotiate feature(s).

包含强制协商和自愿协商功能的<features/>元素表示协商未完成,但发起实体可在尝试协商强制协商功能之前完成自愿协商功能。

   R: <stream:features>
        <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
        <compression xmlns='http://jabber.org/features/compress'>
          <method>zlib</method>
          <method>lzw</method>
        </compression>
      </stream:features>
        
   R: <stream:features>
        <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
        <compression xmlns='http://jabber.org/features/compress'>
          <method>zlib</method>
          <method>lzw</method>
        </compression>
      </stream:features>
        

A <features/> element that contains only voluntary-to-negotiate features indicates that the stream negotiation is complete and that the initiating entity is cleared to send XML stanzas, but that the initiating entity MAY negotiate further features if desired.

仅包含自愿协商功能的<features/>元素表示流协商已完成,且发起实体已被清除以发送XML节,但如果需要,发起实体可以协商其他功能。

   R: <stream:features>
        <compression xmlns='http://jabber.org/features/compress'>
          <method>zlib</method>
          <method>lzw</method>
        </compression>
      </stream:features>
        
   R: <stream:features>
        <compression xmlns='http://jabber.org/features/compress'>
          <method>zlib</method>
          <method>lzw</method>
        </compression>
      </stream:features>
        

An empty <features/> element indicates that the stream negotiation is complete and that the initiating entity is cleared to send XML stanzas.

一个空的<features/>元素表示流协商已完成,并且已清除发起实体以发送XML节。

   R: <stream:features/>
        
   R: <stream:features/>
        
4.3.3. Restarts
4.3.3. 重新开始

On successful negotiation of a feature that necessitates a stream restart, both parties MUST consider the previous stream to be replaced but MUST NOT send a closing </stream> tag and MUST NOT terminate the underlying TCP connection; instead, the parties MUST reuse the existing connection, which might be in a new state (e.g., encrypted as a result of TLS negotiation). The initiating entity then MUST send a new initial stream header, which SHOULD be preceded by an XML declaration as described under Section 11.5. When the receiving entity receives the new initial stream header, it MUST generate a new stream ID (instead of reusing the old stream ID) before sending a new response stream header (which SHOULD be preceded by an XML declaration as described under Section 11.5).

在成功协商流重新启动的特征时,双方必须考虑先前的流被替换,但不能发送关闭<流>标签,并且不能终止底层TCP连接;相反,双方必须重用可能处于新状态(例如,由于TLS协商而加密)的现有连接。然后,发起实体必须发送一个新的初始流报头,该报头前面应该有一个XML声明,如第11.5节所述。当接收实体接收到新的初始流头时,它必须在发送新的响应流头之前生成一个新的流ID(而不是重用旧的流ID)(该响应流头之前应该有一个XML声明,如第11.5节所述)。

4.3.4. Resending Features
4.3.4. 重发功能

The receiving entity MUST send an updated list of stream features to the initiating entity after a stream restart. The list of updated features MAY be empty if there are no further features to be advertised or MAY include any combination of features.

在流重新启动后,接收实体必须向发起实体发送更新的流特征列表。如果没有进一步的特性要公布,或者可能包括特性的任何组合,则更新的特性列表可能为空。

4.3.5. Completion of Stream Negotiation
4.3.5. 完成流协商

The receiving entity indicates completion of the stream negotiation process by sending to the initiating entity either an empty <features/> element or a <features/> element that contains only voluntary-to-negotiate features. After doing so, the receiving entity MAY send an empty <features/> element (e.g., after negotiation of such voluntary-to-negotiate features) but MUST NOT send additional stream features to the initiating entity (if the receiving entity has new features to offer, preferably limited to mandatory-to-negotiate or security-critical features, it can simply close the stream with a <reset/> stream error (Section 4.9.3.16) and then advertise the new features when the initiating entity reconnects, preferably closing

接收实体通过向发起实体发送空<features/>元素或仅包含自愿协商特征的<features/>元素来指示流协商过程的完成。在这样做之后,接收实体可以发送空的<features/>元素(例如,在协商此类自愿协商的特征之后),但不得向发起实体发送额外的流特征(如果接收实体有新功能可提供,最好仅限于强制协商或安全关键功能,则它可以简单地关闭流,并出现<reset/>流错误(第4.9.3.16节),然后在发起实体重新连接时公布新功能,最好是关闭

existing streams in a staggered way so that not all of the initiating entities reconnect at once). Once stream negotiation is complete, the initiating entity is cleared to send XML stanzas over the stream for as long as the stream is maintained by both parties.

以交错方式连接现有流,以便不是所有发起实体都能同时重新连接)。一旦流协商完成,只要流由双方维护,发起实体就可以通过流发送XML节。

Informational Note: Resource binding as specified under Section 7 is an historical exception to the foregoing rule, since it is mandatory-to-negotiate for clients but uses XML stanzas for negotiation purposes.

信息性说明:第7节中规定的资源绑定是上述规则的历史例外,因为必须为客户端协商,但为了协商目的使用XML节。

The initiating entity MUST NOT attempt to send XML stanzas (Section 8) to entities other than itself (i.e., the client's connected resource or any other authenticated resource of the client's account) or the server to which it is connected until stream negotiation has been completed. Even if the initiating entity does attempt to do so, the receiving entity MUST NOT accept such stanzas and MUST close the stream with a <not-authorized/> stream error (Section 4.9.3.12). This rule applies to XML stanzas only (i.e., <message/>, <presence/>, and <iq/> elements qualified by the content namespace) and not to XML elements used for stream negotiation (e.g., elements used to complete TLS negotiation (Section 5) or SASL negotiation (Section 6)).

在流协商完成之前,发起实体不得尝试将XML节(第8节)发送给自身以外的实体(即,客户机的连接资源或客户机帐户的任何其他经过身份验证的资源)或其连接的服务器。即使发起实体确实尝试这样做,接收实体也不得接受此类节,并且必须以<NOT authorized/>流错误关闭流(第4.9.3.12节)。此规则仅适用于XML节(即,<message/>、<presence/>和由内容命名空间限定的<iq/>元素),而不适用于用于流协商的XML元素(例如,用于完成TLS协商(第5节)或SASL协商(第6节)的元素)。

4.3.6. Determination of Addresses
4.3.6. 地址的确定

After the parties to an XML stream have completed the appropriate aspects of stream negotiation, the receiving entity for a stream MUST determine the initiating entity's JID.

XML流的各方完成流协商的适当方面后,流的接收实体必须确定发起实体的JID。

For client-to-server communication, both SASL negotiation (Section 6) and resource binding (Section 7) MUST be completed before the server can determine the client's address. The client's bare JID (<localpart@domainpart>) MUST be the authorization identity (as defined by [SASL]), either (1) as directly communicated by the client during SASL negotiation (Section 6) or (2) as derived by the server from the authentication identity if no authorization identity was specified during SASL negotiation. The resourcepart of the full JID (<localpart@domainpart/resourcepart>) MUST be the resource negotiated by the client and server during resource binding (Section 7). A client MUST NOT attempt to guess at its JID but instead MUST consider its JID to be whatever the server returns to it during resource binding. The server MUST ensure that the resulting JID (including localpart, domainpart, resourcepart, and separator characters) conforms to the canonical format for XMPP addresses defined in [XMPP-ADDR]; to meet this restriction, the server MAY replace the JID sent by the client with the canonicalized JID as determined by the server and communicate that JID to the client during resource binding.

对于客户端到服务器的通信,SASL协商(第6节)和资源绑定(第7节)必须在服务器确定客户端地址之前完成。客户的赤裸裸的JID(<localpart@domainpart>)必须是授权标识(由[SASL]定义),或者(1)在SASL协商期间由客户端直接通信(第6节),或者(2)如果在SASL协商期间未指定授权标识,则由服务器从身份验证标识派生。完整JID的资源部分(<localpart@domainpart/resourcepart>)必须是客户端和服务器在资源绑定期间协商的资源(第7节)。客户端不能尝试猜测它的JID,而是必须考虑它的JID是服务器在资源绑定期间返回给它的任何东西。服务器必须确保生成的JID(包括localpart、domainpart、resourcepart和分隔符)符合[XMPP-ADDR]中定义的XMPP地址的规范格式;为了满足此限制,服务器可以使用服务器确定的规范化JID替换客户端发送的JID,并在资源绑定期间将该JID与客户端通信。

For server-to-server communication, the initiating server's bare JID (<domainpart>) MUST be the authorization identity (as defined by [SASL]), either (1) as directly communicated by the initiating server during SASL negotiation (Section 6) or (2) as derived by the receiving server from the authentication identity if no authorization identity was specified during SASL negotiation. In the absence of SASL negotiation, the receiving server MAY consider the authorization identity to be an identity negotiated within the relevant verification protocol (e.g., the 'from' attribute of the <result/> element in Server Dialback [XEP-0220]).

对于服务器到服务器的通信,发起服务器的裸JID(<domainpart>)必须是授权标识(由[SASL]定义),或者是(1)在SASL协商期间由发起服务器直接通信(第6节)或者(2)如果在SASL协商期间未指定授权标识,则由接收服务器从身份验证标识派生。在没有SASL协商的情况下,接收服务器可以认为授权标识是在相关验证协议内协商的身份(例如,服务器拨号[XEP-0220]中的<结果/>元素的'OF'属性)。

Security Warning: Because it is possible for a third party to tamper with information that is sent over the stream before a security layer such as TLS is successfully negotiated, it is advisable for the receiving server to treat any such unprotected information with caution; this applies especially to the 'from' and 'to' addresses on the first initial stream header sent by the initiating entity.

安全警告:由于在成功协商安全层(如TLS)之前,第三方可能篡改通过流发送的信息,因此建议接收服务器谨慎处理任何此类未受保护的信息;这尤其适用于发起实体发送的第一个初始流头上的“发件人”和“收件人”地址。

4.3.7. Flow Chart
4.3.7. 流程图

We summarize the foregoing rules in the following non-normative flow chart for the stream negotiation process, presented from the perspective of the initiating entity.

我们在以下非规范流程图中总结了上述规则,该流程图是从发起实体的角度提出的。

                   +---------------------+
                   | open TCP connection |
                   +---------------------+
                              |
                              v
                       +---------------+
                       | send initial  |<-------------------------+
                       | stream header |                          ^
                       +---------------+                          |
                              |                                   |
                              v                                   |
                      +------------------+                        |
                      | receive response |                        |
                      | stream header    |                        |
                      +------------------+                        |
                              |                                   |
                              v                                   |
                       +----------------+                         |
                       | receive stream |                         |
   +------------------>| features       |                         |
   ^   {OPTIONAL}      +----------------+                         |
   |                          |                                   |
   |                          v                                   |
   |       +<-----------------+                                   |
   |       |                                                      |
   |    {empty?} ----> {all voluntary?} ----> {some mandatory?}   |
   |       |      no          |          no         |             |
   |       | yes              | yes                 | yes         |
   |       |                  v                     v             |
   |       |           +---------------+    +----------------+    |
   |       |           | MAY negotiate |    | MUST negotiate |    |
   |       |           | any or none   |    | one feature    |    |
   |       |           +---------------+    +----------------+    |
   |       v                  |                     |             |
   |   +---------+            v                     |             |
   |   |  DONE   |<----- {negotiate?}               |             |
   |   +---------+   no       |                     |             |
   |                     yes  |                     |             |
   |                          v                     v             |
   |                          +--------->+<---------+             |
   |                                     |                        |
   |                                     v                        |
   +<-------------------------- {restart mandatory?} ------------>+
                  no                                     yes
        
                   +---------------------+
                   | open TCP connection |
                   +---------------------+
                              |
                              v
                       +---------------+
                       | send initial  |<-------------------------+
                       | stream header |                          ^
                       +---------------+                          |
                              |                                   |
                              v                                   |
                      +------------------+                        |
                      | receive response |                        |
                      | stream header    |                        |
                      +------------------+                        |
                              |                                   |
                              v                                   |
                       +----------------+                         |
                       | receive stream |                         |
   +------------------>| features       |                         |
   ^   {OPTIONAL}      +----------------+                         |
   |                          |                                   |
   |                          v                                   |
   |       +<-----------------+                                   |
   |       |                                                      |
   |    {empty?} ----> {all voluntary?} ----> {some mandatory?}   |
   |       |      no          |          no         |             |
   |       | yes              | yes                 | yes         |
   |       |                  v                     v             |
   |       |           +---------------+    +----------------+    |
   |       |           | MAY negotiate |    | MUST negotiate |    |
   |       |           | any or none   |    | one feature    |    |
   |       |           +---------------+    +----------------+    |
   |       v                  |                     |             |
   |   +---------+            v                     |             |
   |   |  DONE   |<----- {negotiate?}               |             |
   |   +---------+   no       |                     |             |
   |                     yes  |                     |             |
   |                          v                     v             |
   |                          +--------->+<---------+             |
   |                                     |                        |
   |                                     v                        |
   +<-------------------------- {restart mandatory?} ------------>+
                  no                                     yes
        

Figure 3: Stream Negotiation Flow Chart

图3:流协商流程图

4.4. Closing a Stream
4.4. 关闭一条小溪

An XML stream from one entity to another can be closed at any time, either because a specific stream error (Section 4.9) has occurred or in the absence of an error (e.g., when a client simply ends its session).

从一个实体到另一个实体的XML流可以随时关闭,这可能是因为发生了特定的流错误(第4.9节),也可能是因为没有错误(例如,当客户端简单地结束其会话时)。

A stream is closed by sending a closing </stream> tag.

通过发送关闭标记来关闭流。

   E: </stream:stream>
        
   E: </stream:stream>
        

If the parties are using either two streams over a single TCP connection or two streams over two TCP connections, the entity that sends the closing stream tag MUST behave as follows:

如果双方在单个TCP连接上使用两个流,或者在两个TCP连接上使用两个流,则发送关闭流标记的实体必须如下所示:

1. Wait for the other party to also close its outbound stream before terminating the underlying TCP connection(s); this gives the other party an opportunity to finish transmitting any outbound data to the closing entity before the termination of the TCP connection(s).

1. 在终止底层TCP连接之前,等待另一方也关闭其出站流;这使另一方有机会在TCP连接终止之前完成向关闭实体发送任何出站数据。

2. Refrain from sending any further data over its outbound stream to the other entity, but continue to process data received from the other entity (and, if necessary, process such data).

2. 避免通过其出站流向其他实体发送任何进一步的数据,但继续处理从其他实体接收的数据(如有必要,处理此类数据)。

3. Consider both streams to be void if the other party does not send its closing stream tag within a reasonable amount of time (where the definition of "reasonable" is a matter of implementation or deployment).

3. 如果另一方不在合理的时间内发送其关闭流标签(其中“合理”的定义是实现或部署的问题”,则认为这两个流都是无效的。

4. After receiving a reciprocal closing stream tag from the other party or waiting a reasonable amount of time with no response, terminate the underlying TCP connection(s).

4. 在从另一方接收到反向关闭流标记或等待一段合理的时间而没有响应后,终止底层TCP连接。

Security Warning: In accordance with Section 7.2.1 of [TLS], to help prevent a truncation attack the party that is closing the stream MUST send a TLS close_notify alert and MUST receive a responding close_notify alert from the other party before terminating the underlying TCP connection(s).

安全警告:根据[TLS]第7.2.1节,为了帮助防止截断攻击,关闭流的一方必须发送TLS close_notify警报,并且必须在终止底层TCP连接之前从另一方接收响应的close_notify警报。

If the parties are using multiple streams over multiple TCP connections, there is no defined pairing of streams and therefore the behavior is a matter for implementation.

如果双方在多个TCP连接上使用多个流,则没有定义流的配对,因此行为是实现问题。

4.5. Directionality
4.5. 方向性

An XML stream is always unidirectional, by which is meant that XML stanzas can be sent in only one direction over the stream (either from the initiating entity to the receiving entity or from the receiving entity to the initiating entity).

XML流始终是单向的,这意味着XML节只能在流的一个方向上发送(从发起实体到接收实体或从接收实体到发起实体)。

Depending on the type of session that has been negotiated and the nature of the entities involved, the entities might use:

根据已协商的会话类型和所涉及实体的性质,实体可使用:

o Two streams over a single TCP connection, where the security context negotiated for the first stream is applied to the second stream. This is typical for client-to-server sessions, and a server MUST allow a client to use the same TCP connection for both streams.

o 通过单个TCP连接的两个流,其中为第一个流协商的安全上下文应用于第二个流。这是典型的客户端到服务器会话,服务器必须允许客户端对两个流使用相同的TCP连接。

o Two streams over two TCP connections, where each stream is separately secured. In this approach, one TCP connection is used for the stream in which stanzas are sent from the initiating entity to the receiving entity, and the other TCP connection is used for the stream in which stanzas are sent from the receiving entity to the initiating entity. This is typical for server-to-server sessions.

o 通过两个TCP连接的两个流,其中每个流分别受到保护。在这种方法中,一个TCP连接用于从发起实体向接收实体发送节的流,另一个TCP连接用于从接收实体向发起实体发送节的流。这是典型的服务器到服务器会话。

o Multiple streams over two or more TCP connections, where each stream is separately secured. This approach is sometimes used for server-to-server communication between two large XMPP service providers; however, this can make it difficult to maintain coherence of data received over multiple streams in situations described under Section 10.1, which is why a server MAY close the stream with a <conflict/> stream error (Section 4.9.3.3) if a remote server attempts to negotiate more than one stream (as described under Section 4.9.3.3).

o 通过两个或多个TCP连接的多个流,其中每个流分别受到保护。这种方法有时用于两个大型XMPP服务提供商之间的服务器到服务器通信;然而,在第10.1节所述的情况下,这可能会使通过多个流接收的数据难以保持一致性,这就是为什么如果远程服务器尝试协商多个流(如第4.9.3.3节所述),服务器可能会以<conflict/>流错误(第4.9.3.3节)关闭流。

This concept of directionality applies only to stanzas and explicitly does not apply to first-level children of the stream root that are used to bootstrap or manage the stream (e.g., first-level elements used for TLS negotiation, SASL negotiation, Server Dialback [XEP-0220], and Stream Management [XEP-0198]).

此方向性概念仅适用于节,明确不适用于用于引导或管理流的流根的第一级子级(例如,用于TLS协商、SASL协商、服务器回拨[XEP-0220]和流管理[XEP-0198]的第一级元素)。

The foregoing considerations imply that while completing STARTTLS negotiation (Section 5) and SASL negotiation (Section 6) two servers would use one TCP connection, but after the stream negotiation process is done that original TCP connection would be used only for the initiating server to send XML stanzas to the receiving server. In order for the receiving server to send XML stanzas to the initiating server, the receiving server would need to reverse the roles and negotiate an XML stream from the receiving server to the

上述考虑意味着,在完成STARTTLS协商(第5节)和SASL协商(第6节)时,两台服务器将使用一个TCP连接,但在完成流协商过程后,原始TCP连接将仅用于发起服务器向接收服务器发送XML节。为了让接收服务器向发起服务器发送XML节,接收服务器需要反转角色并协商从接收服务器到发起服务器的XML流

initiating server over a separate TCP connection. This separate TCP connection is then secured using a new round of TLS and/or SASL negotiation.

通过单独的TCP连接启动服务器。然后,使用新一轮TLS和/或SASL协商来保护这个单独的TCP连接。

Implementation Note: For historical reasons, a server-to-server session always uses two TCP connections. While that approach remains the standard behavior described in this document, extensions such as [XEP-0288] enable servers to negotiate the use of a single TCP connection for bidirectional stanza exchange.

实现说明:由于历史原因,服务器到服务器会话始终使用两个TCP连接。虽然这种方法仍然是本文档中描述的标准行为,但[XEP-0288]等扩展使服务器能够协商使用单个TCP连接进行双向节交换。

Informational Note: Although XMPP developers sometimes apply the terms "unidirectional" and "bidirectional" to the underlying TCP connection (e.g., calling the TCP connection for a client-to-server session "bidirectional" and the TCP connection for a server-to-server session "unidirectional"), strictly speaking a stream is always unidirectional (because the initiating entity and receiving entity always have a minimum of two streams, one in each direction) and a TCP connection is always bidirectional (because TCP traffic can be sent in both directions). Directionality applies to the application-layer traffic sent over the TCP connection, not to the transport-layer traffic sent over the TCP connection itself.

信息说明:尽管XMPP开发人员有时会将术语“单向”和“双向”应用于底层TCP连接(例如,将客户端到服务器会话的TCP连接称为“双向”,将服务器到服务器会话的TCP连接称为“单向”),但严格来说,流始终是单向的(因为发起实体和接收实体总是至少有两个流,每个方向一个),并且TCP连接总是双向的(因为TCP流量可以在两个方向上发送)。方向性适用于通过TCP连接发送的应用层通信量,而不适用于通过TCP连接本身发送的传输层通信量。

4.6. Handling of Silent Peers
4.6. 沉默对等的处理

When an entity that is a party to a stream has not received any XMPP traffic from its stream peer for some period of time, the peer might appear to be silent. There are several reasons why this might happen:

当作为流的一方的实体在一段时间内没有从其流对等方接收到任何XMPP流量时,该对等方可能看起来是沉默的。发生这种情况的原因有几个:

1. The underlying TCP connection is dead.

1. 底层TCP连接已断开。

2. The XML stream is broken despite the fact that the underlying TCP connection is alive.

2. 尽管底层TCP连接处于活动状态,XML流仍被破坏。

3. The peer is idle and simply has not sent any XMPP traffic over its XML stream to the entity.

3. 对等方处于空闲状态,并且没有通过其XML流向实体发送任何XMPP通信。

These three conditions are best handled separately, as described in the following sections.

这三种情况最好分开处理,如下节所述。

Implementation Note: For the purpose of handling silent peers, we treat a two unidirectional TCP connections as conceptually equivalent to a single bidirectional TCP connection (see Section 4.5); however, implementers need to be aware that, in the case of two unidirectional TCP connections, responses to traffic at the XMPP application layer will come back from the peer on the second TCP connection. In addition, the use of multiple streams

实现说明:为了处理静默对等点,我们将两个单向TCP连接视为概念上等同于一个双向TCP连接(参见第4.5节);但是,实现者需要知道,在两个单向TCP连接的情况下,XMPP应用层的流量响应将从第二个TCP连接上的对等方返回。此外,使用多个流

in each direction (which is a somewhat frequent deployment choice for server-to-server connectivity among large XMPP service providers) further complicates application-level checking of XMPP streams and their underlying TCP connections, because there is no necessary correlation between any given initial stream and any given response stream.

在每个方向上(对于大型XMPP服务提供商之间的服务器到服务器连接,这是一种较为常见的部署选择),都会使XMPP流及其底层TCP连接的应用程序级检查更加复杂,因为任何给定的初始流和任何给定的响应流之间都没有必要的相关性。

4.6.1. Dead Connection
4.6.1. 死连接

If the underlying TCP connection is dead, stream-level checks (e.g., [XEP-0199] and [XEP-0198]) are ineffective. Therefore, it is unnecessary to close the stream with or without an error, and it is appropriate instead to simply terminate the TCP connection.

如果底层TCP连接失效,则流级检查(例如[XEP-0199]和[XEP-0198])无效。因此,无需在有错误或无错误的情况下关闭流,只需终止TCP连接即可。

One common method for checking the TCP connection is to send a space character (U+0020) between XML stanzas, which is allowed for XML streams as described under Section 11.7; the sending of such a space character is properly called a "whitespace keepalive" (the term "whitespace ping" is often used, despite the fact that it is not a ping since no "pong" is possible). However, this is not allowed during TLS negotiation or SASL negotiation, as described under Section 5.3.3 and Section 6.3.5.

检查TCP连接的一种常用方法是在XML节之间发送一个空格字符(U+0020),如第11.7节所述,XML流允许使用空格字符;这种空格字符的发送被恰当地称为“空白保持活动”(经常使用术语“空白ping”,尽管它不是ping,因为不可能有“pong”)。但是,如第5.3.3节和第6.3.5节所述,在TLS谈判或SASL谈判期间,这是不允许的。

4.6.2. Broken Stream
4.6.2. 断流

Even if the underlying TCP connection is alive, the peer might never respond to XMPP traffic that the entity sends, whether normal stanzas or specialized stream-checking traffic such as the application-level pings defined in [XEP-0199] or the more comprehensive Stream Management protocol defined in [XEP-0198]. In this case, it is appropriate for the entity to close a broken stream with a <connection-timeout/> stream error (Section 4.9.3.4).

即使底层TCP连接处于活动状态,对等方可能永远不会响应实体发送的XMPP流量,无论是普通节还是专门的流检查流量,如[XEP-0199]中定义的应用程序级ping或[XEP-0198]中定义的更全面的流管理协议。在这种情况下,实体关闭带有<connection timeout/>流错误的中断流是合适的(第4.9.3.4节)。

4.6.3. Idle Peer
4.6.3. 空闲的同伴

Even if the underlying TCP connection is alive and the stream is not broken, the peer might have sent no stanzas for a certain period of time. In this case, the peer itself MAY close the stream (as described under Section 4.4) rather than leaving an unused stream open. If the idle peer does not close the stream, the other party MAY either close the stream using the handshake described under Section 4.4 or close the stream with a stream error (e.g., <resource-constraint/> (Section 4.9.3.17) if the entity has reached a limit on the number of open TCP connections or <policy-violation/> (Section 4.9.3.14) if the connection has exceeded a local timeout policy). However, consistent with the order of layers (specified under Section 13.3), the other party is advised to verify that the underlying TCP connection is alive and the stream is unbroken (as

即使底层TCP连接处于活动状态且流未中断,对等方也可能在一定时间内未发送任何节。在这种情况下,对等方本身可以关闭流(如第4.4节所述),而不是让未使用的流保持打开状态。如果空闲对等方未关闭流,则另一方可以使用第4.4节中描述的握手关闭流,或者如果实体已达到开放TCP连接数量的限制或<策略违反/>(第4.9.3.14节),则关闭流时出现流错误(例如<resource constraint/>(第4.9.3.17节)如果连接已超过本地超时策略)。但是,根据层的顺序(第13.3节规定),建议另一方验证底层TCP连接是否处于活动状态,流是否未中断(如图所示)

described above) before concluding that the peer is idle. Furthermore, it is preferable to be liberal in accepting idle peers, since experience has shown that doing so improves the reliability of communication over XMPP networks and that it is typically more efficient to maintain a stream between two servers than to aggressively time out such a stream.

(如上所述),然后得出对等方空闲的结论。此外,在接受空闲对等点时最好是自由的,因为经验表明这样做可以提高XMPP网络上通信的可靠性,并且通常在两台服务器之间维护流比主动超时这样的流更有效。

4.6.4. Use of Checking Methods
4.6.4. 检查方法的使用

Implementers are advised to support whichever stream-checking and connection-checking methods they deem appropriate, but to carefully weigh the network impact of such methods against the benefits of discovering broken streams and dead TCP connections in a timely manner. The length of time between the use of any particular check is very much a matter of local service policy and depends strongly on the network environment and usage scenarios of a given deployment and connection type. At the time of writing, it is RECOMMENDED that any such check be performed not more than once every 5 minutes and that, ideally, such checks will be initiated by clients rather than servers. Those who implement XMPP software and deploy XMPP services are encouraged to seek additional advice regarding appropriate timing of stream-checking and connection-checking methods, particularly when power-constrained devices are being used (e.g., in mobile environments).

建议实施者支持他们认为合适的流检查和连接检查方法,但要仔细权衡这些方法对网络的影响与及时发现断流和死TCP连接的好处。使用任何特定检查之间的时间长度在很大程度上取决于本地服务策略,并在很大程度上取决于给定部署和连接类型的网络环境和使用场景。在撰写本文时,建议每5分钟执行一次此类检查,最好由客户机而不是服务器启动此类检查。鼓励那些实施XMPP软件和部署XMPP服务的人就流检查和连接检查方法的适当时机寻求其他建议,特别是在使用功率受限的设备时(例如,在移动环境中)。

4.7. Stream Attributes
4.7. 流属性

The attributes of the root <stream/> element are defined in the following sections.

根<stream/>元素的属性在以下部分中定义。

Security Warning: Until and unless the confidentiality and integrity of the stream are protected via TLS as described under Section 5 or an equivalent security layer (such as the SASL GSSAPI mechanism), the attributes provided in a stream header could be tampered with by an attacker.

安全警告:除非通过第5节所述的TLS或等效安全层(如SASL GSSAPI机制)保护流的机密性和完整性,否则攻击者可能会篡改流头中提供的属性。

Implementation Note: The attributes of the root <stream/> element are not prepended by a namespace prefix because, as explained in [XML-NAMES], "[d]efault namespace declarations do not apply directly to attribute names; the interpretation of unprefixed attributes is determined by the element on which they appear."

实现说明:根<stream/>元素的属性没有名称空间前缀,因为如[XML-NAMES]中所述,“[d]默认名称空间声明不直接应用于属性名称;未固定属性的解释由它们出现的元素确定。”

4.7.1. from
4.7.1. 从…起

The 'from' attribute specifies an XMPP identity of the entity sending the stream element.

“from”属性指定发送流元素的实体的XMPP标识。

For initial stream headers in client-to-server communication, the 'from' attribute is the XMPP identity of the principal controlling the client, i.e., a JID of the form <localpart@domainpart>. The client might not know the XMPP identity, e.g., because the XMPP identity is assigned at a level other than the XMPP application layer (as in the Generic Security Service Application Program Interface [GSS-API]) or is derived by the server from information provided by the client (as in some deployments of end-user certificates with the SASL EXTERNAL mechanism). Furthermore, if the client considers the XMPP identity to be private information then it is advised not to include a 'from' attribute before the confidentiality and integrity of the stream are protected via TLS or an equivalent security layer. However, if the client knows the XMPP identity then it SHOULD include the 'from' attribute after the confidentiality and integrity of the stream are protected via TLS or an equivalent security layer.

对于客户端到服务器通信中的初始流头,“from”属性是控制客户端的主体的XMPP标识,即表单的JID<localpart@domainpart>. 客户端可能不知道XMPP标识,例如,因为XMPP标识是在XMPP应用层以外的级别分配的(如在通用安全服务应用程序接口[GSS-API]中),或者是由服务器根据客户端提供的信息派生的(与使用SASL外部机制的最终用户证书的某些部署一样)。此外,如果客户端认为XMPP标识是私人信息,则建议在通过TLS或等效安全层保护流的机密性和完整性之前不要包含“发件人”属性。但是,如果客户端知道XMPP标识,则应在co之后包含“发件人”属性通过TLS或等效安全层保护流的身份和完整性。

   I: <?xml version='1.0'?>
      <stream:stream
          from='juliet@im.example.com'
          to='im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   I: <?xml version='1.0'?>
      <stream:stream
          from='juliet@im.example.com'
          to='im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        

For initial stream headers in server-to-server communication, the 'from' attribute is one of the configured FQDNs of the server, i.e., a JID of the form <domainpart>. The initiating server might have more than one XMPP identity, e.g., in the case of a server that provides virtual hosting, so it will need to choose an identity that is associated with this output stream (e.g., based on the 'to' attribute of the stanza that triggered the stream negotiation attempt). Because a server is a "public entity" on the XMPP network, it MUST include the 'from' attribute after the confidentiality and integrity of the stream are protected via TLS or an equivalent security layer.

对于服务器到服务器通信中的初始流头,“from”属性是服务器配置的FQDN之一,即形式为<domainpart>的JID。发起服务器可能有多个XMPP标识,例如,在提供虚拟主机的服务器的情况下,因此需要选择与此输出流关联的标识(例如,基于触发流协商尝试的节的“to”属性)。由于服务器是XMPP网络上的“公共实体”,因此在通过TLS或等效安全层保护流的机密性和完整性之后,它必须包含“from”属性。

   I: <?xml version='1.0'?>
      <stream:stream
          from='example.net'
          to='im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:server'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   I: <?xml version='1.0'?>
      <stream:stream
          from='example.net'
          to='im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:server'
          xmlns:stream='http://etherx.jabber.org/streams'>
        

For response stream headers in both client-to-server and server-to-server communication, the receiving entity MUST include the 'from' attribute and MUST set its value to one of the receiving entity's FQDNs (which MAY be an FQDN other than that specified in the 'to' attribute of the initial stream header, as described under Section 4.9.1.3 and Section 4.9.3.6).

对于客户端到服务器和服务器到服务器通信中的响应流标头,接收实体必须包含“发件人”属性,并且必须将其值设置为接收实体的FQDN之一(如第4.9.1.3节和第4.9.3.6节所述,该FQDN可能不是在初始流标头的“to”属性中指定的FQDN)。

   R: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   R: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        

Whether or not the 'from' attribute is included, each entity MUST verify the identity of the other entity before exchanging XML stanzas with it, as described under Section 13.5.

无论是否包含“from”属性,每个实体都必须在与其交换XML节之前验证另一个实体的身份,如第13.5节所述。

Interoperability Note: It is possible that implementations based on [RFC3920] will not include the 'from' address on any stream headers (even ones whose confidentiality and integrity are protected); an entity SHOULD be liberal in accepting such stream headers.

互操作性说明:基于[RFC3920]的实现可能不包括任何流头上的“发件人”地址(即使是机密性和完整性受到保护的流头);实体在接受这样的流头时应该是自由的。

4.7.2. to
4.7.2. 到

For initial stream headers in both client-to-server and server-to-server communication, the initiating entity MUST include the 'to' attribute and MUST set its value to a domainpart that the initiating entity knows or expects the receiving entity to service. (The same information can be provided in other ways, such as a Server Name Indication during TLS negotiation as described in [TLS-EXT].)

对于客户端到服务器和服务器到服务器通信中的初始流头,发起实体必须包含“to”属性,并且必须将其值设置为发起实体知道或期望接收实体服务的domainpart。(可以通过其他方式提供相同的信息,如[TLS-EXT]中所述的TLS协商期间的服务器名称指示。)

   I: <?xml version='1.0'?>
      <stream:stream
          from='juliet@im.example.com'
          to='im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   I: <?xml version='1.0'?>
      <stream:stream
          from='juliet@im.example.com'
          to='im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        

For response stream headers in client-to-server communication, if the client included a 'from' attribute in the initial stream header then the server MUST include a 'to' attribute in the response stream

对于客户端到服务器通信中的响应流标头,如果客户端在初始流标头中包含“from”属性,则服务器必须在响应流中包含“to”属性

header and MUST set its value to the bare JID specified in the 'from' attribute of the initial stream header. If the client did not include a 'from' attribute in the initial stream header then the server MUST NOT include a 'to' attribute in the response stream header.

并且必须将其值设置为初始流标头的“from”属性中指定的裸JID。如果客户端未在初始流标头中包含“from”属性,则服务器不得在响应流标头中包含“to”属性。

   R: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   R: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        

For response stream headers in server-to-server communication, the receiving entity MUST include a 'to' attribute in the response stream header and MUST set its value to the domainpart specified in the 'from' attribute of the initial stream header.

对于服务器到服务器通信中的响应流标头,接收实体必须在响应流标头中包含“to”属性,并且必须将其值设置为初始流标头的“from”属性中指定的domainpart。

   R: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='g4qSvGvBxJ+xeAd7QKezOQJFFlw='
          to='example.net'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:server'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   R: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='g4qSvGvBxJ+xeAd7QKezOQJFFlw='
          to='example.net'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:server'
          xmlns:stream='http://etherx.jabber.org/streams'>
        

Whether or not the 'to' attribute is included, each entity MUST verify the identity of the other entity before exchanging XML stanzas with it, as described under Section 13.5.

无论是否包含“to”属性,每个实体都必须在与其交换XML节之前验证另一个实体的身份,如第13.5节所述。

Interoperability Note: It is possible that implementations based on [RFC3920] will not include the 'to' address on stream headers; an entity SHOULD be liberal in accepting such stream headers.

互操作性说明:基于[RFC3920]的实现可能不包括流头上的“to”地址;实体在接受这样的流头时应该是自由的。

4.7.3. id
4.7.3. 身份证件

The 'id' attribute specifies a unique identifier for the stream, called a "stream ID". The stream ID MUST be generated by the receiving entity when it sends a response stream header and MUST BE unique within the receiving application (normally a server).

“id”属性指定流的唯一标识符,称为“流id”。流ID必须由接收实体在发送响应流头时生成,并且在接收应用程序(通常是服务器)中必须是唯一的。

Security Warning: The stream ID MUST be both unpredictable and non-repeating because it can be security-critical when reused by an authentication mechanisms, as is the case for Server Dialback [XEP-0220] and the "XMPP 0.9" authentication mechanism used before RFC 3920 defined the use of SASL in XMPP; for recommendations regarding randomness for security purposes, see [RANDOM].

安全警告:流ID必须既不可预测又不重复,因为它在被身份验证机制重用时可能是安全关键的,就像RFC 3920定义在XMPP中使用SASL之前使用的服务器回拨[XEP-0220]和“XMPP 0.9”身份验证机制一样;有关出于安全目的的随机性的建议,请参阅[随机]。

For initial stream headers, the initiating entity MUST NOT include the 'id' attribute; however, if the 'id' attribute is included, the receiving entity MUST ignore it.

对于初始流头,发起实体不得包含“id”属性;但是,如果包含“id”属性,则接收实体必须忽略它。

For response stream headers, the receiving entity MUST include the 'id' attribute.

对于响应流头,接收实体必须包含“id”属性。

   R: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   R: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        

Interoperability Note: In RFC 3920, the text regarding inclusion of the 'id' attribute was ambiguous, leading some implementations to leave the attribute off the response stream header.

互操作性说明:在RFC3920中,关于包含“id”属性的文本是不明确的,导致一些实现将该属性从响应流标题中删除。

4.7.4. xml:lang
4.7.4. xml:lang

The 'xml:lang' attribute specifies an entity's preferred or default language for any human-readable XML character data to be sent over the stream (an XML stanza can also possess an 'xml:lang' attribute, as discussed under Section 8.1.5). The syntax of this attribute is defined in Section 2.12 of [XML]; in particular, the value of the 'xml:lang' attribute MUST conform to the NMTOKEN datatype (as defined in Section 2.3 of [XML]) and MUST conform to the language identifier format defined in [LANGTAGS].

“xml:lang”属性为通过流发送的任何人类可读的xml字符数据指定实体的首选或默认语言(xml节也可以具有“xml:lang”属性,如第8.1.5节所述)。该属性的语法在[XML]的第2.12节中定义;特别是,“xml:lang”属性的值必须符合NMTOKEN数据类型(如[xml]第2.3节所定义),并且必须符合[LANGTAGS]中定义的语言标识符格式。

For initial stream headers, the initiating entity SHOULD include the 'xml:lang' attribute.

对于初始流头,发起实体应该包含“xml:lang”属性。

   I: <?xml version='1.0'?>
      <stream:stream
          from='juliet@im.example.com'
          to='im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   I: <?xml version='1.0'?>
      <stream:stream
          from='juliet@im.example.com'
          to='im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        

For response stream headers, the receiving entity MUST include the 'xml:lang' attribute. The following rules apply:

对于响应流头,接收实体必须包含“xml:lang”属性。以下规则适用:

o If the initiating entity included an 'xml:lang' attribute in its initial stream header and the receiving entity supports that language in the human-readable XML character data that it generates and sends to the initiating entity (e.g., in the <text/> element for stream and stanza errors), the value of the 'xml:lang' attribute MUST be the identifier for the initiating entity's preferred language (e.g., "de-CH").

o 如果发起实体在其初始流标头中包含“xml:lang”属性,并且接收实体在其生成并发送给发起实体的人类可读xml字符数据中支持该语言(例如,在流和节错误的<text/>元素中),“xml:lang”属性的值必须是发起实体首选语言(例如,“de-CH”)的标识符。

o If the receiving entity supports a language that matches the initiating entity's preferred language according to the "lookup scheme" specified in Section 3.4 of [LANGMATCH] (e.g., "de" instead of "de-CH"), then the value of the 'xml:lang' attribute SHOULD be the identifier for the matching language.

o 如果接收实体根据[LANGMATCH]第3.4节规定的“查找方案”支持与发起实体首选语言匹配的语言(例如,“de”而不是“de CH”),则“xml:lang”属性的值应为匹配语言的标识符。

o If the receiving entity does not support the initiating entity's preferred language or a matching language according to the lookup scheme (or if the initiating entity did not include the 'xml:lang' attribute in its initial stream header), then the value of the 'xml:lang' attribute MUST be the identifier for the default language of the receiving entity (e.g., "en").

o 如果接收实体不支持发起实体的首选语言或根据查找方案的匹配语言(或者发起实体在其初始流标头中未包含“xml:lang”属性),然后,“xml:lang”属性的值必须是接收实体的默认语言(例如,“en”)的标识符。

   R: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   R: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        

If the initiating entity included the 'xml:lang' attribute in its initial stream header, the receiving entity SHOULD remember that value as the default xml:lang for all stanzas sent by the initiating entity over the current stream. As described under Section 8.1.5,

如果发起实体在其初始流标头中包含“xml:lang”属性,则接收实体应记住该值作为发起实体在当前流上发送的所有节的默认xml:lang。如第8.1.5节所述,

the initiating entity MAY include the 'xml:lang' attribute in any XML stanzas it sends over the stream. If the initiating entity does not include the 'xml:lang' attribute in any such stanza, the receiving entity SHOULD add the 'xml:lang' attribute to the stanza when routing it to a remote server or delivering it to a connected client, where the value of the attribute MUST be the identifier for the language preferred by the initiating entity (even if the receiving entity does not support that language for human-readable XML character data it generates and sends to the initiating entity, such as in stream or stanza errors). If the initiating entity includes the 'xml:lang' attribute in any such stanza, the receiving entity MUST NOT modify or delete it when routing it to a remote server or delivering it to a connected client.

发起实体可以在其通过流发送的任何xml节中包含“xml:lang”属性。如果发起实体未在任何此类节中包含“xml:lang”属性,则接收实体应在将“xml:lang”属性路由到远程服务器或将其传送到连接的客户端时将其添加到该节中,其中该属性的值必须是发起实体首选语言的标识符(即使接收实体对于人类可读的XML字符数据不支持该语言,它也会生成并发送给发起实体,例如流内或节内错误)。如果发起实体在任何此类节中包含“xml:lang”属性,则接收实体在将其路由到远程服务器或将其传送到连接的客户端时,不得修改或删除该属性。

4.7.5. version
4.7.5. 版本

The inclusion of the version attribute set to a value of at least "1.0" signals support for the stream-related protocols defined in this specification, including TLS negotiation (Section 5), SASL negotiation (Section 6), stream features (Section 4.3.2), and stream errors (Section 4.9).

将版本属性设置为至少“1.0”的值表示支持本规范中定义的流相关协议,包括TLS协商(第5节)、SASL协商(第6节)、流特性(第4.3.2节)和流错误(第4.9节)。

The version of XMPP specified in this specification is "1.0"; in particular, XMPP 1.0 encapsulates the stream-related protocols as well as the basic semantics of the three defined XML stanza types (<message/>, <presence/>, and <iq/> as described under Sections 8.2.1, 8.2.2, and 8.2.3, respectively).

本规范中规定的XMPP版本为“1.0”;特别是,XMPP 1.0封装了与流相关的协议以及三种定义的XML节类型的基本语义(<message/>、<presence/>和<iq/>,分别如第8.2.1、8.2.2和8.2.3节所述)。

The numbering scheme for XMPP versions is "<major>.<minor>". The major and minor numbers MUST be treated as separate integers and each number MAY be incremented higher than a single digit. Thus, "XMPP 2.4" would be a lower version than "XMPP 2.13", which in turn would be lower than "XMPP 12.3". Leading zeros (e.g., "XMPP 6.01") MUST be ignored by recipients and MUST NOT be sent.

XMPP版本的编号方案为“<major><minor>”。主数字和次数字必须被视为独立的整数,每个数字的增量可以大于一个位数。因此,“XMPP2.4”的版本低于“XMPP2.13”,而“XMPP2.13”的版本又低于“XMPP12.3”。收件人必须忽略前导零(例如,“XMPP 6.01”),并且不得发送前导零。

The major version number will be incremented only if the stream and stanza formats or obligatory actions have changed so dramatically that an older version entity would not be able to interoperate with a newer version entity if it simply ignored the elements and attributes it did not understand and took the actions defined in the older specification.

只有当流和节格式或强制操作发生了如此显著的变化,以至于旧版本实体如果忽略它不理解的元素和属性并执行旧版本实体中定义的操作,就无法与新版本实体进行互操作时,主版本号才会增加规格

The minor version number will be incremented only if significant new capabilities have been added to the core protocol (e.g., a newly defined value of the 'type' attribute for message, presence, or IQ stanzas). The minor version number MUST be ignored by an entity with a smaller minor version number, but MAY be used for informational purposes by the entity with the larger minor version number (e.g.,

只有在核心协议中添加了重要的新功能(例如,消息、状态或IQ节的“type”属性的新定义值)时,次要版本号才会增加。次要版本号必须被次要版本号较小的实体忽略,但可能被次要版本号较大的实体用于信息目的(例如。,

the entity with the larger minor version number would simply note that its correspondent would not be able to understand that value of the 'type' attribute and therefore would not send it).

具有较大次要版本号的实体只会注意到其对应者无法理解“type”属性的值,因此不会发送它)。

The following rules apply to the generation and handling of the 'version' attribute within stream headers:

以下规则适用于流标头中“版本”属性的生成和处理:

1. The initiating entity MUST set the value of the 'version' attribute in the initial stream header to the highest version number it supports (e.g., if the highest version number it supports is that defined in this specification, it MUST set the value to "1.0").

1. 发起实体必须将初始流标头中“版本”属性的值设置为其支持的最高版本号(例如,如果其支持的最高版本号是本规范中定义的版本号,则必须将该值设置为“1.0”)。

2. The receiving entity MUST set the value of the 'version' attribute in the response stream header to either the value supplied by the initiating entity or the highest version number supported by the receiving entity, whichever is lower. The receiving entity MUST perform a numeric comparison on the major and minor version numbers, not a string match on "<major>.<minor>".

2. 接收实体必须将响应流标头中“版本”属性的值设置为发起实体提供的值或接收实体支持的最高版本号,以较低者为准。接收实体必须对主版本号和次版本号执行数字比较,而不是“<major><minor>”上的字符串匹配。

3. If the version number included in the response stream header is at least one major version lower than the version number included in the initial stream header and newer version entities cannot interoperate with older version entities as described, the initiating entity SHOULD close the stream with an <unsupported-version/> stream error (Section 4.9.3.25).

3. 如果响应流标头中包含的版本号至少比初始流标头中包含的版本号低一个主版本,且较新版本实体无法与较旧版本实体进行如上所述的互操作,则发起实体应关闭流,并出现<unsupported version/>流错误(第4.9.3.25节)。

4. If either entity receives a stream header with no 'version' attribute, the entity MUST consider the version supported by the other entity to be "0.9" and SHOULD NOT include a 'version' attribute in the response stream header.

4. 如果任一实体接收到没有“版本”属性的流标头,则实体必须考虑由另一实体支持的版本为“0.9”,并且不应在响应流标题中包括“版本”属性。

4.7.6. Summary of Stream Attributes
4.7.6. 流属性摘要

The following table summarizes the attributes of the root <stream/> element.

下表总结了根<stream/>元素的属性。

   +----------+--------------------------+-------------------------+
   |          | initiating to receiving  | receiving to initiating |
   +----------+--------------------------+-------------------------+
   | to       | JID of receiver          | JID of initiator        |
   | from     | JID of initiator         | JID of receiver         |
   | id       | ignored                  | stream identifier       |
   | xml:lang | default language         | default language        |
   | version  | XMPP 1.0+ supported      | XMPP 1.0+ supported     |
   +----------+--------------------------+-------------------------+
        
   +----------+--------------------------+-------------------------+
   |          | initiating to receiving  | receiving to initiating |
   +----------+--------------------------+-------------------------+
   | to       | JID of receiver          | JID of initiator        |
   | from     | JID of initiator         | JID of receiver         |
   | id       | ignored                  | stream identifier       |
   | xml:lang | default language         | default language        |
   | version  | XMPP 1.0+ supported      | XMPP 1.0+ supported     |
   +----------+--------------------------+-------------------------+
        

Figure 4: Stream Attributes

图4:流属性

4.8. XML Namespaces
4.8. XML名称空间

Readers are referred to the specification of XML namespaces [XML-NAMES] for a full understanding of the concepts used in this section, especially the concept of a "default namespace" as provided in Section 3 and Section 6.2 of that specification.

读者可以参考XML名称空间规范[XML-NAMES],以全面了解本节中使用的概念,特别是该规范第3节和第6.2节中提供的“默认名称空间”概念。

4.8.1. Stream Namespace
4.8.1. 流名称空间

The root <stream/> element ("stream header") MUST be qualified by the namespace 'http://etherx.jabber.org/streams' (the "stream namespace"). If this rule is violated, the entity that receives the offending stream header MUST close the stream with a stream error, which SHOULD be <invalid-namespace/> (Section 4.9.3.10), although some existing implementations send <bad-format/> (Section 4.9.3.1) instead.

根<stream/>元素(“stream header”)必须由命名空间的http://etherx.jabber.org/streams“(“流名称空间”)。如果违反此规则,则接收有问题的流标头的实体必须关闭带有流错误的流,该错误应为<invalid namespace/>(第4.9.3.10节),尽管某些现有实现会发送<bad format/>(第4.9.3.1节)。

4.8.2. Content Namespace
4.8.2. 内容命名空间

An entity MAY declare a "content namespace" as the default namespace for data sent over the stream (i.e., data other than elements qualified by the stream namespace). If so, (1) the content namespace MUST be other than the stream namespace, and (2) the content namespace MUST be the same for the initial stream and the response stream so that both streams are qualified consistently. The content namespace applies to all first-level child elements sent over the stream unless explicitly qualified by another namespace (i.e., the content namespace is the default namespace).

实体可以声明“内容命名空间”作为通过流发送的数据的默认命名空间(即,流命名空间限定的元素以外的数据)。如果是这样,(1)内容名称空间必须不是流名称空间,(2)内容名称空间对于初始流和响应流必须是相同的,以便两个流一致地被限定。内容名称空间应用于通过流发送的所有第一级子元素,除非由另一个名称空间明确限定(即,内容名称空间是默认名称空间)。

Alternatively (i.e., instead of declaring the content namespace as the default namespace), an entity MAY explicitly qualify the namespace for each first-level child element of the stream, using so-called "prefix-free canonicalization". These two styles are shown in the following examples.

或者(即,不将内容名称空间声明为默认名称空间),实体可以使用所谓的“无前缀规范化”为流的每个第一级子元素显式限定名称空间。以下示例中显示了这两种样式。

When a content namespace is declared as the default namespace, in rough outline a stream will look something like the following.

当一个内容名称空间被声明为默认名称空间时,一个流的大致轮廓如下所示。

   <stream:stream
       from='juliet@im.example.com'
       to='im.example.com'
       version='1.0'
       xml:lang='en'
       xmlns='jabber:client'
       xmlns:stream='http://etherx.jabber.org/streams'>
     <message>
       <body>foo</body>
     </message>
   </stream:stream>
        
   <stream:stream
       from='juliet@im.example.com'
       to='im.example.com'
       version='1.0'
       xml:lang='en'
       xmlns='jabber:client'
       xmlns:stream='http://etherx.jabber.org/streams'>
     <message>
       <body>foo</body>
     </message>
   </stream:stream>
        

When a content namespace is not declared as the default namespace and so-called "prefix-free canonicalization" is used instead, in rough outline a stream will look something like the following.

当一个内容名称空间没有声明为默认名称空间,而是使用了所谓的“无前缀规范化”时,在粗略的轮廓中,流将如下所示。

   <stream
       from='juliet@im.example.com'
       to='im.example.com'
       version='1.0'
       xml:lang='en'
       xmlns='http://etherx.jabber.org/streams'>
     <message xmlns='jabber:client'>
       <body>foo</body>
     </message>
   </stream>
        
   <stream
       from='juliet@im.example.com'
       to='im.example.com'
       version='1.0'
       xml:lang='en'
       xmlns='http://etherx.jabber.org/streams'>
     <message xmlns='jabber:client'>
       <body>foo</body>
     </message>
   </stream>
        

Traditionally, most XMPP implementations have used the content-namespace-as-default-namespace style rather than the prefix-free canonicalization style for stream headers; however, both styles are acceptable since they are semantically equivalent.

传统上,大多数XMPP实现都将内容名称空间用作流头的默认名称空间样式,而不是无前缀规范化样式;但是,这两种样式都是可以接受的,因为它们在语义上是等价的。

4.8.3. XMPP Content Namespaces
4.8.3. XMPP内容名称空间

XMPP as defined in this specification uses two content namespaces: 'jabber:client' and 'jabber:server'. These namespaces are nearly identical but are used in different contexts (client-to-server communication for 'jabber:client' and server-to-server communication for 'jabber:server'). The only difference between the two is that

本规范中定义的XMPP使用两个内容名称空间:“jabber:client”和“jabber:server”。这些名称空间几乎相同,但在不同的上下文中使用(“jabber:client”的客户端到服务器通信和“jabber:server”的服务器到服务器通信)。两者之间的唯一区别是

the 'to' and 'from' attributes are OPTIONAL on stanzas sent over XML streams qualified by the 'jabber:client' namespace, whereas they are REQUIRED on stanzas sent over XML streams qualified by the 'jabber: server' namespace. Support for these content namespaces implies support for the common attributes (Section 8.1) and basic semantics (Section 8.2) of all three core stanza types (message, presence, and IQ).

“to”和“from”属性在通过“jabber:client”命名空间限定的XML流发送的节上是可选的,而在通过“jabber:server”命名空间限定的XML流发送的节上则是必需的。对这些内容名称空间的支持意味着对所有三种核心节类型(消息、状态和IQ)的公共属性(第8.1节)和基本语义(第8.2节)的支持。

An implementation MAY support content namespaces other than 'jabber: client' or 'jabber:server'. However, because such namespaces would define applications other than XMPP, they are to be defined in separate specifications.

实现可能支持“jabber:client”或“jabber:server”以外的内容命名空间。但是,由于此类名称空间将定义XMPP以外的应用程序,因此它们将在单独的规范中定义。

An implementation MAY refuse to support any other content namespaces as default namespaces. If an entity receives a first-level child element qualified by a content namespace it does not support, it MUST close the stream with an <invalid-namespace/> stream error (Section 4.9.3.10).

实现可能拒绝支持任何其他内容名称空间作为默认名称空间。如果实体接收到由其不支持的内容命名空间限定的第一级子元素,则必须使用<invalid namespace/>流错误关闭流(第4.9.3.10节)。

Client implementations MUST support the 'jabber:client' content namespace as a default namespace. The 'jabber:server' content namespace is out of scope for an XMPP client, and a client MUST NOT send stanzas qualified by the 'jabber:server' namespace.

客户端实现必须支持“jabber:Client”内容命名空间作为默认命名空间。“jabber:server”内容命名空间不在XMPP客户端的范围内,客户端不能发送由“jabber:server”命名空间限定的节。

Server implementations MUST support as default content namespaces both the 'jabber:client' namespace (when the stream is used for communication between a client and a server) and the 'jabber:server' namespace (when the stream is used for communication between two servers). When communicating with a connected client, a server MUST NOT send stanzas qualified by the 'jabber:server' namespace; when communicating with a peer server, a server MUST NOT send stanzas qualified by the 'jabber:client' namespace.

服务器实现必须支持“jabber:client”命名空间(当流用于客户端和服务器之间的通信时)和“jabber:Server”命名空间(当流用于两台服务器之间的通信时),作为默认内容命名空间。当与连接的客户端通信时,服务器不得发送由“jabber:server”命名空间限定的节;与对等服务器通信时,服务器不得发送由“jabber:client”命名空间限定的节。

      Implementation Note: Because a client sends stanzas over a stream
      whose content namespace is 'jabber:client', if a server routes to
      a peer server a stanza it has received from a connected client
      then it needs to "re-scope" the stanza so that its content
      namespace is 'jabber:server'.  Similarly, if a server delivers to
      a connected client a stanza it has received from a peer server
      then it needs to "re-scope" the stanza so that its content
      namespace is 'jabber:client'.  This rule applies to XML stanzas as
      defined under Section 4.1 (i.e., a first-level <message/>,
      <presence/>, or <iq/> element qualified by the 'jabber:client' or
      'jabber:server' namespace), and by namespace inheritance to all
      child elements of a stanza.  However, the rule does not apply to
      elements qualified by namespaces other than 'jabber:client' and
      'jabber:server' nor to any children of such elements (e.g., a
      <message/> element contained within an extension element
        
      Implementation Note: Because a client sends stanzas over a stream
      whose content namespace is 'jabber:client', if a server routes to
      a peer server a stanza it has received from a connected client
      then it needs to "re-scope" the stanza so that its content
      namespace is 'jabber:server'.  Similarly, if a server delivers to
      a connected client a stanza it has received from a peer server
      then it needs to "re-scope" the stanza so that its content
      namespace is 'jabber:client'.  This rule applies to XML stanzas as
      defined under Section 4.1 (i.e., a first-level <message/>,
      <presence/>, or <iq/> element qualified by the 'jabber:client' or
      'jabber:server' namespace), and by namespace inheritance to all
      child elements of a stanza.  However, the rule does not apply to
      elements qualified by namespaces other than 'jabber:client' and
      'jabber:server' nor to any children of such elements (e.g., a
      <message/> element contained within an extension element
        

(Section 8.4) for reporting purposes). Although it is not forbidden for an entity to generate stanzas in which an extension element contains a child element qualified by the 'jabber:client' or 'jabber:server' namespace, existing implementations handle such stanzas inconsistently; therefore, implementers are advised to weigh the likely lack of interoperability against the possible utility of such stanzas. Finally, servers are advised to apply stanza re-scoping to other stream connection methods and alternative XMPP connection methods, such as those specified in [XEP-0124], [XEP-0206], [XEP-0114], and [XEP-0225].

(第8.4节)用于报告目的)。虽然实体不禁止生成扩展元素包含由“jabber:client”或“jabber:server”命名空间限定的子元素的节,但现有实现处理此类节的方式不一致;因此,建议实施者权衡可能缺乏互操作性与此类节的可能效用。最后,建议服务器将节重定范围应用于其他流连接方法和替代XMPP连接方法,如[XEP-0124]、[XEP-0206]、[XEP-0114]和[XEP-0225]中规定的方法。

4.8.4. Other Namespaces
4.8.4. 其他名称空间

Either party to a stream MAY send data qualified by namespaces other than the content namespace and the stream namespace. For example, this is how data related to TLS negotiation and SASL negotiation are exchanged, as well as XMPP extensions such as Stream Management [XEP-0198] and Server Dialback [XEP-0220].

流的任何一方都可以发送由除内容命名空间和流命名空间之外的命名空间限定的数据。例如,这就是与TLS协商和SASL协商以及XMPP扩展(如流管理[XEP-0198]和服务器回拨[XEP-0220])相关的数据交换方式。

Interoperability Note: For historical reasons, some server implementations expect a declaration of the 'jabber:server: dialback' namespace on server-to-server streams, as explained in [XEP-0220].

互操作性说明:出于历史原因,一些服务器实现希望在服务器到服务器流上声明“jabber:server:dialback”命名空间,如[XEP-0220]中所述。

However, an XMPP server MUST NOT route or deliver data received over an input stream if that data is (a) qualified by another namespace and (b) addressed to an entity other than the server, unless the other party to the output stream over which the server would send the data has explicitly negotiated or advertised support for receiving arbitrary data from the server. This rule is included because XMPP is designed for the exchange of XML stanzas (not arbitrary XML data), and because allowing an entity to send arbitrary data to other entities could significantly increase the potential for exchanging malicious information. As an example of this rule, the server hosting the example.net domain would not route the following first-level XML element from <romeo@example.net> to <juliet@example.com>:

但是,如果通过输入流接收的数据(a)由另一个命名空间限定,并且(b)寻址到服务器以外的实体,则XMPP服务器不得路由或传递该数据,除非服务器将通过输出流发送数据的另一方明确协商或公布了对从服务器接收任意数据的支持。之所以包含此规则,是因为XMPP是为交换XML节(而不是任意XML数据)而设计的,并且因为允许实体向其他实体发送任意数据可能会显著增加交换恶意信息的可能性。作为此规则的一个示例,承载example.net域的服务器不会从中路由以下第一级XML元素<romeo@example.net>到<juliet@example.com>:

     <ns1:foo xmlns:ns1='http://example.org/ns1'
              from='romeo@example.net/resource1'
              to='juliet@example.com'>
       <ns1:bar/>
     </ns1:foo>
        
     <ns1:foo xmlns:ns1='http://example.org/ns1'
              from='romeo@example.net/resource1'
              to='juliet@example.com'>
       <ns1:bar/>
     </ns1:foo>
        

This rule also applies to first-level elements that look like stanzas but that are improperly namespaced and therefore really are not stanzas at all (see also Section 4.8.5), for example:

此规则也适用于第一级元素,这些元素看起来像节,但名称空间不正确,因此实际上根本不是节(另请参见第4.8.5节),例如:

     <ns2:message xmlns:ns2='http://example.org/ns2'
                  from='romeo@example.net/resource1'
                  to='juliet@example.com'>
       <body>hi</body>
     </ns2:message>
        
     <ns2:message xmlns:ns2='http://example.org/ns2'
                  from='romeo@example.net/resource1'
                  to='juliet@example.com'>
       <body>hi</body>
     </ns2:message>
        

Upon receiving arbitrary first-level XML elements over an input stream, a server MUST either ignore the data or close the stream with a stream error, which SHOULD be <unsupported-stanza-type/> (Section 4.9.3.24).

在通过输入流接收任意一级XML元素时,服务器必须忽略数据或关闭流,并出现流错误,该错误应为<unsupported stanza type/>(第4.9.3.24节)。

4.8.5. Namespace Declarations and Prefixes
4.8.5. 名称空间声明和前缀

Because the content namespace is other than the stream namespace, if a content namespace is declared as the default namespace then the following statements are true:

由于内容命名空间不是流命名空间,因此如果将内容命名空间声明为默认命名空间,则以下语句为真:

1. The stream header needs to contain a namespace declaration for both the content namespace and the stream namespace.

1. 流标头需要包含内容命名空间和流命名空间的命名空间声明。

2. The stream namespace declaration needs to include a namespace prefix for the stream namespace.

2. 流命名空间声明需要包含流命名空间的命名空间前缀。

Interoperability Note: For historical reasons, an implementation MAY accept only the prefix 'stream' for the stream namespace (resulting in prefixed names such as <stream:stream> and <stream: features>); this specification retains that allowance from [RFC3920] for the purpose of backward compatibility. Implementations are advised that using a prefix other than 'stream' for the stream namespace might result in interoperability problems. If an entity receives a stream header with a stream namespace prefix it does not accept, it MUST close the stream with a stream error, which SHOULD be <bad-namespace-prefix/> (Section 4.9.3.2), although some existing implementations send <bad-format/> (Section 4.9.3.1) instead.

互操作性说明:出于历史原因,实现可能只接受流名称空间的前缀“stream”(导致前缀名称,如<stream:stream>和<stream:features>);为了向后兼容,本规范保留[RFC3920]的容差。建议实现为流命名空间使用“stream”以外的前缀可能会导致互操作性问题。如果实体接收到带有其不接受的流名称空间前缀的流头,则必须使用流错误关闭流,该错误应为<bad namespace prefix/>(第4.9.3.2节),尽管某些现有实现会发送<bad format/>(第4.9.3.1节)。

An implementation MUST NOT generate namespace prefixes for elements qualified by the content namespace (i.e., the default namespace for data sent over the stream) if the content namespace is 'jabber: client' or 'jabber:server'. For example, the following is illegal:

如果内容命名空间为“jabber:client”或“jabber:server”,则实现不得为内容命名空间限定的元素生成命名空间前缀(即通过流发送的数据的默认命名空间)。例如,以下行为是非法的:

   <stream:stream
       from='juliet@im.example.com'
       to='im.example.com'
       version='1.0'
       xml:lang='en'
       xmlns='jabber:client'
       xmlns:stream='http://etherx.jabber.org/streams'>
        
   <stream:stream
       from='juliet@im.example.com'
       to='im.example.com'
       version='1.0'
       xml:lang='en'
       xmlns='jabber:client'
       xmlns:stream='http://etherx.jabber.org/streams'>
        
     <foo:message xmlns:foo='jabber:client'>
       <foo:body>foo</foo:body>
     </foo:message>
        
     <foo:message xmlns:foo='jabber:client'>
       <foo:body>foo</foo:body>
     </foo:message>
        

An XMPP entity SHOULD NOT accept data that violates this rule (in particular, an XMPP server MUST NOT route or deliver such data to another entity without first correcting the error); instead it SHOULD either ignore the data or close the stream with a stream error, which SHOULD be <bad-namespace-prefix/> (Section 4.9.3.2).

XMPP实体不应接受违反此规则的数据(特别是,XMPP服务器在未纠正错误的情况下不得将此类数据路由或交付给其他实体);相反,它应该忽略数据或使用流错误关闭流,流错误应该是<bad namespace prefix/>(第4.9.3.2节)。

Namespaces declared in a stream header MUST apply only to that stream (e.g., the 'jabber:server:dialback' namespace used in Server Dialback [XEP-0220]). In particular, because XML stanzas intended for routing or delivery over streams with other entities will lose the namespace context declared in the header of the stream in which those stanzas originated, namespaces for extended content within such stanzas MUST NOT be declared in that stream header (see also Section 8.4). If either party to a stream declares such namespaces, the other party to the stream SHOULD close the stream with an <invalid-namespace/> stream error (Section 4.9.3.10). In any case, an entity MUST ensure that such namespaces are properly declared (according to this section) when routing or delivering stanzas from an input stream to an output stream.

流标头中声明的命名空间必须仅应用于该流(例如,服务器回拨[XEP-0220]中使用的“jabber:server:dialback”命名空间)。特别是,由于用于通过具有其他实体的流进行路由或传递的XML节将丢失在这些节起源的流标头中声明的命名空间上下文,因此此类节中扩展内容的命名空间不得在该流标头中声明(另请参见第8.4节)。如果流的任何一方声明此类名称空间,则流的另一方应使用<invalid namespace/>流错误关闭流(第4.9.3.10节)。在任何情况下,实体都必须确保在将节从输入流路由或传递到输出流时正确声明了此类名称空间(根据本节)。

4.9. Stream Errors
4.9. 流错误

The root stream element MAY contain an <error/> child element that is qualified by the stream namespace. The error child SHALL be sent by a compliant entity if it perceives that a stream-level error has occurred.

根流元素可能包含由流命名空间限定的<error/>子元素。如果合规实体察觉到发生了流级错误,则应发送错误子项。

4.9.1. Rules
4.9.1. 规则

The following rules apply to stream-level errors.

以下规则适用于流级错误。

4.9.1.1. Stream Errors Are Unrecoverable
4.9.1.1. 流错误是不可恢复的

Stream-level errors are unrecoverable. Therefore, if an error occurs at the level of the stream, the entity that detects the error MUST send an <error/> element with an appropriate child element specifying the error condition and then immediately close the stream as described under Section 4.4.

流级错误不可恢复。因此,如果在流级别发生错误,则检测到错误的实体必须发送一个<error/>元素,该元素带有指定错误条件的适当子元素,然后按照第4.4节所述立即关闭流。

   C: <message><body>No closing tag!</message>
        
   C: <message><body>No closing tag!</message>
        
   S: <stream:error>
        <not-well-formed
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
   S: <stream:error>
        <not-well-formed
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        

The entity that receives the stream error then SHALL close the stream as explained under Section 4.4.

收到流错误的实体应按照第4.4节的说明关闭流。

   C: </stream:stream>
        
   C: </stream:stream>
        
4.9.1.2. Stream Errors Can Occur During Setup
4.9.1.2. 安装过程中可能会发生流错误

If the error is triggered by the initial stream header, the receiving entity MUST still send the opening <stream> tag, include the <error/> element as a child of the stream element, and send the closing </stream> tag (preferably in the same TCP packet).

如果错误是由初始流头触发的,则接收实体仍必须发送开始的<stream>标记,将<error/>元素作为流元素的子元素,并发送结束的<stream>标记(最好在同一TCP数据包中)。

   C: <?xml version='1.0'?>
      <stream:stream
          from='juliet@im.example.com'
          to='im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://wrong.namespace.example.org/'>
        
   C: <?xml version='1.0'?>
      <stream:stream
          from='juliet@im.example.com'
          to='im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://wrong.namespace.example.org/'>
        
   S: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
      <stream:error>
        <invalid-namespace
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
   S: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
      <stream:error>
        <invalid-namespace
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
4.9.1.3. Stream Errors When the Host Is Unspecified or Unknown
4.9.1.3. 主机未指定或未知时的流错误

If the initiating entity provides no 'to' attribute or provides an unknown host in the 'to' attribute and the error occurs during stream setup, the value of the 'from' attribute returned by the receiving entity in the stream header sent before closing the stream MUST be either an authoritative FQDN for the receiving entity or the empty string.

如果发起实体不提供“to”属性或在“to”属性中提供未知主机,并且在流设置期间发生错误,则在关闭流之前发送的流标头中,接收实体返回的“from”属性的值必须是接收实体的权威FQDN或空字符串。

   C: <?xml version='1.0'?>
      <stream:stream
          from='juliet@im.example.com'
          to='unknown.host.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   C: <?xml version='1.0'?>
      <stream:stream
          from='juliet@im.example.com'
          to='unknown.host.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   S: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
      <stream:error>
        <host-unknown
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
   S: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
      <stream:error>
        <host-unknown
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
4.9.1.4. Where Stream Errors Are Sent
4.9.1.4. 发送流错误的位置

When two TCP connections are used between the initiating entity and the receiving entity (one in each direction) rather than using a single bidirectional connection, the following rules apply:

当在发起实体和接收实体之间使用两个TCP连接(每个方向一个)而不是使用单个双向连接时,以下规则适用:

o Stream-level errors related to the initial stream are returned by the receiving entity on the response stream via the same TCP connection.

o 与初始流相关的流级错误由响应流上的接收实体通过相同的TCP连接返回。

o Stanza errors triggered by outbound stanzas sent from the initiating entity over the initial stream via the same TCP connection are returned by the receiving entity on the response stream via the other ("return") TCP connection, since they are inbound stanzas from the perspective of the initiating entity.

o 由发起实体通过相同TCP连接在初始流上发送的出站节触发的节错误由接收实体通过另一个(“返回”)TCP连接在响应流上返回,因为从发起实体的角度来看,它们是入站节。

4.9.2. Syntax
4.9.2. 语法

The syntax for stream errors is as follows, where XML data shown within the square brackets '[' and ']' is OPTIONAL.

流错误的语法如下所示,其中方括号“[”和“]”中显示的XML数据是可选的。

   <stream:error>
     <defined-condition xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
     [<text xmlns='urn:ietf:params:xml:ns:xmpp-streams'
            xml:lang='langcode'>
        OPTIONAL descriptive text
     </text>]
     [OPTIONAL application-specific condition element]
   </stream:error>
        
   <stream:error>
     <defined-condition xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
     [<text xmlns='urn:ietf:params:xml:ns:xmpp-streams'
            xml:lang='langcode'>
        OPTIONAL descriptive text
     </text>]
     [OPTIONAL application-specific condition element]
   </stream:error>
        

The "defined-condition" MUST correspond to one of the stream error conditions defined under Section 4.9.3. However, because additional error conditions might be defined in the future, if an entity receives a stream error condition that it does not understand then it MUST treat the unknown condition as equivalent to <undefined-condition/> (Section 4.9.3.21). If the designers of an XMPP protocol extension or the developers of an XMPP implementation need to communicate a stream error condition that is not defined in this specification, they can do so by defining an application-specific error condition element qualified by an application-specific namespace.

“定义条件”必须对应于第4.9.3节中定义的流错误条件之一。但是,由于将来可能会定义其他错误条件,如果实体收到其不理解的流错误条件,则必须将未知条件视为等同于<undefined condition/>(第4.9.3.21节)。如果XMPP协议扩展的设计人员或XMPP实现的开发人员需要传达本规范中未定义的流错误条件,他们可以通过定义由特定于应用程序的命名空间限定的特定于应用程序的错误条件元素来实现。

The <error/> element:

<error/>元素:

o MUST contain a child element corresponding to one of the defined stream error conditions (Section 4.9.3); this element MUST be qualified by the 'urn:ietf:params:xml:ns:xmpp-streams' namespace.

o 必须包含与定义的流错误条件之一对应的子元素(第4.9.3节);此元素必须由“urn:ietf:params:xml:ns:xmpp streams”命名空间限定。

o MAY contain a <text/> child element containing XML character data that describes the error in more detail; this element MUST be qualified by the 'urn:ietf:params:xml:ns:xmpp-streams' namespace and SHOULD possess an 'xml:lang' attribute specifying the natural language of the XML character data.

o 可能包含<text/>子元素,该子元素包含更详细地描述错误的XML字符数据;此元素必须由“urn:ietf:params:xml:ns:xmpp streams”命名空间限定,并应具有指定xml字符数据的自然语言的“xml:lang”属性。

o MAY contain a child element for an application-specific error condition; this element MUST be qualified by an application-defined namespace, and its structure is defined by that namespace (see Section 4.9.4).

o 可能包含应用程序特定错误条件的子元素;该元素必须由应用程序定义的名称空间限定,其结构由该名称空间定义(参见第4.9.4节)。

The <text/> element is OPTIONAL. If included, it MUST be used only to provide descriptive or diagnostic information that supplements the meaning of a defined condition or application-specific condition. It MUST NOT be interpreted programmatically by an application. It MUST NOT be used as the error message presented to a human user, but MAY

<text/>元素是可选的。如果包括,则必须仅用于提供补充定义条件或特定应用条件含义的描述性或诊断信息。应用程序不能以编程方式解释它。它不能用作向人类用户显示的错误消息,但可能会

be shown in addition to the error message associated with the defined condition element (and, optionally, the application-specific condition element).

除了与定义的条件元素(以及可选的应用程序特定的条件元素)关联的错误消息之外,还将显示。

4.9.3. Defined Stream Error Conditions
4.9.3. 定义的流错误条件

The following stream-level error conditions are defined.

定义了以下流级错误条件。

4.9.3.1. bad-format
4.9.3.1. 格式错误

The entity has sent XML that cannot be processed.

实体已发送无法处理的XML。

(In the following example, the client sends an XMPP message that is not well-formed XML, which alternatively might trigger a <not-well-formed/> stream error (Section 4.9.3.13).)

(在下面的示例中,客户端发送的XMPP消息不是格式良好的XML,这可能会触发<not well format/>流错误(第4.9.3.13节)

   C: <message>
        <body>No closing tag!
      </message>
        
   C: <message>
        <body>No closing tag!
      </message>
        
   S: <stream:error>
        <bad-format
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
   S: <stream:error>
        <bad-format
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        

This error can be used instead of the more specific XML-related errors, such as <bad-namespace-prefix/>, <invalid-xml/>, <not-well-formed/>, <restricted-xml/>, and <unsupported-encoding/>. However, the more specific errors are RECOMMENDED.

可以使用此错误代替更具体的XML相关错误,例如<bad namespace prefix/>、<invalid XML/>、<not well format/>、<restricted XML/>和<unsupported encoding/>。但是,建议使用更具体的错误。

4.9.3.2. bad-namespace-prefix
4.9.3.2. 名称空间前缀错误

The entity has sent a namespace prefix that is unsupported, or has sent no namespace prefix on an element that needs such a prefix (see Section 11.2).

实体已发送不受支持的命名空间前缀,或者未发送需要此类前缀的元素的命名空间前缀(请参阅第11.2节)。

(In the following example, the client specifies a namespace prefix of "foobar" for the XML stream namespace.)

(在下面的示例中,客户端为XML流名称空间指定名称空间前缀“foobar”。)

   C: <?xml version='1.0'?>
      <foobar:stream
          from='juliet@im.example.com'
          to='im.example.com'
          version='1.0'
          xmlns='jabber:client'
          xmlns:foobar='http://etherx.jabber.org/streams'>
        
   C: <?xml version='1.0'?>
      <foobar:stream
          from='juliet@im.example.com'
          to='im.example.com'
          version='1.0'
          xmlns='jabber:client'
          xmlns:foobar='http://etherx.jabber.org/streams'>
        
   S: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
      <stream:error>
        <bad-namespace-prefix
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
   S: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
      <stream:error>
        <bad-namespace-prefix
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
4.9.3.3. conflict
4.9.3.3. 冲突

The server either (1) is closing the existing stream for this entity because a new stream has been initiated that conflicts with the existing stream, or (2) is refusing a new stream for this entity because allowing the new stream would conflict with an existing stream (e.g., because the server allows only a certain number of connections from the same IP address or allows only one server-to-server stream for a given domain pair as a way of helping to ensure in-order processing as described under Section 10.1).

服务器(1)关闭此实体的现有流,因为已启动与现有流冲突的新流;或(2)拒绝此实体的新流,因为允许新流将与现有流冲突(例如,因为服务器只允许从同一IP地址进行一定数量的连接,或者对于给定的域对只允许一个服务器到服务器的流,作为帮助确保按第10.1节所述顺序处理的一种方式)。

   C: <?xml version='1.0'?>
      <stream:stream
          from='juliet@im.example.com'
          to='im.example.com'
          version='1.0'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   C: <?xml version='1.0'?>
      <stream:stream
          from='juliet@im.example.com'
          to='im.example.com'
          version='1.0'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   S: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
      <stream:error>
        <conflict
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
   S: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
      <stream:error>
        <conflict
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        

If a client receives a <conflict/> stream error (Section 4.9.3.3), during the resource binding aspect of its reconnection attempt it MUST NOT blindly request the resourcepart it used during the former session but instead MUST choose a different resourcepart; details are provided under Section 7.

如果客户机收到<conflict/>流错误(第4.9.3.3节),在其重新连接尝试的资源绑定方面,它不得盲目请求在前一个会话期间使用的resourcepart,而是必须选择不同的resourcepart;详情见第7节。

4.9.3.4. connection-timeout
4.9.3.4. 连接超时

One party is closing the stream because it has reason to believe that the other party has permanently lost the ability to communicate over the stream. The lack of ability to communicate can be discovered using various methods, such as whitespace keepalives as specified under Section 4.4, XMPP-level pings as defined in [XEP-0199], and XMPP Stream Management as defined in [XEP-0198].

一方关闭流是因为它有理由相信另一方已经永久性地失去了通过流进行通信的能力。可以使用各种方法发现通信能力的缺乏,如第4.4节规定的空格保留、[XEP-0199]中定义的XMPP级别ping和[XEP-0198]中定义的XMPP流管理。

   P: <stream:error>
        <connection-timeout
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
   P: <stream:error>
        <connection-timeout
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        

Interoperability Note: RFC 3920 specified that the <connection-timeout/> stream error (Section 4.9.3.4) is to be used if the peer has not generated any traffic over the stream for some period of time. That behavior is no longer recommended; instead, the error SHOULD be used only if the connected client or peer server has not responded to data sent over the stream.

互操作性说明:RFC 3920规定,如果对等方在一段时间内没有在流上生成任何流量,则将使用<connection timeout/>流错误(第4.9.3.4节)。这种行为不再被推荐;相反,仅当连接的客户端或对等服务器未响应通过流发送的数据时,才应使用此错误。

4.9.3.5. host-gone
4.9.3.5. 主人走了

The value of the 'to' attribute provided in the initial stream header corresponds to an FQDN that is no longer serviced by the receiving entity.

初始流标头中提供的“to”属性的值对应于接收实体不再提供服务的FQDN。

(In the following example, the peer specifies a 'to' address of "foo.im.example.com" when connecting to the "im.example.com" server, but the server no longer hosts a service at that address.)

(在下面的示例中,对等方在连接到“im.example.com”服务器时指定“foo.im.example.com”的“to”地址,但该服务器不再在该地址承载服务。)

   P: <?xml version='1.0'?>
      <stream:stream
          from='example.net'
          to='foo.im.example.com'
          version='1.0'
          xmlns='jabber:server'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   P: <?xml version='1.0'?>
      <stream:stream
          from='example.net'
          to='foo.im.example.com'
          version='1.0'
          xmlns='jabber:server'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   S: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='g4qSvGvBxJ+xeAd7QKezOQJFFlw='
          to='example.net'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:server'
          xmlns:stream='http://etherx.jabber.org/streams'>
      <stream:error>
        <host-gone
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
   S: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='g4qSvGvBxJ+xeAd7QKezOQJFFlw='
          to='example.net'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:server'
          xmlns:stream='http://etherx.jabber.org/streams'>
      <stream:error>
        <host-gone
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
4.9.3.6. host-unknown
4.9.3.6. 主机未知

The value of the 'to' attribute provided in the initial stream header does not correspond to an FQDN that is serviced by the receiving entity.

初始流标头中提供的“to”属性的值与接收实体提供服务的FQDN不对应。

(In the following example, the peer specifies a 'to' address of "example.org" when connecting to the "im.example.com" server, but the server knows nothing of that address.)

(在下面的示例中,对等方在连接到“im.example.com”服务器时指定了“example.org”的“to”地址,但服务器对该地址一无所知。)

   P: <?xml version='1.0'?>
      <stream:stream
          from='example.net'
          to='example.org'
          version='1.0'
          xmlns='jabber:server'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   P: <?xml version='1.0'?>
      <stream:stream
          from='example.net'
          to='example.org'
          version='1.0'
          xmlns='jabber:server'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   S: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='g4qSvGvBxJ+xeAd7QKezOQJFFlw='
          to='example.net'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:server'
          xmlns:stream='http://etherx.jabber.org/streams'>
      <stream:error>
        <host-unknown
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
   S: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='g4qSvGvBxJ+xeAd7QKezOQJFFlw='
          to='example.net'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:server'
          xmlns:stream='http://etherx.jabber.org/streams'>
      <stream:error>
        <host-unknown
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
4.9.3.7. improper-addressing
4.9.3.7. 不当寻址

A stanza sent between two servers lacks a 'to' or 'from' attribute, the 'from' or 'to' attribute has no value, or the value violates the rules for XMPP addresses [XMPP-ADDR].

在两台服务器之间发送的节缺少“to”或“from”属性,“from”或“to”属性没有值,或者该值违反了XMPP地址[XMPP-ADDR]的规则。

(In the following example, the peer sends a stanza without a 'to' address over a server-to-server stream.)

(在下面的示例中,对等方通过服务器到服务器流发送一个没有“to”地址的节。)

   P: <message from='juliet@im.example.com'>
        <body>Wherefore art thou?</body>
      </message>
        
   P: <message from='juliet@im.example.com'>
        <body>Wherefore art thou?</body>
      </message>
        
   S: <stream:error>
        <improper-addressing
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
   S: <stream:error>
        <improper-addressing
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
4.9.3.8. internal-server-error
4.9.3.8. 内部服务器错误

The server has experienced a misconfiguration or other internal error that prevents it from servicing the stream.

服务器遇到错误配置或其他内部错误,无法为流提供服务。

   S: <stream:error>
        <internal-server-error
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
   S: <stream:error>
        <internal-server-error
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
4.9.3.9. invalid-from
4.9.3.9. 无效于

The data provided in a 'from' attribute does not match an authorized JID or validated domain as negotiated (1) between two servers using SASL or Server Dialback, or (2) between a client and a server via SASL authentication and resource binding.

“发件人”属性中提供的数据与授权JID或已验证域不匹配,因为已协商(1)两台服务器之间使用SASL或服务器回拨,或(2)客户端和服务器之间通过SASL身份验证和资源绑定。

(In the following example, a peer that has authenticated only as "example.net" attempts to send a stanza from an address at "example.org".)

(在下面的示例中,仅作为“example.net”进行身份验证的对等方尝试从“example.org”的地址发送节。)

   P: <message from='romeo@example.org' to='juliet@im.example.com'>
        <body>Neither, fair saint, if either thee dislike.</body>
      </message>
        
   P: <message from='romeo@example.org' to='juliet@im.example.com'>
        <body>Neither, fair saint, if either thee dislike.</body>
      </message>
        
   S: <stream:error>
        <invalid-from
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
   S: <stream:error>
        <invalid-from
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
4.9.3.10. invalid-namespace
4.9.3.10. 无效命名空间

The stream namespace name is something other than "http://etherx.jabber.org/streams" (see Section 11.2) or the content namespace declared as the default namespace is not supported (e.g., something other than "jabber:client" or "jabber:server").

流命名空间名称不是“http://etherx.jabber.org/streams“(参见第11.2节)或不支持声明为默认名称空间的内容名称空间(例如,“jabber:client”或“jabber:server”以外的内容名称空间)。

(In the following example, the client specifies a namespace of 'http://wrong.namespace.example.org/' for the stream.)

(在下面的示例中,客户端指定的命名空间为'http://wrong.namespace.example.org/“为了小溪。)

   C: <?xml version='1.0'?>
      <stream:stream
          from='juliet@im.example.com'
          to='im.example.com'
          version='1.0'
          xmlns='jabber:client'
          xmlns:stream='http://wrong.namespace.example.org/'>
        
   C: <?xml version='1.0'?>
      <stream:stream
          from='juliet@im.example.com'
          to='im.example.com'
          version='1.0'
          xmlns='jabber:client'
          xmlns:stream='http://wrong.namespace.example.org/'>
        
   S: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
      <stream:error>
        <invalid-namespace
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
   S: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
      <stream:error>
        <invalid-namespace
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
4.9.3.11. invalid-xml
4.9.3.11. 无效的xml

The entity has sent invalid XML over the stream to a server that performs validation (see Section 11.4).

实体已通过流将无效XML发送到执行验证的服务器(请参阅第11.4节)。

(In the following example, the peer attempts to send an IQ stanza of type "subscribe", but the XML schema defines no such value for the 'type' attribute.)

(在下面的示例中,对等方尝试发送类型为“subscribe”的IQ节,但XML模式没有为“type”属性定义此类值。)

   P: <iq from='example.net'
          id='l3b1vs75'
          to='im.example.com'
          type='subscribe'>
        <ping xmlns='urn:xmpp:ping'/>
      </iq>
        
   P: <iq from='example.net'
          id='l3b1vs75'
          to='im.example.com'
          type='subscribe'>
        <ping xmlns='urn:xmpp:ping'/>
      </iq>
        
   S: <stream:error>
        <invalid-xml
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
   S: <stream:error>
        <invalid-xml
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
4.9.3.12. not-authorized
4.9.3.12. 未授权

The entity has attempted to send XML stanzas or other outbound data before the stream has been authenticated, or otherwise is not authorized to perform an action related to stream negotiation; the receiving entity MUST NOT process the offending data before sending the stream error.

实体试图在流经过身份验证之前发送XML节或其他出站数据,或者未被授权执行与流协商相关的操作;在发送流错误之前,接收实体不得处理有问题的数据。

(In the following example, the client attempts to send XML stanzas before authenticating with the server.)

(在下面的示例中,客户端尝试在与服务器进行身份验证之前发送XML节。)

   C: <?xml version='1.0'?>
      <stream:stream
          from='juliet@im.example.com'
          to='im.example.com'
          version='1.0'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   C: <?xml version='1.0'?>
      <stream:stream
          from='juliet@im.example.com'
          to='im.example.com'
          version='1.0'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   S: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   S: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   C: <message to='romeo@example.net'>
        <body>Wherefore art thou?</body>
      </message>
        
   C: <message to='romeo@example.net'>
        <body>Wherefore art thou?</body>
      </message>
        
   S: <stream:error>
        <not-authorized
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
   S: <stream:error>
        <not-authorized
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
4.9.3.13. not-well-formed
4.9.3.13. 格式不好

The initiating entity has sent XML that violates the well-formedness rules of [XML] or [XML-NAMES].

发起实体发送的XML违反了[XML]或[XML-NAMES]的良好格式规则。

(In the following example, the client sends an XMPP message that is not namespace-well-formed.)

(在下面的示例中,客户端发送的XMPP消息的名称空间格式不正确。)

   C: <message>
        <foo:body>What is this foo?</foo:body>
      </message>
        
   C: <message>
        <foo:body>What is this foo?</foo:body>
      </message>
        
   S: <stream:error>
        <not-well-formed
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
   S: <stream:error>
        <not-well-formed
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        

Interoperability Note: In RFC 3920, the name of this error condition was "xml-not-well-formed" instead of "not-well-formed". The name was changed because the element name <xml-not-well-formed/> violates the constraint from Section 3 of [XML] that "names beginning with a match to (('X'|'x')('M'|'m')('L'|'l')) are reserved for standardization in this or future versions of this specification".

互操作性说明:在RFC3920中,此错误条件的名称是“xml格式不正确”,而不是“格式不正确”。更改名称是因为元素名<xml格式不正确/>违反了[xml]第3节的约束,即“以匹配(('X'|'X')('M'|'M')('L'|'L'))开头的名称在本规范或本规范未来版本中保留用于标准化”。

4.9.3.14. policy-violation
4.9.3.14. 违反政策

The entity has violated some local service policy (e.g., a stanza exceeds a configured size limit); the server MAY choose to specify the policy in the <text/> element or in an application-specific condition element.

实体违反了某些本地服务策略(例如,节超过了配置的大小限制);服务器可以选择在<text/>元素或特定于应用程序的条件元素中指定策略。

(In the following example, the client sends an XMPP message that is too large according to the server's local service policy.)

(在下面的示例中,根据服务器的本地服务策略,客户端发送的XMPP消息太大。)

   C: <message to='juliet@im.example.com' id='foo'>
        <body>[ ... the-emacs-manual ... ]</body>
      </message>
        
   C: <message to='juliet@im.example.com' id='foo'>
        <body>[ ... the-emacs-manual ... ]</body>
      </message>
        
   S: <stream:error>
        <policy-violation
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
        <stanza-too-big xmlns='urn:xmpp:errors'/>
      </stream:error>
        
   S: <stream:error>
        <policy-violation
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
        <stanza-too-big xmlns='urn:xmpp:errors'/>
      </stream:error>
        
   S: </stream:stream>
        
   S: </stream:stream>
        
4.9.3.15. remote-connection-failed
4.9.3.15. 远程连接失败

The server is unable to properly connect to a remote entity that is needed for authentication or authorization (e.g., in certain scenarios related to Server Dialback [XEP-0220]); this condition is not to be used when the cause of the error is within the administrative domain of the XMPP service provider, in which case the <internal-server-error/> condition is more appropriate.

服务器无法正确连接到身份验证或授权所需的远程实体(例如,在与服务器回拨[XEP-0220]相关的某些场景中);当错误原因在XMPP服务提供商的管理域内时,不使用此条件,在这种情况下,<internal server error/>条件更合适。

   C: <?xml version='1.0'?>
      <stream:stream
          from='juliet@im.example.com'
          to='im.example.com'
          version='1.0'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   C: <?xml version='1.0'?>
      <stream:stream
          from='juliet@im.example.com'
          to='im.example.com'
          version='1.0'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   S: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
      <stream:error>
        <remote-connection-failed
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
   S: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
      <stream:error>
        <remote-connection-failed
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
4.9.3.16. reset
4.9.3.16. 重置

The server is closing the stream because it has new (typically security-critical) features to offer, because the keys or certificates used to establish a secure context for the stream have expired or have been revoked during the life of the stream (Section 13.7.2.3), because the TLS sequence number has wrapped (Section 5.3.5), etc. The reset applies to the stream and to any

服务器关闭流是因为它提供了新的(通常是安全关键的)功能,因为用于为流建立安全上下文的密钥或证书在流的生命周期内(第13.7.2.3节)已过期或已撤销,因为TLS序列号已包装(第5.3.5节),等。重置适用于流和任何

security context established for that stream (e.g., via TLS and SASL), which means that encryption and authentication need to be negotiated again for the new stream (e.g., TLS session resumption cannot be used).

为该流建立的安全上下文(例如,通过TLS和SASL),这意味着需要为新流再次协商加密和身份验证(例如,不能使用TLS会话恢复)。

   S: <stream:error>
        <reset
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
   S: <stream:error>
        <reset
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
4.9.3.17. resource-constraint
4.9.3.17. 资源约束

The server lacks the system resources necessary to service the stream.

服务器缺少为流提供服务所需的系统资源。

   C: <?xml version='1.0'?>
      <stream:stream
          from='juliet@im.example.com'
          to='im.example.com'
          version='1.0'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   C: <?xml version='1.0'?>
      <stream:stream
          from='juliet@im.example.com'
          to='im.example.com'
          version='1.0'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   S: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
      <stream:error>
        <resource-constraint
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
   S: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
      <stream:error>
        <resource-constraint
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
4.9.3.18. restricted-xml
4.9.3.18. 受限xml

The entity has attempted to send restricted XML features such as a comment, processing instruction, DTD subset, or XML entity reference (see Section 11.1).

实体试图发送受限的XML功能,如注释、处理指令、DTD子集或XML实体引用(请参见第11.1节)。

(In the following example, the client sends an XMPP message containing an XML comment.)

(在下面的示例中,客户端发送一条包含XML注释的XMPP消息。)

   C: <message to='juliet@im.example.com'>
        <!--<subject/>-->
        <body>This message has no subject.</body>
      </message>
        
   C: <message to='juliet@im.example.com'>
        <!--<subject/>-->
        <body>This message has no subject.</body>
      </message>
        
   S: <stream:error>
        <restricted-xml
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
   S: <stream:error>
        <restricted-xml
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
4.9.3.19. see-other-host
4.9.3.19. 见其他主持人

The server will not provide service to the initiating entity but is redirecting traffic to another host under the administrative control of the same service provider. The XML character data of the <see-other-host/> element returned by the server MUST specify the alternate FQDN or IP address at which to connect, which MUST be a valid domainpart or a domainpart plus port number (separated by the ':' character in the form "domainpart:port"). If the domainpart is the same as the source domain, derived domain, or resolved IPv4 or IPv6 address to which the initiating entity originally connected (differing only by the port number), then the initiating entity SHOULD simply attempt to reconnect at that address. (The format of an IPv6 address MUST follow [IPv6-ADDR], which includes the enclosing the IPv6 address in square brackets '[' and ']' as originally defined by [URI].) Otherwise, the initiating entity MUST resolve the FQDN specified in the <see-other-host/> element as described under Section 3.2.

服务器不会向发起实体提供服务,但正在将流量重定向到同一服务提供商管理控制下的另一台主机。服务器返回的<see other host/>元素的XML字符数据必须指定要连接的备用FQDN或IP地址,该地址必须是有效的domainpart或domainpart加端口号(由“:”字符分隔,格式为“domainpart:port”)。如果domainpart与发起实体最初连接的源域、派生域或解析的IPv4或IPv6地址相同(仅因端口号不同),则发起实体应尝试在该地址重新连接。(IPv6地址的格式必须遵循[IPv6 ADDR],其中包括将IPv6地址括在方括号“[”和“]”中(最初由[URI]定义)。否则,发起实体必须解析第3.2节所述的<see other host/>元素中指定的FQDN。

   C: <?xml version='1.0'?>
      <stream:stream
          from='juliet@im.example.com'
          to='im.example.com'
          version='1.0'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   C: <?xml version='1.0'?>
      <stream:stream
          from='juliet@im.example.com'
          to='im.example.com'
          version='1.0'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   S: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
      <stream:error>
        <see-other-host
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'>
          [2001:41D0:1:A49b::1]:9222
        </see-other-host>
      </stream:error>
      </stream:stream>
        
   S: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
      <stream:error>
        <see-other-host
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'>
          [2001:41D0:1:A49b::1]:9222
        </see-other-host>
      </stream:error>
      </stream:stream>
        

When negotiating a stream with the host to which it has been redirected, the initiating entity MUST apply the same policies it would have applied to the original connection attempt (e.g., a policy requiring TLS), MUST specify the same 'to' address on the initial stream header, and MUST verify the identity of the new host using the same reference identifier(s) it would have used for the original connection attempt (in accordance with [TLS-CERTS]). Even if the receiving entity returns a <see-other-host/> error before the confidentiality and integrity of the stream have been established (thus introducing the possibility of a denial-of-service attack), the fact that the initiating entity needs to verify the identity of the XMPP service based on the same reference identifiers implies that the initiating entity will not connect to a malicious entity. To reduce the possibility of a denial-of-service attack, (a) the receiving entity SHOULD NOT close the stream with a <see-other-host/> stream error until after the confidentiality and integrity of the stream have been protected via TLS or an equivalent security layer (such as the SASL GSSAPI mechanism), and (b) the receiving entity MAY have a policy of following redirects only if it has authenticated the receiving entity. In addition, the initiating entity SHOULD abort the connection attempt after a certain number of successive redirects (e.g., at least 2 but no more than 5).

当与重定向到的主机协商流时,发起实体必须应用与原始连接尝试相同的策略(例如,需要TLS的策略),必须在初始流标头上指定相同的“到”地址,并且必须使用与原始连接尝试相同的参考标识符(根据[TLS-CERTS])验证新主机的身份。即使接收实体在建立流的机密性和完整性之前返回<see other host/>错误(从而引入拒绝服务攻击的可能性),发起实体需要基于相同的引用标识符验证XMPP服务的标识这一事实意味着发起实体将不会连接到恶意实体。为了降低拒绝服务攻击的可能性,(a)在通过TLS或等效安全层(如SASL GSSAPI机制)保护流的机密性和完整性之前,接收实体不应关闭流,并出现<see other host/>流错误;(b)接收实体只有在对接收实体进行了身份验证的情况下,才可以具有遵循重定向的策略。此外,发起实体应在一定数量的连续重定向(例如,至少2次但不超过5次)后中止连接尝试。

4.9.3.20. system-shutdown
4.9.3.20. 系统关闭

The server is being shut down and all active streams are being closed.

服务器正在关闭,所有活动流正在关闭。

   S: <stream:error>
        <system-shutdown
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
   S: <stream:error>
        <system-shutdown
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
4.9.3.21. undefined-condition
4.9.3.21. 未定义条件

The error condition is not one of those defined by the other conditions in this list; this error condition SHOULD NOT be used except in conjunction with an application-specific condition.

错误条件不是此列表中其他条件定义的条件之一;除非与特定于应用程序的条件结合使用,否则不应使用此错误条件。

   S: <stream:error>
        <undefined-condition
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
        <app-error xmlns='http://example.org/ns'/>
      </stream:error>
      </stream:stream>
        
   S: <stream:error>
        <undefined-condition
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
        <app-error xmlns='http://example.org/ns'/>
      </stream:error>
      </stream:stream>
        
4.9.3.22. unsupported-encoding
4.9.3.22. 不支持的编码

The initiating entity has encoded the stream in an encoding that is not supported by the server (see Section 11.6) or has otherwise improperly encoded the stream (e.g., by violating the rules of the [UTF-8] encoding).

发起实体以服务器不支持的编码方式对流进行编码(见第11.6节),或者以其他方式对流进行了不正确的编码(例如,违反[UTF-8]编码规则)。

(In the following example, the client attempts to encode data using UTF-16 instead of UTF-8.)

(在下面的示例中,客户端尝试使用UTF-16而不是UTF-8对数据进行编码。)

   C: <?xml version='1.0' encoding='UTF-16'?>
      <stream:stream
          from='juliet@im.example.com'
          to='im.example.com'
          version='1.0'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   C: <?xml version='1.0' encoding='UTF-16'?>
      <stream:stream
          from='juliet@im.example.com'
          to='im.example.com'
          version='1.0'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   S: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
      <stream:error>
        <unsupported-encoding
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
   S: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
      <stream:error>
        <unsupported-encoding
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
4.9.3.23. unsupported-feature
4.9.3.23. 不支持的功能

The receiving entity has advertised a mandatory-to-negotiate stream feature that the initiating entity does not support, and has offered no other mandatory-to-negotiate feature alongside the unsupported feature.

接收实体公布了发起实体不支持的强制协商流功能,并且在不支持的功能旁边没有提供其他强制协商功能。

(In the following example, the receiving entity requires negotiation of an example feature, but the initiating entity does not support the feature.)

(在以下示例中,接收实体要求协商示例功能,但发起实体不支持该功能。)

   R: <stream:features>
        <example xmlns='urn:xmpp:example'>
          <required/>
        </example>
      </stream:features>
        
   R: <stream:features>
        <example xmlns='urn:xmpp:example'>
          <required/>
        </example>
      </stream:features>
        
   I: <stream:error>
        <unsupported-feature
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
   I: <stream:error>
        <unsupported-feature
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
4.9.3.24. unsupported-stanza-type
4.9.3.24. 不支持节类型

The initiating entity has sent a first-level child of the stream that is not supported by the server, either because the receiving entity does not understand the namespace or because the receiving entity does not understand the element name for the applicable namespace (which might be the content namespace declared as the default namespace).

发起实体已发送服务器不支持的流的第一级子级,这可能是因为接收实体不了解名称空间,或者是因为接收实体不了解适用名称空间(可能是声明为默认名称空间的内容名称空间)的元素名。

(In the following example, the client attempts to send a first-level child element of <pubsub/> qualified by the 'jabber:client' namespace, but the schema for that namespace defines no such element.)

(在下面的示例中,客户端尝试发送由“jabber:client”命名空间限定的<pubsub/>的第一级子元素,但该命名空间的架构没有定义此类元素。)

   C: <pubsub xmlns='jabber:client'>
        <publish node='princely_musings'>
          <item id='ae890ac52d0df67ed7cfdf51b644e901'>
            <entry xmlns='http://www.w3.org/2005/Atom'>
              <title>Soliloquy</title>
              <summary>
   To be, or not to be: that is the question:
   Whether 'tis nobler in the mind to suffer
   The slings and arrows of outrageous fortune,
   Or to take arms against a sea of troubles,
   And by opposing end them?
              </summary>
              <link rel='alternate' type='text/html'
                    href='http://denmark.example/2003/12/13/atom03'/>
              <id>tag:denmark.example,2003:entry-32397</id>
              <published>2003-12-13T18:30:02Z</published>
              <updated>2003-12-13T18:30:02Z</updated>
            </entry>
          </item>
        </publish>
      </pubsub>
        
   C: <pubsub xmlns='jabber:client'>
        <publish node='princely_musings'>
          <item id='ae890ac52d0df67ed7cfdf51b644e901'>
            <entry xmlns='http://www.w3.org/2005/Atom'>
              <title>Soliloquy</title>
              <summary>
   To be, or not to be: that is the question:
   Whether 'tis nobler in the mind to suffer
   The slings and arrows of outrageous fortune,
   Or to take arms against a sea of troubles,
   And by opposing end them?
              </summary>
              <link rel='alternate' type='text/html'
                    href='http://denmark.example/2003/12/13/atom03'/>
              <id>tag:denmark.example,2003:entry-32397</id>
              <published>2003-12-13T18:30:02Z</published>
              <updated>2003-12-13T18:30:02Z</updated>
            </entry>
          </item>
        </publish>
      </pubsub>
        
   S: <stream:error>
        <unsupported-stanza-type
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
   S: <stream:error>
        <unsupported-stanza-type
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
4.9.3.25. unsupported-version
4.9.3.25. 不支持的版本

The 'version' attribute provided by the initiating entity in the stream header specifies a version of XMPP that is not supported by the server.

流头中发起实体提供的“version”属性指定了服务器不支持的XMPP版本。

   C: <?xml version='1.0'?>
      <stream:stream
          from='juliet@im.example.com'
          to='im.example.com'
          version='11.0'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   C: <?xml version='1.0'?>
      <stream:stream
          from='juliet@im.example.com'
          to='im.example.com'
          version='11.0'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   S: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
      <stream:error>
        <unsupported-version
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
   S: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
      <stream:error>
        <unsupported-version
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
4.9.4. Application-Specific Conditions
4.9.4. 应用特定条件

As noted, an application MAY provide application-specific stream error information by including a properly namespaced child in the error element. The application-specific element SHOULD supplement or further qualify a defined element. Thus, the <error/> element will contain two or three child elements.

如前所述,应用程序可以通过在error元素中包含正确命名的子元素来提供特定于应用程序的流错误信息。特定于应用程序的元素应补充或进一步限定已定义的元素。因此,<error/>元素将包含两个或三个子元素。

C: <message> <body> My keyboard layout is:

C:<message><body>我的键盘布局是:

          QWERTYUIOP{}|
          ASDFGHJKL:"
          ZXCVBNM<>?
        </body>
      </message>
        
          QWERTYUIOP{}|
          ASDFGHJKL:"
          ZXCVBNM<>?
        </body>
      </message>
        
   S: <stream:error>
        <not-well-formed
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
        <text xml:lang='en' xmlns='urn:ietf:params:xml:ns:xmpp-streams'>
          Some special application diagnostic information!
        </text>
        <escape-your-data xmlns='http://example.org/ns'/>
      </stream:error>
      </stream:stream>
        
   S: <stream:error>
        <not-well-formed
            xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
        <text xml:lang='en' xmlns='urn:ietf:params:xml:ns:xmpp-streams'>
          Some special application diagnostic information!
        </text>
        <escape-your-data xmlns='http://example.org/ns'/>
      </stream:error>
      </stream:stream>
        
4.10. Simplified Stream Examples
4.10. 简化流示例

This section contains two highly simplified examples of a stream-based connection between a client and a server; these examples are included for the purpose of illustrating the concepts introduced thus far, but the reader needs to be aware that these examples elide many details (see Section 9 for more complete examples).

本节包含客户端和服务器之间基于流的连接的两个高度简化的示例;包括这些示例是为了说明迄今为止介绍的概念,但读者需要注意,这些示例省略了许多细节(更多完整示例请参见第9节)。

A basic connection:

基本联系:

   C: <?xml version='1.0'?>
      <stream:stream
          from='juliet@im.example.com'
          to='im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   C: <?xml version='1.0'?>
      <stream:stream
          from='juliet@im.example.com'
          to='im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   S: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   S: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        

[ ... stream negotiation ... ]

[…流协商…]

   C:   <message from='juliet@im.example.com/balcony'
                 to='romeo@example.net'
                 xml:lang='en'>
          <body>Art thou not Romeo, and a Montague?</body>
        </message>
        
   C:   <message from='juliet@im.example.com/balcony'
                 to='romeo@example.net'
                 xml:lang='en'>
          <body>Art thou not Romeo, and a Montague?</body>
        </message>
        
   S:   <message from='romeo@example.net/orchard'
                 to='juliet@im.example.com/balcony'
                 xml:lang='en'>
          <body>Neither, fair saint, if either thee dislike.</body>
        </message>
        
   S:   <message from='romeo@example.net/orchard'
                 to='juliet@im.example.com/balcony'
                 xml:lang='en'>
          <body>Neither, fair saint, if either thee dislike.</body>
        </message>
        
   C: </stream:stream>
        
   C: </stream:stream>
        
   S: </stream:stream>
        
   S: </stream:stream>
        

A connection gone bad:

连接坏了:

   C: <?xml version='1.0'?>
      <stream:stream
          from='juliet@im.example.com'
          to='im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   C: <?xml version='1.0'?>
      <stream:stream
          from='juliet@im.example.com'
          to='im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   S: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   S: <?xml version='1.0'?>
      <stream:stream
          from='im.example.com'
          id='++TR84Sm6A3hnt3Q065SnAbbk3Y='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        

[ ... stream negotiation ... ]

[…流协商…]

   C:   <message from='juliet@im.example.com/balcony'
                 to='romeo@example.net'
                 xml:lang='en'>
          <body>No closing tag!
        </message>
        
   C:   <message from='juliet@im.example.com/balcony'
                 to='romeo@example.net'
                 xml:lang='en'>
          <body>No closing tag!
        </message>
        
   S: <stream:error>
       <not-well-formed
           xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        
   S: <stream:error>
       <not-well-formed
           xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
      </stream:error>
      </stream:stream>
        

More detailed examples are provided under Section 9.

第9节提供了更详细的示例。

5. STARTTLS Negotiation
5. STARTTLS谈判
5.1. Fundamentals
5.1. 基本原理

XMPP includes a method for securing the stream from tampering and eavesdropping. This channel encryption method makes use of the Transport Layer Security [TLS] protocol, specifically a "STARTTLS" extension that is modeled after similar extensions for the [IMAP],

XMPP包括一种保护流不被篡改和窃听的方法。该信道加密方法利用传输层安全[TLS]协议,特别是一个“STARTTLS”扩展,该扩展模仿[IMAP]的类似扩展,

[POP3], and [ACAP] protocols as described in [USINGTLS]. The XML namespace name for the STARTTLS extension is 'urn:ietf:params:xml:ns:xmpp-tls'.

[POP3]和[ACAP]协议,如[USINGTLS]中所述。STARTTLS扩展的XML命名空间名称为“urn:ietf:params:XML:ns:xmpp-tls”。

5.2. Support
5.2. 支持

Support for STARTTLS is REQUIRED in XMPP client and server implementations. An administrator of a given deployment MAY specify that TLS is mandatory-to-negotiate for client-to-server communication, server-to-server communication, or both. An initiating entity SHOULD use TLS to secure its stream with the receiving entity before proceeding with SASL authentication.

在XMPP客户机和服务器实现中需要对STARTTLS的支持。给定部署的管理员可以指定必须使用TLS来协商客户端到服务器通信、服务器到服务器通信或两者。在继续SASL身份验证之前,发起实体应使用TLS保护其与接收实体的流。

5.3. Stream Negotiation Rules
5.3. 流协商规则
5.3.1. Mandatory-to-Negotiate
5.3.1. 强制谈判

If the receiving entity advertises only the STARTTLS feature or if the receiving entity includes the <required/> child element as explained under Section 5.4.1, the parties MUST consider TLS as mandatory-to-negotiate. If TLS is mandatory-to-negotiate, the receiving entity SHOULD NOT advertise support for any stream feature except STARTTLS during the initial stage of the stream negotiation process, because further stream features might depend on prior negotiation of TLS given the order of layers in XMPP (e.g., the particular SASL mechanisms offered by the receiving entity will likely depend on whether TLS has been negotiated).

如果接收实体仅公告SARTTLL特性,或者如果接收实体包含如5.4.1节所解释的<必需/>子元素,则双方必须考虑TLS是强制协商的。如果必须协商TLS,则接收实体不应在流协商过程的初始阶段公布对STARTTLS以外的任何流特性的支持,因为进一步的流特性可能取决于给定XMPP中的层顺序的TLS的先前协商(例如,接收实体提供的特定SASL机制可能取决于TLS是否已协商)。

5.3.2. Restart
5.3.2. 重新启动

After TLS negotiation, the parties MUST restart the stream.

TLS协商后,双方必须重新启动流。

5.3.3. Data Formatting
5.3.3. 数据格式

During STARTTLS negotiation, the entities MUST NOT send any whitespace as separators between XML elements (i.e., from the last character of the first-level <starttls/> element qualified by the 'urn:ietf:params:xml:ns:xmpp-tls' namespace as sent by the initiating entity, until the last character of the first-level <proceed/> element qualified by the 'urn:ietf:params:xml:ns:xmpp-tls' namespace as sent by the receiving entity). This prohibition helps to ensure proper security layer byte precision. Any such whitespace shown in the STARTTLS examples provided in this document is included only for the sake of readability.

在STARTTLS协商期间,实体不得发送任何空白作为XML元素之间的分隔符(即,从发起实体发送的“urn:ietf:params:xml:ns:xmpp tls”命名空间限定的第一级<starttls/>元素的最后一个字符开始,直到接收实体发送的“urn:ietf:params:xml:ns:xmpp tls”命名空间限定的第一级<procedure/>元素的最后一个字符为止)。此禁止有助于确保适当的安全层字节精度。本文档中提供的STARTTLS示例中显示的任何此类空白仅出于可读性考虑。

5.3.4. Order of TLS and SASL Negotiations
5.3.4. TLS和SASL谈判顺序

If the initiating entity chooses to use TLS, STARTTLS negotiation MUST be completed before proceeding to SASL negotiation (Section 6); this order of negotiation is necessary to help safeguard authentication information sent during SASL negotiation, as well as to make it possible to base the use of the SASL EXTERNAL mechanism on a certificate (or other credentials) provided during prior TLS negotiation.

如果发起实体选择使用TLS,则必须在进行SASL谈判之前完成STARTTLS谈判(第6节);此协商顺序对于帮助保护SASL协商期间发送的身份验证信息以及使SASL外部机制的使用基于先前TLS协商期间提供的证书(或其他凭证)是必要的。

5.3.5. TLS Renegotiation
5.3.5. TLS重新谈判

The TLS protocol allows either party in a TLS-protected channel to initiate a new handshake that establishes new cryptographic parameters (see [TLS-NEG]). The cases most commonly mentioned are:

TLS协议允许TLS保护信道中的任何一方发起新的握手,以建立新的加密参数(请参见[TLS-NEG])。最常提到的情况是:

1. Refreshing encryption keys.

1. 刷新加密密钥。

2. Wrapping the TLS sequence number as explained in Section 6.1 of [TLS].

2. 按照[TLS]第6.1节的说明包装TLS序列号。

3. Protecting client credentials by completing server authentication first and then completing client authentication over the protected channel.

3. 通过先完成服务器身份验证,然后通过受保护通道完成客户端身份验证来保护客户端凭据。

Because it is relatively inexpensive to establish streams in XMPP, for the first two cases it is preferable to use an XMPP stream reset (as described under Section 4.9.3.16) instead of performing TLS renegotiation.

因为在XMPP中建立流相对便宜,对于前两种情况,最好使用XMPP流重置(如第4.9.3.16节所述),而不是执行TLS重新协商。

The third case has improved security characteristics when the TLS client (which might be an XMPP server) presents credentials to the TLS server. If communicating such credentials to an unauthenticated TLS server might leak private information, it can be appropriate to complete TLS negotiation for the purpose of authenticating the TLS server to the TLS client and then attempt TLS renegotiation for the purpose of authenticating the TLS client to the TLS server. However, this case is extremely rare because the credentials presented by an XMPP server or XMPP client acting as a TLS client are almost always public (i.e., a PKIX certificate), and therefore providing those credentials before authenticating the XMPP server acting as a TLS server would not in general leak private information.

第三种情况改进了TLS客户端(可能是XMPP服务器)向TLS服务器提供凭据时的安全特性。如果将此类凭证传递给未经验证的TLS服务器可能会泄漏私人信息,则可以完成TLS协商,以便向TLS客户端验证TLS服务器,然后尝试TLS重新协商,以便向TLS服务器验证TLS客户端。但是,这种情况极为罕见,因为充当TLS客户端的XMPP服务器或XMPP客户端提供的凭据几乎总是公共的(即PKIX证书),因此在验证充当TLS服务器的XMPP服务器之前提供这些凭据通常不会泄露私人信息。

As a result, implementers are encouraged to carefully weigh the costs and benefits of TLS renegotiation before supporting it in their software, and XMPP entities that act as TLS clients are discouraged

因此,鼓励实施者在软件中支持TLS重新协商之前仔细权衡TLS重新协商的成本和收益,不鼓励充当TLS客户端的XMPP实体

from attempting TLS renegotiation unless the certificate (or other credential information) sent during TLS negotiation is known to be private.

除非TLS协商期间发送的证书(或其他凭证信息)已知为私有,否则禁止尝试TLS重新协商。

Support for TLS renegotiation is strictly OPTIONAL. However, implementations that support TLS renegotiation MUST implement and use the TLS Renegotiation Extension [TLS-NEG].

对TLS重新协商的支持是严格可选的。但是,支持TLS重新协商的实现必须实现并使用TLS重新协商扩展[TLS-NEG]。

If an entity that does not support TLS renegotiation detects a renegotiation attempt, then it MUST immediately close the underlying TCP connection without returning a stream error (since the violation has occurred at the TLS layer, not the XMPP layer, as described under Section 13.3).

如果不支持TLS重新协商的实体检测到重新协商尝试,则它必须立即关闭底层TCP连接,而不返回流错误(因为违规发生在TLS层,而不是XMPP层,如第13.3节所述)。

If an entity that supports TLS renegotiation detects a TLS renegotiation attempt that does not use the TLS Renegotiation Extension [TLS-NEG], then it MUST immediately close the underlying TCP connection without returning a stream error (since the violation has occurred at the TLS layer, not the XMPP layer as described under Section 13.3).

如果支持TLS重新协商的实体检测到不使用TLS重新协商扩展[TLS-NEG]的TLS重新协商尝试,则必须立即关闭底层TCP连接而不返回流错误(因为违规发生在TLS层,而不是第13.3节所述的XMPP层)。

5.3.6. TLS Extensions
5.3.6. TLS扩展

Either party to a stream MAY include any TLS extension during the TLS negotiation itself. This is a matter for the TLS layer, not the XMPP layer.

流的任一方可以在TLS协商期间包括任何TLS扩展。这是TLS层的问题,而不是XMPP层的问题。

5.4. Process
5.4. 过程
5.4.1. Exchange of Stream Headers and Stream Features
5.4.1. 流标题和流特征的交换

The initiating entity resolves the FQDN of the receiving entity as specified under Section 3, opens a TCP connection to the advertised port at the resolved IP address, and sends an initial stream header to the receiving entity.

发起实体按照第3节的规定解析接收实体的FQDN,在解析的IP地址处打开到播发端口的TCP连接,并向接收实体发送初始流头。

   I: <stream:stream
        from='juliet@im.example.com'
        to='im.example.com'
        version='1.0'
        xml:lang='en'
        xmlns='jabber:client'
        xmlns:stream='http://etherx.jabber.org/streams'>
        
   I: <stream:stream
        from='juliet@im.example.com'
        to='im.example.com'
        version='1.0'
        xml:lang='en'
        xmlns='jabber:client'
        xmlns:stream='http://etherx.jabber.org/streams'>
        

The receiving entity MUST send a response stream header to the initiating entity over the TCP connection opened by the initiating entity.

接收实体必须通过发起实体打开的TCP连接向发起实体发送响应流头。

   R: <stream:stream
        from='im.example.com'
        id='t7AMCin9zjMNwQKDnplntZPIDEI='
        to='juliet@im.example.com'
        version='1.0'
        xml:lang='en'
        xmlns='jabber:client'
        xmlns:stream='http://etherx.jabber.org/streams'>
        
   R: <stream:stream
        from='im.example.com'
        id='t7AMCin9zjMNwQKDnplntZPIDEI='
        to='juliet@im.example.com'
        version='1.0'
        xml:lang='en'
        xmlns='jabber:client'
        xmlns:stream='http://etherx.jabber.org/streams'>
        

The receiving entity then MUST send stream features to the initiating entity. If the receiving entity supports TLS, the stream features MUST include an advertisement for support of STARTTLS negotiation, i.e., a <starttls/> element qualified by the 'urn:ietf:params:xml:ns:xmpp-tls' namespace.

然后,接收实体必须向发起实体发送流特征。如果接收实体支持TLS,则流功能必须包括支持STARTTLS协商的公告,即由“urn:ietf:params:xml:ns:xmpp TLS”命名空间限定的<STARTTLS/>元素。

If the receiving entity considers STARTTLS negotiation to be mandatory-to-negotiate, the <starttls/> element MUST contain an empty <required/> child element.

如果接收实体认为STARTTLS协商是必须进行协商的,则<STARTTLS/>元素必须包含空的<required/>子元素。

   R: <stream:features>
        <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'>
          <required/>
        </starttls>
      </stream:features>
        
   R: <stream:features>
        <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'>
          <required/>
        </starttls>
      </stream:features>
        
5.4.2. Initiation of STARTTLS Negotiation
5.4.2. 启动STARTTLS谈判
5.4.2.1. STARTTLS Command
5.4.2.1. STARTTLS命令

In order to begin the STARTTLS negotiation, the initiating entity issues the STARTTLS command (i.e., a <starttls/> element qualified by the 'urn:ietf:params:xml:ns:xmpp-tls' namespace) to instruct the receiving entity that it wishes to begin a STARTTLS negotiation to secure the stream.

为了开始STARTTLS协商,发起实体发出STARTTLS命令(即,由“urn:ietf:params:xml:ns:xmpp-tls”命名空间限定的<STARTTLS/>元素),以指示接收实体希望开始STARTTLS协商以保护流。

   I: <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
        
   I: <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
        

The receiving entity MUST reply with either a <proceed/> element (proceed case) or a <failure/> element (failure case) qualified by the 'urn:ietf:params:xml:ns:xmpp-tls' namespace.

接收实体必须使用由“urn:ietf:params:xml:ns:xmpp tls”命名空间限定的<procedure/>元素(procedure case)或<failure/>元素(failure case)进行回复。

5.4.2.2. Failure Case
5.4.2.2. 失败案例

If the failure case occurs, the receiving entity MUST return a <failure/> element qualified by the 'urn:ietf:params:xml:ns:xmpp-tls' namespace, close the XML stream, and terminate the underlying TCP connection.

如果出现故障情况,接收实体必须返回由“urn:ietf:params:xml:ns:xmpp tls”命名空间限定的<failure/>元素,关闭xml流,并终止底层TCP连接。

   R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
        
   R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
        
   R: </stream:stream>
        
   R: </stream:stream>
        

Causes for the failure case include but are not limited to:

故障案例的原因包括但不限于:

1. The initiating entity has sent a malformed STARTTLS command.

1. 发起实体已发送格式错误的STARTTLS命令。

2. The receiving entity did not offer the STARTTLS feature in its stream features.

2. 接收实体未在其流功能中提供STARTTLS功能。

3. The receiving entity cannot complete STARTTLS negotiation because of an internal error.

3. 由于内部错误,接收实体无法完成STARTTLS协商。

Informational Note: STARTTLS failure is not triggered by TLS errors such as bad_certificate or handshake_failure, which are generated and handled during the TLS negotiation itself as described in [TLS].

信息性说明:STARTTLS失败不是由TLS错误触发的,如[TLS]中所述的在TLS协商过程中生成和处理的坏证书或握手失败。

If the failure case occurs, the initiating entity MAY attempt to reconnect as explained under Section 3.3.

如果发生故障,启动实体可尝试按照第3.3节的说明重新连接。

5.4.2.3. Proceed Case
5.4.2.3. 继续审理案件

If the proceed case occurs, the receiving entity MUST return a <proceed/> element qualified by the 'urn:ietf:params:xml:ns:xmpp-tls' namespace.

如果发生继续情况,则接收实体必须返回由“urn:ietf:params:xml:ns:xmpp tls”命名空间限定的<procedure/>元素。

   R: <proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
        
   R: <proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
        

The receiving entity MUST consider the TLS negotiation to have begun immediately after sending the closing '>' character of the <proceed/> element to the initiating entity. The initiating entity MUST consider the TLS negotiation to have begun immediately after receiving the closing '>' character of the <proceed/> element from the receiving entity.

接收实体必须将TLS协商立即发送到初始化实体后,将<Calp/>元素的关闭“>”字符立即开始。发起实体必须在接收到来自接收实体的<Leal/>元素的关闭“>”字符之后立即考虑TLS协商已经开始。

The entities now proceed to TLS negotiation as explained in the next section.

实体现在进行TLS协商,如下一节所述。

5.4.3. TLS Negotiation
5.4.3. TLS谈判
5.4.3.1. Rules
5.4.3.1. 规则

In order to complete TLS negotiation over the TCP connection, the entities MUST follow the process defined in [TLS].

为了通过TCP连接完成TLS协商,实体必须遵循[TLS]中定义的流程。

The following rules apply:

以下规则适用:

1. The entities MUST NOT send any further XML data until the TLS negotiation is complete.

1. 在TLS协商完成之前,实体不得发送任何进一步的XML数据。

2. When using any of the mandatory-to-implement (MTI) ciphersuites specified under Section 13.8, the receiving entity MUST present a certificate.

2. 使用第13.8节规定的强制实施(MTI)密码套件时,接收实体必须出示证书。

3. So that mutual certificate authentication will be possible, the receiving entity SHOULD send a certificate request to the initiating entity, and the initiating entity SHOULD send a certificate to the receiving entity (but for privacy reasons might opt not to send a certificate until after the receiving entity has authenticated to the initiating entity).

3. 为了实现相互证书认证,接收实体应向发起实体发送证书请求,发起实体应向接收实体发送证书(但出于隐私原因,可能会选择在接收实体向发起实体进行身份验证之前不发送证书)。

4. The receiving entity SHOULD choose which certificate to present based on the domainpart contained in the 'to' attribute of the initial stream header (in essence, this domainpart is functionally equivalent to the Server Name Indication defined for TLS in [TLS-EXT]).

4. 接收实体应根据初始流标头的“to”属性中包含的domainpart选择要显示的证书(本质上,此domainpart在功能上等同于[TLS-EXT]中为TLS定义的服务器名称指示)。

5. To determine if the TLS negotiation will succeed, the initiating entity MUST attempt to validate the receiving entity's certificate in accordance with the certificate validation procedures specified under Section 13.7.2.

5. 为了确定TLS谈判是否会成功,发起实体必须根据第13.7.2节规定的证书验证程序,尝试验证接收实体的证书。

6. If the initiating entity presents a certificate, the receiving entity too MUST attempt to validate the initiating entity's certificate in accordance with the certificate validation procedures specified under Section 13.7.2.

6. 如果发起实体出示证书,接收实体也必须根据第13.7.2节规定的证书验证程序,尝试验证发起实体的证书。

7. Following successful TLS negotiation, all further data transmitted by either party MUST be protected with the negotiated algorithms, keys, and secrets (i.e., encrypted, integrity-protected, or both depending on the ciphersuite used).

7. TLS协商成功后,任何一方传输的所有进一步数据必须使用协商的算法、密钥和机密进行保护(即加密、完整性保护或两者兼有,具体取决于使用的密码套件)。

Security Warning: See Section 13.8 regarding ciphersuites that MUST be supported for TLS; naturally, other ciphersuites MAY be supported as well.

安全警告:关于TLS必须支持的密码套件,请参见第13.8节;当然,也可以支持其他密码套件。

5.4.3.2. TLS Failure
5.4.3.2. TLS故障

If the TLS negotiation results in failure, the receiving entity MUST terminate the TCP connection.

如果TLS协商失败,接收实体必须终止TCP连接。

The receiving entity MUST NOT send a closing </stream> tag before terminating the TCP connection (since the failure has occurred at the TLS layer, not the XMPP layer as described under Section 13.3).

在终止TCP连接之前,接收实体不得发送关闭标记(因为故障发生在TLS层,而不是第13.3节所述的XMPP层)。

The initiating entity MAY attempt to reconnect as explained under Section 3.3, with or without attempting TLS negotiation (in accordance with local service policy, user-configured preferences, etc.).

发起实体可尝试重新连接,如第3.3节所述,无论是否尝试TLS协商(根据本地服务策略、用户配置偏好等)。

5.4.3.3. TLS Success
5.4.3.3. TLS成功

If the TLS negotiation is successful, then the entities MUST proceed as follows.

如果TLS协商成功,则各实体必须按照以下步骤进行。

1. The initiating entity MUST discard any information transmitted in layers above TCP that it obtained from the receiving entity in an insecure manner before TLS took effect (e.g., the receiving entity's 'from' address or the stream ID and stream features received from the receiving entity).

1. 在TLS生效之前,发起实体必须丢弃在TCP之上的层中传输的、以不安全方式从接收实体获得的任何信息(例如,接收实体的“发件人”地址或从接收实体接收的流ID和流特征)。

2. The receiving entity MUST discard any information transmitted in layers above TCP that it obtained from the initiating entity in an insecure manner before TLS took effect (e.g., the initiating entity's 'from' address).

2. 在TLS生效之前,接收实体必须丢弃在TCP之上的层中传输的、以不安全方式从发起实体获得的任何信息(例如,发起实体的“发件人”地址)。

3. The initiating entity MUST send a new initial stream header to the receiving entity over the encrypted connection (as specified under Section 4.3.3, the initiating entity MUST NOT send a closing </stream> tag before sending the new initial stream header, since the receiving entity and initiating entity MUST consider the original stream to be replaced upon success of the TLS negotiation).

3. 发起实体必须通过加密连接向接收实体发送新的初始流头(根据第4.3.3节所规定,在发送新的初始流报头之前,发起实体不能发送关闭<流>标签,因为接收实体和发起实体必须考虑在TLS协商成功后替换原始流)。

   I: <stream:stream
        from='juliet@im.example.com'
        to='im.example.com'
        version='1.0'
        xml:lang='en'
        xmlns='jabber:client'
        xmlns:stream='http://etherx.jabber.org/streams'>
        
   I: <stream:stream
        from='juliet@im.example.com'
        to='im.example.com'
        version='1.0'
        xml:lang='en'
        xmlns='jabber:client'
        xmlns:stream='http://etherx.jabber.org/streams'>
        

4. The receiving entity MUST respond with a new response stream header over the encrypted connection (for which it MUST generate a new stream ID instead of reusing the old stream ID).

4. 接收实体必须通过加密连接使用新的响应流头进行响应(必须为其生成新的流ID,而不是重用旧的流ID)。

   R: <stream:stream
        from='im.example.com'
        id='vgKi/bkYME8OAj4rlXMkpucAqe4='
        to='juliet@im.example.com'
        version='1.0'
        xml:lang='en'
        xmlns='jabber:client'
        xmlns:stream='http://etherx.jabber.org/streams'>
        
   R: <stream:stream
        from='im.example.com'
        id='vgKi/bkYME8OAj4rlXMkpucAqe4='
        to='juliet@im.example.com'
        version='1.0'
        xml:lang='en'
        xmlns='jabber:client'
        xmlns:stream='http://etherx.jabber.org/streams'>
        

5. The receiving entity also MUST send stream features to the initiating entity, which MUST NOT include the STARTTLS feature but which SHOULD include the SASL stream feature as described under Section 6 (see especially Section 6.4.1 regarding the few reasons why the SASL stream feature would not be offered here).

5. 接收实体还必须向发起实体发送流特征,发起实体不得包括STARTTLS特征,但应包括第6节所述的SASL流特征(关于此处不提供SASL流特征的几个原因,请特别参见第6.4.1节)。

   R: <stream:features>
        <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
          <mechanism>EXTERNAL</mechanism>
          <mechanism>SCRAM-SHA-1-PLUS</mechanism>
          <mechanism>SCRAM-SHA-1</mechanism>
          <mechanism>PLAIN</mechanism>
        </mechanisms>
      </stream:features>
        
   R: <stream:features>
        <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
          <mechanism>EXTERNAL</mechanism>
          <mechanism>SCRAM-SHA-1-PLUS</mechanism>
          <mechanism>SCRAM-SHA-1</mechanism>
          <mechanism>PLAIN</mechanism>
        </mechanisms>
      </stream:features>
        
6. SASL Negotiation
6. SASL谈判
6.1. Fundamentals
6.1. 基本原理

XMPP includes a method for authenticating a stream by means of an XMPP-specific profile of the Simple Authentication and Security Layer protocol (see [SASL]). SASL provides a generalized method for adding authentication support to connection-based protocols, and XMPP uses an XML namespace profile of SASL that conforms to the profiling requirements of [SASL]. The XML namespace name for the SASL extension is 'urn:ietf:params:xml:ns:xmpp-sasl'.

XMPP包括一种通过简单认证和安全层协议(参见[SASL])的XMPP特定概要文件来认证流的方法。SASL提供了一种通用方法,用于向基于连接的协议添加身份验证支持,XMPP使用符合[SASL]评测要求的SASL的XML命名空间概要文件。SASL扩展的XML命名空间名称为“urn:ietf:params:XML:ns:xmpp-SASL”。

6.2. Support
6.2. 支持

Support for SASL negotiation is REQUIRED in XMPP client and server implementations.

XMPP客户机和服务器实现中需要支持SASL协商。

6.3. Stream Negotiation Rules
6.3. 流协商规则
6.3.1. Mandatory-to-Negotiate
6.3.1. 强制谈判

The parties to a stream MUST consider SASL as mandatory-to-negotiate.

流各方必须考虑SASL作为谈判的强制性。

6.3.2. Restart
6.3.2. 重新启动

After SASL negotiation, the parties MUST restart the stream.

SASL协商后,各方必须重新启动流。

6.3.3. Mechanism Preferences
6.3.3. 机制偏好

Any entity that will act as a SASL client or a SASL server MUST maintain an ordered list of its preferred SASL mechanisms according to the client or server, where the list is ordered according to local policy or user configuration (which SHOULD be in order of perceived strength to enable the strongest authentication possible). The initiating entity MUST maintain its own preference order independent of the preference order of the receiving entity. A client MUST try SASL mechanisms in its preference order. For example, if the server offers the ordered list "PLAIN SCRAM-SHA-1 GSSAPI" or "SCRAM-SHA-1 GSSAPI PLAIN" but the client's ordered list is "GSSAPI SCRAM-SHA-1", the client MUST try GSSAPI first and then SCRAM-SHA-1 but MUST NOT try PLAIN (since PLAIN is not on its list).

任何将充当SASL客户端或SASL服务器的实体都必须根据客户端或服务器维护其首选SASL机制的有序列表,其中该列表是根据本地策略或用户配置排序的(应按照感知强度的顺序,以尽可能实现最强的身份验证)。发起实体必须保持自己的优先顺序,独立于接收实体的优先顺序。客户端必须按其首选顺序尝试SASL机制。例如,如果服务器提供了排序列表“PLAIN SCRAM-SHA-1 GSSAPI”或“SCRAM-SHA-1 GSSAPI PLAIN”,但客户端的排序列表是“GSSAPI SCRAM-SHA-1”,则客户端必须先尝试GSSAPI,然后再尝试SCRAM-SHA-1,但不能尝试PLAIN(因为PLAIN不在其列表中)。

6.3.4. Mechanism Offers
6.3.4. 机制提供

If the receiving entity considers TLS negotiation (Section 5) to be mandatory-to-negotiate before it will accept authentication with a particular SASL mechanism, it MUST NOT advertise that mechanism in its list of available SASL mechanisms before TLS negotiation has been completed.

如果接收实体认为TLS协商(第5节)在接受特定SASL机制的认证之前必须进行协商,则在TLS协商完成之前,不得在其可用SASL机制列表中公布该机制。

The receiving entity SHOULD offer the SASL EXTERNAL mechanism if both of the following conditions hold:

如果满足以下两个条件,接收实体应提供SASL外部机制:

1. During TLS negotiation the initiating entity presented a certificate that is acceptable to the receiving entity for purposes of strong identity verification in accordance with local service policies (e.g., because said certificate is unexpired, is unrevoked, and is anchored to a root trusted by the receiving entity).

1. 在TLS协商期间,发起实体提交了接收实体可接受的证书,以便根据本地服务策略进行强身份验证(例如,因为所述证书未过期、未撤销,并且锚定到接收实体信任的根)。

2. The receiving entity expects that the initiating entity will be able to authenticate and authorize as the identity provided in the certificate; in the case of a server-to-server stream, the receiving entity might have such an expectation because a DNS domain name presented in the initiating entity's certificate matches the domain referenced in the 'from' attribute of the initial stream header, where the matching rules of [TLS-CERTS] apply; in the case of a client-to-server stream, the receiving entity might have such an expectation because the bare JID presented in the initiating entity's certificate matches a user account that is registered with the server or because other

2. 接收实体期望发起实体能够验证和授权证书中提供的身份;在服务器到服务器的流的情况下,接收实体可能有这样的期望,因为发起实体的证书中显示的DNS域名与初始流头的“from”属性中引用的域相匹配,其中[TLS-CERTS]的匹配规则适用;在客户端到服务器流的情况下,接收实体可能会有这样的期望,因为发起实体的证书中显示的裸JID与在服务器上注册的用户帐户匹配,或者因为其他原因

information contained in the initiating entity's certificate matches that of an entity that has permission to use the server for access to an XMPP network.

发起实体证书中包含的信息与有权使用服务器访问XMPP网络的实体的信息相匹配。

However, the receiving entity MAY offer the SASL EXTERNAL mechanism under other circumstances, as well.

但是,在其他情况下,接收实体也可以提供SASL外部机制。

When the receiving entity offers the SASL EXTERNAL mechanism, the receiving entity SHOULD list the EXTERNAL mechanism first among its offered SASL mechanisms and the initiating entity SHOULD attempt SASL negotiation using the EXTERNAL mechanism first (this preference will tend to increase the likelihood that the parties can negotiate mutual certificate authentication).

当接收实体提供SASL外部机制时,接收实体应在其提供的SASL机制中首先列出外部机制,发起实体应首先尝试使用外部机制进行SASL协商(这种偏好将增加双方协商相互证书认证的可能性)。

Section 13.8 specifies SASL mechanisms that MUST be supported; naturally, other SASL mechanisms MAY be supported as well.

第13.8节规定了必须支持的SASL机制;当然,也可以支持其他SASL机制。

Informational Note: Best practices for the use of SASL in the context of XMPP are described in [XEP-0175] for the ANONYMOUS mechanism and in [XEP-0178] for the EXTERNAL mechanism.

信息性说明:在XMPP上下文中使用SASL的最佳实践在[XEP-0175]中描述了匿名机制,在[XEP-0178]中描述了外部机制。

6.3.5. Data Formatting
6.3.5. 数据格式

The following data formatting rules apply to the SASL negotiation:

以下数据格式规则适用于SASL协商:

1. During SASL negotiation, the entities MUST NOT send any whitespace as separators between XML elements (i.e., from the last character of the first-level <auth/> element qualified by the 'urn:ietf:params:xml:ns:xmpp-sasl' namespace as sent by the initiating entity, until the last character of the first-level <success/> element qualified by the 'urn:ietf:params:xml:ns:xmpp-sasl' namespace as sent by the receiving entity). This prohibition helps to ensure proper security layer byte precision. Any such whitespace shown in the SASL examples provided in this document is included only for the sake of readability.

1. 在SASL协商期间,实体不得发送任何空白作为XML元素之间的分隔符(即,从发起实体发送的“urn:ietf:params:xml:ns:xmpp-sasl”命名空间限定的第一级<auth/>元素的最后一个字符开始,直到接收实体发送的“urn:ietf:params:xml:ns:xmpp-sasl”命名空间限定的第一级<success/>元素的最后一个字符为止)。此禁止有助于确保适当的安全层字节精度。本文档中提供的SASL示例中显示的任何此类空白仅出于可读性考虑。

2. Any XML character data contained within the XML elements MUST be encoded using base 64, where the encoding adheres to the definition in Section 4 of [BASE64] and where the padding bits are set to zero.

2. XML元素中包含的任何XML字符数据必须使用base 64进行编码,其中编码符合[base 64]第4节中的定义,并且填充位设置为零。

3. As formally specified in the XML schema for the 'urn:ietf:params:xml:ns:xmpp-sasl' namespace under Appendix A.4, the receiving entity MAY include one or more application-specific child elements inside the <mechanisms/> element to provide information that might be needed by the initiating entity in order to complete successful SASL negotiation using one or more

3. 正如附录A.4中“urn:ietf:params:XML:ns:xmpp-sasl”命名空间的XML模式中正式指定的那样,接收实体可以在<mechanisms/>元素内包括一个或多个特定于应用程序的子元素,以提供发起实体可能需要的信息,以便使用一个或多个SASL来完成成功的SASL协商

of the offered mechanisms; however, the syntax and semantics of all such elements are out of scope for this specification (see [XEP-0233] for one example).

提供了哪些机制;然而,所有这些元素的语法和语义都超出了本规范的范围(参见[XEP-0233]中的一个示例)。

6.3.6. Security Layers
6.3.6. 安全层

Upon successful SASL negotiation that involves negotiation of a security layer, both the initiating entity and the receiving entity MUST discard any application-layer state (i.e, state from the XMPP layer, excluding state from the TLS negotiation or SASL negotiation).

成功进行涉及安全层协商的SASL协商后,发起实体和接收实体都必须放弃任何应用层状态(即来自XMPP层的状态,不包括来自TLS协商或SASL协商的状态)。

6.3.7. Simple User Name
6.3.7. 简单用户名

Some SASL mechanisms (e.g., CRAM-MD5, DIGEST-MD5, and SCRAM) specify that the authentication identity used in the context of such mechanisms is a "simple user name" (see Section 2 of [SASL] as well as [SASLPREP]). The exact form of the simple user name in any particular mechanism or deployment thereof is a local matter, and a simple user name does not necessarily map to an application identifier such as a JID or JID component (e.g., a localpart). However, in the absence of local information provided by the server, an XMPP client SHOULD assume that the authentication identity for such a SASL mechanism is a simple user name equal to the localpart of the user's JID.

一些SASL机制(例如CRAM-MD5、DIGEST-MD5和SCRAM)规定,在此类机制的上下文中使用的身份验证标识是“简单用户名”(参见[SASL]第2节以及[SASLPREP])。任何特定机制或其部署中的简单用户名的确切形式是本地问题,并且简单用户名不一定映射到应用程序标识符,例如JID或JID组件(例如,localpart)。但是,在缺少服务器提供的本地信息的情况下,XMPP客户端应该假定这种SASL机制的身份验证标识是一个简单的用户名,等于用户JID的localpart。

6.3.8. Authorization Identity
6.3.8. 授权标识

An authorization identity is an OPTIONAL identity included by the initiating entity to specify an identity to act as (see Section 2 of [SASL]). In client-to-server streams, it would most likely be used by an administrator to perform some management task on behalf of another user, whereas in server-to-server streams it would most likely be used to specify a particular add-on service at an XMPP service (e.g., a multi-user chat server at conference.example.com that is hosted by the example.com XMPP service). If the initiating entity wishes to act on behalf of another entity and the selected SASL mechanism supports transmission of an authorization identity, the initiating entity MUST provide an authorization identity during SASL negotiation. If the initiating entity does not wish to act on behalf of another entity, it MUST NOT provide an authorization identity.

授权标识是发起实体包含的可选标识,用于指定要充当的标识(参见[SASL]第2节)。在客户端到服务器的流中,管理员最有可能使用它代表另一个用户执行一些管理任务,而在服务器到服务器的流中,它最有可能用于在XMPP服务中指定特定的附加服务(例如,由example.com XMPP服务托管的conference.example.com上的多用户聊天服务器)。如果发起实体希望代表另一实体行事,且所选SASL机制支持传输授权标识,则发起实体必须在SASL协商期间提供授权标识。如果发起实体不希望代表另一实体行事,则不得提供授权标识n身份。

In the case of client-to-server communication, the value of an authorization identity MUST be a bare JID (<localpart@domainpart>) rather than a full JID (<localpart@domainpart/resourcepart>).

在客户端到服务器通信的情况下,授权标识的值必须是裸JID(<localpart@domainpart>)而不是一个完整的JID(<localpart@domainpart/资源部分>)。

In the case of server-to-server communication, the value of an authorization identity MUST be a domainpart only (<domainpart>).

在服务器到服务器通信的情况下,授权标识的值必须仅为domainpart(<domainpart>)。

If the initiating entity provides an authorization identity during SASL negotiation, the receiving entity is responsible for verifying that the initiating entity is in fact allowed to assume the specified authorization identity; if not, the receiving entity MUST return an <invalid-authzid/> SASL error as described under Section 6.5.6.

如果发起实体在SASL协商期间提供了授权标识,则接收实体负责验证发起实体事实上被允许采用指定的授权标识;否则,接收实体必须返回第6.5.6节所述的<invalid authzid/>SASL错误。

6.3.9. Realms
6.3.9. 王国

The receiving entity MAY include a realm when negotiating certain SASL mechanisms (e.g., both the GSSAPI and DIGEST-MD5 mechanisms allow the authentication exchange to include a realm, though in different ways, whereas the EXTERNAL, SCRAM, and PLAIN mechanisms do not). If the receiving entity does not communicate a realm, the initiating entity MUST NOT assume that any realm exists. The realm MUST be used only for the purpose of authentication; in particular, an initiating entity MUST NOT attempt to derive an XMPP domainpart from the realm information provided by the receiving entity.

在协商某些SASL机制时,接收实体可能包括一个领域(例如,GSSAPI和DIGEST-MD5机制都允许认证交换包括一个领域,尽管方式不同,而外部、紧急停堆和普通机制不允许)。如果接收实体不与域通信,则发起实体不得假定存在任何域。域只能用于身份验证;特别是,发起实体不得试图从接收实体提供的领域信息派生XMPP domainpart。

6.3.10. Round Trips
6.3.10. 往返

[SASL] specifies that a using protocol such as XMPP can define two methods by which the protocol can save round trips where allowed for the SASL mechanism:

[SASL]指定使用协议(如XMPP)可以定义两种方法,通过这两种方法,协议可以在SASL机制允许的情况下保存往返行程:

1. When the SASL client (the XMPP "initiating entity") requests an authentication exchange, it can include "initial response" data with its request if appropriate for the SASL mechanism in use. In XMPP, this is done by including the initial response as the XML character data of the <auth/> element.

1. 当SASL客户端(XMPP“发起实体”)请求身份验证交换时,如果适用于正在使用的SASL机制,它可以在请求中包含“初始响应”数据。在XMPP中,这是通过将初始响应作为<auth/>元素的XML字符数据来实现的。

2. At the end of the authentication exchange, the SASL server (the XMPP "receiving entity") can include "additional data with success" if appropriate for the SASL mechanism in use. In XMPP, this is done by including the additional data as the XML character data of the <success/> element.

2. 在身份验证交换结束时,SASL服务器(XMPP“接收实体”)可以包括“成功的附加数据”(如果适用于正在使用的SASL机制)。在XMPP中,这是通过将附加数据作为<success/>元素的XML字符数据来实现的。

For the sake of protocol efficiency, it is REQUIRED for clients and servers to support these methods and RECOMMENDED to use them; however, clients and servers MUST support the less efficient modes as well.

为了协议效率,客户端和服务器需要支持这些方法,并建议使用它们;但是,客户端和服务器也必须支持效率较低的模式。

6.4. Process
6.4. 过程

The process for SASL negotiation is as follows.

SASL谈判流程如下。

6.4.1. Exchange of Stream Headers and Stream Features
6.4.1. 流标题和流特征的交换

If SASL negotiation follows successful STARTTLS negotiation (Section 5), then the SASL negotiation occurs over the protected stream that has already been negotiated. If not, the initiating entity resolves the FQDN of the receiving entity as specified under Section 3, opens a TCP connection to the advertised port at the resolved IP address, and sends an initial stream header to the receiving entity. In either case, the receiving entity will receive an initial stream from the initiating entity.

如果SASL协商遵循成功的STARTTLS协商(第5节),则SASL协商发生在已协商的受保护流上。如果没有,发起实体将按照第3节的规定解析接收实体的FQDN,在解析的IP地址处打开到播发端口的TCP连接,并向接收实体发送初始流头。在任一情况下,接收实体将从发起实体接收初始流。

   I: <stream:stream
        from='juliet@im.example.com'
        to='im.example.com'
        version='1.0'
        xml:lang='en'
        xmlns='jabber:client'
        xmlns:stream='http://etherx.jabber.org/streams'>
        
   I: <stream:stream
        from='juliet@im.example.com'
        to='im.example.com'
        version='1.0'
        xml:lang='en'
        xmlns='jabber:client'
        xmlns:stream='http://etherx.jabber.org/streams'>
        

When the receiving entity processes an initial stream header from the initiating entity, it MUST send a response stream header to the initiating entity (for which it MUST generate a unique stream ID. If TLS negotiation has already succeeded, then this stream ID MUST be different from the stream ID sent before TLS negotiation succeeded).

当接收实体处理来自发起实体的初始流标头时,它必须向发起实体发送响应流标头(它必须为此生成唯一的流ID。如果TLS协商已成功,则此流ID必须与TLS协商成功之前发送的流ID不同)。

   R: <stream:stream
        from='im.example.com'
        id='vgKi/bkYME8OAj4rlXMkpucAqe4='
        to='juliet@im.example.com'
        version='1.0'
        xml:lang='en'
        xmlns='jabber:client'
        xmlns:stream='http://etherx.jabber.org/streams'>
        
   R: <stream:stream
        from='im.example.com'
        id='vgKi/bkYME8OAj4rlXMkpucAqe4='
        to='juliet@im.example.com'
        version='1.0'
        xml:lang='en'
        xmlns='jabber:client'
        xmlns:stream='http://etherx.jabber.org/streams'>
        

The receiving entity also MUST send stream features to the initiating entity. The stream features SHOULD include an advertisement for support of SASL negotiation, i.e., a <mechanisms/> element qualified by the 'urn:ietf:params:xml:ns:xmpp-sasl' namespace. Typically there are only three cases in which support for SASL negotiation would not be advertised here:

接收实体还必须向发起实体发送流特征。流特性应该包括支持SASL协商的广告,即由“urn:ietf:params:xml:ns:xmpp-SASL”命名空间限定的<mechanisms/>元素。通常只有三种情况下,SASL协商支持不会在此处公布:

o TLS negotiation needs to happen before SASL can be offered (i.e., TLS is required and the receiving entity is responding to the very first initial stream header it has received for this connection attempt).

o 在提供SASL之前,需要进行TLS协商(即,需要TLS,并且接收实体正在响应它为此连接尝试接收到的第一个初始流头)。

o SASL negotiation is impossible for a server-to-server connection (i.e., the initiating server has not provided a certificate that would enable strong authentication and therefore the receiving server is falling back to weak identity verification using the Server Dialback protocol [XEP-0220]).

o SASL协商对于服务器到服务器连接是不可能的(即,发起服务器没有提供能够启用强身份验证的证书,因此接收服务器正在使用服务器回拨协议[XEP-0220]进行弱身份验证)。

o SASL has already been negotiated (i.e., the receiving entity is responding to an initial stream header sent as a stream restart after successful SASL negotiation).

o 已协商SASL(即,接收实体在成功协商SASL后响应作为流重新启动发送的初始流报头)。

The <mechanisms/> element MUST contain one <mechanism/> child element for each authentication mechanism the receiving entity offers to the initiating entity. As noted, the order of <mechanism/> elements in the XML indicates the preference order of the SASL mechanisms according to the receiving entity (which is not necessarily the preference order according to the initiating entity).

对于接收实体向发起实体提供的每个身份验证机制,<mechanism/>元素必须包含一个子元素。如前所述,XML中<mechanism/>元素的顺序表示SASL机制根据接收实体的优先顺序(不一定是根据发起实体的优先顺序)。

   R: <stream:features>
        <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
          <mechanism>EXTERNAL</mechanism>
          <mechanism>SCRAM-SHA-1-PLUS</mechanism>
          <mechanism>SCRAM-SHA-1</mechanism>
          <mechanism>PLAIN</mechanism>
        </mechanisms>
      </stream:features>
        
   R: <stream:features>
        <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
          <mechanism>EXTERNAL</mechanism>
          <mechanism>SCRAM-SHA-1-PLUS</mechanism>
          <mechanism>SCRAM-SHA-1</mechanism>
          <mechanism>PLAIN</mechanism>
        </mechanisms>
      </stream:features>
        
6.4.2. Initiation
6.4.2. 开始

In order to begin the SASL negotiation, the initiating entity sends an <auth/> element qualified by the 'urn:ietf:params:xml:ns:xmpp-sasl' namespace and includes an appropriate value for the 'mechanism' attribute, thus starting the handshake for that particular authentication mechanism. This element MAY contain XML character data (in SASL terminology, the "initial response") if the mechanism supports or requires it. If the initiating entity needs to send a zero-length initial response, it MUST transmit the response as a single equals sign character ("="), which indicates that the response is present but contains no data.

为了开始SASL协商,发起实体发送一个由“urn:ietf:params:xml:ns:xmpp-SASL”命名空间限定的<auth/>元素,并为“mechanism”属性包含一个适当的值,从而启动该特定身份验证机制的握手。如果机制支持或需要,此元素可能包含XML字符数据(在SASL术语中称为“初始响应”)。如果发起实体需要发送零长度的初始响应,则它必须以单个等号字符(“=”)的形式发送响应,这表示响应存在,但不包含任何数据。

   I: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
            mechanism='PLAIN'>AGp1bGlldAByMG0zMG15cjBtMzA=</auth>
        
   I: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
            mechanism='PLAIN'>AGp1bGlldAByMG0zMG15cjBtMzA=</auth>
        

If the initiating entity subsequently sends another <auth/> element and the ongoing authentication handshake has not yet completed, the receiving entity MUST discard the ongoing handshake and MUST process a new handshake for the subsequently requested SASL mechanism.

如果发起实体随后发送另一个<auth/>元素,并且正在进行的身份验证握手尚未完成,则接收实体必须放弃正在进行的握手,并且必须为随后请求的SASL机制处理新握手。

6.4.3. Challenge-Response Sequence
6.4.3. 质询-反应序列

If necessary, the receiving entity challenges the initiating entity by sending a <challenge/> element qualified by the 'urn:ietf:params:xml:ns:xmpp-sasl' namespace; this element MAY contain XML character data (which MUST be generated in accordance with the definition of the SASL mechanism chosen by the initiating entity).

如有必要,接收实体通过发送由“urn:ietf:params:xml:ns:xmpp-sasl”命名空间限定的<challenge/>元素来质询发起实体;该元素可能包含XML字符数据(必须根据发起实体选择的SASL机制的定义生成)。

The initiating entity responds to the challenge by sending a <response/> element qualified by the 'urn:ietf:params:xml:ns:xmpp-sasl' namespace; this element MAY contain XML character data (which MUST be generated in accordance with the definition of the SASL mechanism chosen by the initiating entity).

发起实体通过发送由“urn:ietf:params:xml:ns:xmpp-sasl”命名空间限定的<response/>元素来响应质询;该元素可能包含XML字符数据(必须根据发起实体选择的SASL机制的定义生成)。

If necessary, the receiving entity sends more challenges and the initiating entity sends more responses.

如有必要,接收实体发送更多挑战,发起实体发送更多响应。

This series of challenge/response pairs continues until one of three things happens:

这一系列挑战/响应对将持续进行,直到发生以下三种情况之一:

o The initiating entity aborts the handshake for this authentication mechanism.

o 发起实体中止此身份验证机制的握手。

o The receiving entity reports failure of the handshake.

o 接收实体报告握手失败。

o The receiving entity reports success of the handshake.

o 接收实体报告握手成功。

These scenarios are described in the following sections.

以下各节将介绍这些场景。

6.4.4. Abort
6.4.4. 中止

The initiating entity aborts the handshake for this authentication mechanism by sending an <abort/> element qualified by the 'urn:ietf:params:xml:ns:xmpp-sasl' namespace.

发起实体通过发送由“urn:ietf:params:xml:ns:xmpp-sasl”命名空间限定的<abort/>元素来中止此身份验证机制的握手。

   I: <abort xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
        
   I: <abort xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
        

Upon receiving an <abort/> element, the receiving entity MUST return a <failure/> element qualified by the 'urn:ietf:params:xml:ns:xmpp-sasl' namespace and containing an <aborted/> child element.

接收到<abort/>元素后,接收实体必须返回一个<failure/>元素,该元素由“urn:ietf:params:xml:ns:xmpp-sasl”命名空间限定,并包含一个子元素<aborted/>。

   R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        <aborted/>
      </failure>
        
   R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        <aborted/>
      </failure>
        
6.4.5. SASL Failure
6.4.5. SASL故障

The receiving entity reports failure of the handshake for this authentication mechanism by sending a <failure/> element qualified by the 'urn:ietf:params:xml:ns:xmpp-sasl' namespace (the particular cause of failure MUST be communicated in an appropriate child element of the <failure/> element as defined under Section 6.5).

接收实体通过发送由“urn:ietf:params:xml:ns:xmpp-sasl”命名空间限定的<failure/>元素来报告此身份验证机制的握手失败(失败的特定原因必须在<failure/>元素的适当子元素中传达,如第6.5节所定义)。

   R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        <not-authorized/>
      </failure>
        
   R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        <not-authorized/>
      </failure>
        

Where appropriate for the chosen SASL mechanism, the receiving entity SHOULD allow a configurable but reasonable number of retries (at least 2 and no more than 5); this enables the initiating entity (e.g., an end-user client) to tolerate incorrectly provided credentials (e.g., a mistyped password) without being forced to reconnect (which it would if the receiving entity immediately returned a SASL failure and closed the stream).

在适用于所选SASL机制的情况下,接收实体应允许可配置但合理的重试次数(至少2次且不超过5次);这使得发起实体(例如,最终用户客户端)能够容忍错误提供的凭据(例如,输入错误的密码),而不会被迫重新连接(如果接收实体立即返回SASL故障并关闭流,则会重新连接)。

If the initiating entity attempts a reasonable number of retries with the same SASL mechanism and all attempts fail, it MAY fall back to the next mechanism in its ordered list by sending a new <auth/> request to the receiving entity, thus starting a new handshake for that authentication mechanism. If all handshakes fail and there are no remaining mechanisms in the initiating entity's list of supported and acceptable mechanisms, the initiating entity SHOULD simply close the stream as described under Section 4.4 (instead of waiting for the stream to time out).

如果发起实体尝试使用相同的SASL机制进行合理次数的重试,并且所有尝试均失败,则它可能会通过向接收实体发送新的<auth/>请求而退回到其有序列表中的下一个机制,从而为该认证机制启动新的握手。如果所有握手都失败,并且发起实体的支持和可接受机制列表中没有剩余机制,发起实体应按照第4.4节所述关闭流(而不是等待流超时)。

If the initiating entity exceeds the number of retries, the receiving entity MUST close the stream with a stream error, which SHOULD be <policy-violation/> (Section 4.9.3.14), although some existing implementations send <not-authorized/> (Section 4.9.3.12) instead.

如果发起实体超过重试次数,接收实体必须关闭带有流错误的流,该错误应为<policy invalition/>(第4.9.3.14节),尽管某些现有实现发送<not authorized/>(第4.9.3.12节)。

Implementation Note: For server-to-server streams, if the receiving entity cannot offer the SASL EXTERNAL mechanism or any other SASL mechanism based on the security context established during TLS negotiation, the receiving entity MAY attempt to complete weak identity verification using the Server Dialback protocol [XEP-0220]; however, if according to local service policies weak identity verification is insufficient then the

实施说明:对于服务器到服务器的流,如果接收实体无法基于TLS协商期间建立的安全上下文提供SASL外部机制或任何其他SASL机制,则接收实体可以尝试使用服务器回拨协议[XEP-0220]完成弱身份验证;但是,如果根据本地服务策略,弱身份验证不足,则

receiving entity SHOULD instead close the stream with a <policy-violation/> stream error (Section 4.9.3.14) instead of waiting for the stream to time out.

接收实体应使用<policy invalition/>流错误(第4.9.3.14节)关闭流,而不是等待流超时。

6.4.6. SASL Success
6.4.6. SASL的成功

Before considering the SASL handshake to be a success, if the initiating entity provided a 'from' attribute on an initial stream header whose confidentiality and integrity were protected via TLS or an equivalent security layer (such as the SASL GSSAPI mechanism) then the receiving entity SHOULD correlate the authentication identity resulting from the SASL negotiation with that 'from' address; if the two identities do not match then the receiving entity SHOULD terminate the connection attempt (however, the receiving entity might have legitimate reasons not to terminate the connection attempt, for example, because it has overridden a connecting client's address to correct the JID format or assign a JID based on information presented in an end-user certificate).

在认为SASL握手成功之前,如果发起实体在其机密性和完整性通过TLS或等效安全层(如SASL GSSAPI机制)得到保护的初始流头上提供了“from”属性然后,接收实体应将SASL协商产生的身份验证标识与该“发件人”地址相关联;如果两个标识不匹配,则接收实体应终止连接尝试(但是,接收实体可能有正当理由不终止连接尝试,例如,因为它已覆盖连接客户端的地址以更正JID格式或根据最终用户证书中提供的信息分配JID)。

The receiving entity reports success of the handshake by sending a <success/> element qualified by the 'urn:ietf:params:xml:ns:xmpp-sasl' namespace; this element MAY contain XML character data (in SASL terminology, "additional data with success") if the chosen SASL mechanism supports or requires it. If the receiving entity needs to send additional data of zero length, it MUST transmit the data as a single equals sign character ("=").

接收实体通过发送由“urn:ietf:params:xml:ns:xmpp-sasl”命名空间限定的<success/>元素来报告握手成功;如果选择的SASL机制支持或需要XML字符数据,则该元素可能包含XML字符数据(在SASL术语中为“成功的附加数据”)。如果接收实体需要发送长度为零的附加数据,则必须以单个等号字符(“=”)的形式发送数据。

   R: <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
        
   R: <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
        

Informational Note: For client-to-server streams, the authorization identity communicated during SASL negotiation is used to determine the canonical address for the initiating client according to the receiving server, as described under Section 4.3.6.

信息性说明:对于客户端到服务器的流,SASL协商期间传递的授权标识用于根据接收服务器确定发起客户端的规范地址,如第4.3.6节所述。

Upon receiving the <success/> element, the initiating entity MUST initiate a new stream over the existing TCP connection by sending a new initial stream header to the receiving entity (as specified under Section 4.3.3, the initiating entity MUST NOT send a closing </stream> tag before sending the new initial stream header, since the receiving entity and initiating entity MUST consider the original stream to be replaced upon success of the SASL negotiation).

接收到<success/>元素后,发起实体必须通过向接收实体发送新的初始流头,通过现有TCP连接发起新流(如第4.3.3节所规定,在发送新的初始流报头之前,发起实体不能发送关闭<流>标签,因为接收实体和发起实体必须考虑在SASL协商成功后替换原始流)。

   I: <stream:stream
        from='juliet@im.example.com'
        to='im.example.com'
        version='1.0'
        xml:lang='en'
        xmlns='jabber:client'
        xmlns:stream='http://etherx.jabber.org/streams'>
        
   I: <stream:stream
        from='juliet@im.example.com'
        to='im.example.com'
        version='1.0'
        xml:lang='en'
        xmlns='jabber:client'
        xmlns:stream='http://etherx.jabber.org/streams'>
        

Upon receiving the new initial stream header from the initiating entity, the receiving entity MUST respond by sending a new response stream header to the initiating entity (for which it MUST generate a new stream ID instead of reusing the old stream ID).

从发起实体接收到新的初始流标头后,接收实体必须通过向发起实体发送新的响应流标头进行响应(它必须为发起实体生成新的流ID,而不是重用旧的流ID)。

   R: <stream:stream
        from='im.example.com'
        id='gPybzaOzBmaADgxKXu9UClbprp0='
        to='juliet@im.example.com'
        version='1.0'
        xml:lang='en'
        xmlns='jabber:client'
        xmlns:stream='http://etherx.jabber.org/streams'>
        
   R: <stream:stream
        from='im.example.com'
        id='gPybzaOzBmaADgxKXu9UClbprp0='
        to='juliet@im.example.com'
        version='1.0'
        xml:lang='en'
        xmlns='jabber:client'
        xmlns:stream='http://etherx.jabber.org/streams'>
        

The receiving entity MUST also send stream features, containing any further available features or containing no features (via an empty <features/> element).

接收实体还必须发送流特征,包含任何其他可用特征或不包含特征(通过空的<features/>元素)。

   R: <stream:features>
        <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
      </stream:features>
        
   R: <stream:features>
        <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
      </stream:features>
        
6.5. SASL Errors
6.5. SASL错误

The syntax of SASL errors is as follows, where the XML data shown within the square brackets '[' and ']' is OPTIONAL.

SASL错误的语法如下所示,其中方括号“[”和“]”中显示的XML数据是可选的。

   <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
     <defined-condition/>
     [<text xml:lang='langcode'>
         OPTIONAL descriptive text
     </text>]
   </failure>
        
   <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
     <defined-condition/>
     [<text xml:lang='langcode'>
         OPTIONAL descriptive text
     </text>]
   </failure>
        

The "defined-condition" MUST be one of the SASL-related error conditions defined in the following sections. However, because additional error conditions might be defined in the future, if an entity receives a SASL error condition that it does not understand then it MUST treat the unknown condition as a generic authentication failure, i.e., as equivalent to <not-authorized/> (Section 6.5.10).

“定义的条件”必须是以下章节中定义的与SASL相关的错误条件之一。但是,由于将来可能会定义其他错误条件,如果实体收到其不了解的SASL错误条件,则必须将未知条件视为通用身份验证失败,即等同于<not authorized/>(第6.5.10节)。

Inclusion of the <text/> element is OPTIONAL, and can be used to provide application-specific information about the error condition, which information MAY be displayed to a human but only as a supplement to the defined condition.

包含<text/>元素是可选的,可用于提供有关错误条件的特定于应用程序的信息,这些信息可以显示给人,但只能作为定义条件的补充。

Because XMPP itself defines an application profile of SASL and there is no expectation that more specialized XMPP applications will be built on top of SASL, the SASL error format does not provide extensibility for application-specific error conditions as is done for XML streams (Section 4.9.4) and XML stanzas (Section 8.3.4).

因为XMPP本身定义了SASL的应用程序配置文件,并且不期望在SASL之上构建更专业的XMPP应用程序,所以SASL错误格式不会像XML流(第4.9.4节)和XML节(第8.3.4节)那样为特定于应用程序的错误条件提供可扩展性。

6.5.1. aborted
6.5.1. 流产

The receiving entity acknowledges that the authentication handshake has been aborted by the initiating entity; sent in reply to the <abort/> element.

接收实体确认发起实体已中止认证握手;发送以回复<abort/>元素。

   I: <abort xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
        
   I: <abort xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
        
   R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        <aborted/>
      </failure>
        
   R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        <aborted/>
      </failure>
        
6.5.2. account-disabled
6.5.2. 帐户禁用

The account of the initiating entity has been temporarily disabled; sent in reply to an <auth/> element (with or without initial response data) or a <response/> element.

发起实体的账户已被临时禁用;发送以回复<auth/>元素(有或没有初始响应数据)或<response/>元素。

   I: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
            mechanism='PLAIN'>AGp1bGlldAByMG0zMG15cjBtMzA=</auth>
        
   I: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
            mechanism='PLAIN'>AGp1bGlldAByMG0zMG15cjBtMzA=</auth>
        
   R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        <account-disabled/>
        <text xml:lang='en'>Call 212-555-1212 for assistance.</text>
      </failure>
        
   R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        <account-disabled/>
        <text xml:lang='en'>Call 212-555-1212 for assistance.</text>
      </failure>
        
6.5.3. credentials-expired
6.5.3. 凭据已过期

The authentication failed because the initiating entity provided credentials that have expired; sent in reply to a <response/> element or an <auth/> element with initial response data.

身份验证失败,因为发起实体提供的凭据已过期;发送给带有初始响应数据的<response/>元素或<auth/>元素。

   I: <response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        [ ... ]
      </response>
        
   I: <response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        [ ... ]
      </response>
        
   R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        <credentials-expired/>
      </failure>
        
   R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        <credentials-expired/>
      </failure>
        
6.5.4. encryption-required
6.5.4. 需要加密

The mechanism requested by the initiating entity cannot be used unless the confidentiality and integrity of the underlying stream are protected (typically via TLS); sent in reply to an <auth/> element (with or without initial response data).

除非基础流的机密性和完整性得到保护(通常通过TLS),否则无法使用发起实体请求的机制;发送以回复<auth/>元素(有或没有初始响应数据)。

   I: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
            mechanism='PLAIN'>AGp1bGlldAByMG0zMG15cjBtMzA=</auth>
        
   I: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
            mechanism='PLAIN'>AGp1bGlldAByMG0zMG15cjBtMzA=</auth>
        
   R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        <encryption-required/>
      </failure>
        
   R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        <encryption-required/>
      </failure>
        
6.5.5. incorrect-encoding
6.5.5. 错误编码

The data provided by the initiating entity could not be processed because the base 64 encoding is incorrect (e.g., because the encoding does not adhere to the definition in Section 4 of [BASE64]); sent in reply to a <response/> element or an <auth/> element with initial response data.

无法处理发起实体提供的数据,因为base 64编码不正确(例如,因为编码不符合[BASE64]第4节中的定义);发送给带有初始响应数据的<response/>元素或<auth/>元素。

   I: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
            mechanism='DIGEST-MD5'>[ ... ]</auth>
        
   I: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
            mechanism='DIGEST-MD5'>[ ... ]</auth>
        
   R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        <incorrect-encoding/>
      </failure>
        
   R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        <incorrect-encoding/>
      </failure>
        
6.5.6. invalid-authzid
6.5.6. 无效的authzid

The authzid provided by the initiating entity is invalid, either because it is incorrectly formatted or because the initiating entity does not have permissions to authorize that ID; sent in reply to a <response/> element or an <auth/> element with initial response data.

发起实体提供的authzid无效,原因可能是格式不正确,或者发起实体没有授权该ID的权限;发送给带有初始响应数据的<response/>元素或<auth/>元素。

   I: <response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        [ ... ]
      </response>
        
   I: <response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        [ ... ]
      </response>
        
   R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        <invalid-authzid/>
      </failure>
        
   R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        <invalid-authzid/>
      </failure>
        
6.5.7. invalid-mechanism
6.5.7. 无效机制

The initiating entity did not specify a mechanism, or requested a mechanism that is not supported by the receiving entity; sent in reply to an <auth/> element.

发起实体未指定机制,或请求接收实体不支持的机制;作为对<auth/>元素的回复发送。

   I: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
            mechanism='CRAM-MD5'/>
        
   I: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
            mechanism='CRAM-MD5'/>
        
   R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        <invalid-mechanism/>
      </failure>
        
   R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        <invalid-mechanism/>
      </failure>
        
6.5.8. malformed-request
6.5.8. 格式错误的请求

The request is malformed (e.g., the <auth/> element includes initial response data but the mechanism does not allow that, or the data sent violates the syntax for the specified SASL mechanism); sent in reply to an <abort/>, <auth/>, <challenge/>, or <response/> element.

请求格式不正确(例如,<auth/>元素包含初始响应数据,但机制不允许,或者发送的数据违反了指定SASL机制的语法);作为对<abort/>、<auth/>、<challenge/>或<response/>元素的回复发送。

(In the following example, the XML character data of the <auth/> element contains more than 255 UTF-8-encoded Unicode characters and therefore violates the "token" production for the SASL ANONYMOUS mechanism as specified in [ANONYMOUS].)

(在下面的示例中,<auth/>元素的XML字符数据包含超过255个UTF-8编码的Unicode字符,因此违反了[ANONYMOUS]中指定的SASL匿名机制的“令牌”生成。)

   I: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
            mechanism='ANONYMOUS'>[ ... some-long-token ... ]</auth>
        
   I: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
            mechanism='ANONYMOUS'>[ ... some-long-token ... ]</auth>
        
   R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        <malformed-request/>
      </failure>
        
   R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        <malformed-request/>
      </failure>
        
6.5.9. mechanism-too-weak
6.5.9. 机制太弱

The mechanism requested by the initiating entity is weaker than server policy permits for that initiating entity; sent in reply to an <auth/> element (with or without initial response data).

发起实体请求的机制弱于该发起实体的服务器策略许可;发送以回复<auth/>元素(有或没有初始响应数据)。

   I: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
            mechanism='PLAIN'>AGp1bGlldAByMG0zMG15cjBtMzA=</auth>
        
   I: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
            mechanism='PLAIN'>AGp1bGlldAByMG0zMG15cjBtMzA=</auth>
        
   R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        <mechanism-too-weak/>
      </failure>
        
   R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        <mechanism-too-weak/>
      </failure>
        
6.5.10. not-authorized
6.5.10. 未授权

The authentication failed because the initiating entity did not provide proper credentials, or because some generic authentication failure has occurred but the receiving entity does not wish to disclose specific information about the cause of the failure; sent in reply to a <response/> element or an <auth/> element with initial response data.

认证失败是因为发起实体没有提供适当的凭证,或者因为发生了某些通用认证失败,但接收实体不希望披露有关失败原因的特定信息;发送给带有初始响应数据的<response/>元素或<auth/>元素。

   I: <response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        [ ... ]
      </response>
        
   I: <response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        [ ... ]
      </response>
        
   R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        <not-authorized/>
      </failure>
        
   R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        <not-authorized/>
      </failure>
        

Security Warning: This error condition includes but is not limited to the case of incorrect credentials or a nonexistent username. In order to discourage directory harvest attacks, no differentiation is made between incorrect credentials and a nonexistent username.

安全警告:此错误情况包括但不限于凭据不正确或用户名不存在的情况。为了阻止目录捕获攻击,不区分不正确的凭据和不存在的用户名。

6.5.11. temporary-auth-failure
6.5.11. 临时身份验证失败

The authentication failed because of a temporary error condition within the receiving entity, and it is advisable for the initiating entity to try again later; sent in reply to an <auth/> element or a <response/> element.

由于接收实体内的临时错误情况,身份验证失败,建议发起实体稍后重试;作为对<auth/>元素或<response/>元素的回复发送。

   I: <response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        [ ... ]
      </response>
        
   I: <response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        [ ... ]
      </response>
        
   R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        <temporary-auth-failure/>
      </failure>
        
   R: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        <temporary-auth-failure/>
      </failure>
        
6.6. SASL Definition
6.6. SASL定义

The profiling requirements of [SASL] require that the following information be supplied by the definition of a using protocol.

[SASL]的评测要求通过使用协议的定义提供以下信息。

service name: "xmpp"

服务名称:“xmpp”

initiation sequence: After the initiating entity provides an opening XML stream header and the receiving entity replies in kind, the receiving entity provides a list of acceptable authentication

发起顺序:在发起实体提供一个打开的XML流头并且接收实体以实物形式回复之后,接收实体提供一个可接受的身份验证列表

methods. The initiating entity chooses one method from the list and sends it to the receiving entity as the value of the 'mechanism' attribute possessed by an <auth/> element, optionally including an initial response to avoid a round trip.

方法。发起实体从列表中选择一种方法,并将其作为<auth/>元素拥有的“机制”属性的值发送给接收实体,可选地包括初始响应以避免往返。

exchange sequence: Challenges and responses are carried through the exchange of <challenge/> elements from receiving entity to initiating entity and <response/> elements from initiating entity to receiving entity. The receiving entity reports failure by sending a <failure/> element and success by sending a <success/> element; the initiating entity aborts the exchange by sending an <abort/> element. Upon successful negotiation, both sides consider the original XML stream to be closed and new stream headers are sent by both entities.

交换顺序:挑战和响应通过从接收实体到发起实体的<challenge/>元素交换和从发起实体到接收实体的<response/>元素交换进行。接收实体通过发送<failure/>元素报告失败,通过发送<success/>元素报告成功;发起实体通过发送<abort/>元素中止交换。在成功的协商之后,双方都认为原始XML流被关闭,并且两个实体都发送新的流头。

security layer negotiation: The security layer takes effect immediately after sending the closing '>' character of the <success/> element for the receiving entity, and immediately after receiving the closing '>' character of the <success/> element for the initiating entity. The order of layers is first [TCP], then [TLS], then [SASL], then XMPP.

安全层协商:安全层在发送接收实体的<success/>元素的结束'>'字符后立即生效,在接收发起实体的<success/>元素的结束'>'字符后立即生效。层的顺序首先是[TCP],然后是[TLS],然后是[SASL],然后是XMPP。

use of the authorization identity: The authorization identity can be used in XMPP to denote the non-default <localpart@domainpart> of a client; an empty string is equivalent to an absent authorization identity.

授权标识的使用:授权标识可在XMPP中用于表示非默认值<localpart@domainpart>客户的授权;空字符串相当于缺少授权标识。

7. Resource Binding
7. 资源绑定
7.1. Fundamentals
7.1. 基本原理

After a client authenticates with a server, it MUST bind a specific resource to the stream so that the server can properly address the client. That is, there MUST be an XMPP resource associated with the bare JID (<localpart@domainpart>) of the client, so that the address for use over that stream is a full JID of the form <localpart@domainpart/resource> (including the resourcepart). This ensures that the server can deliver XML stanzas to and receive XML stanzas from the client in relation to entities other than the server itself or the client's account, as explained under Section 10.

客户端与服务器进行身份验证后,它必须将特定资源绑定到流,以便服务器能够正确地为客户端寻址。也就是说,必须有一个XMPP资源与裸JID关联(<localpart@domainpart>),以便在该流上使用的地址是表单的完整JID<localpart@domainpart/resource>(包括resourcepart)。这确保了服务器可以向客户机发送XML节,并从客户机接收与服务器本身或客户机帐户以外的实体相关的XML节,如第10节所述。

Informational Note: The client could exchange stanzas with the server itself or the client's account before binding a resource since the full JID is needed only for addressing outside the context of the stream negotiated between the client and the server, but this is not commonly done.

信息性说明:客户机可以在绑定资源之前与服务器本身或客户机的帐户交换节,因为完整的JID仅用于在客户机和服务器之间协商的流的上下文之外进行寻址,但这通常不是这样做的。

After a client has bound a resource to the stream, it is referred to as a "connected resource". A server SHOULD allow an entity to maintain multiple connected resources simultaneously, where each connected resource is associated with a distinct XML stream and is differentiated from the other connected resources by a distinct resourcepart.

客户端将资源绑定到流之后,它被称为“连接的资源”。服务器应该允许一个实体同时维护多个连接的资源,其中每个连接的资源与一个不同的XML流相关联,并通过一个不同的resourcepart与其他连接的资源相区别。

Security Warning: A server SHOULD enable the administrator of an XMPP service to limit the number of connected resources in order to prevent certain denial-of-service attacks as described under Section 13.12.

安全警告:服务器应使XMPP服务的管理员能够限制连接资源的数量,以防止第13.12节所述的某些拒绝服务攻击。

If, before completing the resource binding step, the client attempts to send an XML stanza to an entity other than the server itself or the client's account, the server MUST NOT process the stanza and MUST close the stream with a <not-authorized/> stream error (Section 4.9.3.12).

如果在完成资源绑定步骤之前,客户机试图向服务器本身或客户机帐户以外的实体发送XML节,则服务器不得处理该节,并且必须以<NOT authorized/>流错误关闭该流(第4.9.3.12节)。

The XML namespace name for the resource binding extension is 'urn:ietf:params:xml:ns:xmpp-bind'.

资源绑定扩展的XML命名空间名称为“urn:ietf:params:XML:ns:xmpp-bind”。

7.2. Support
7.2. 支持

Support for resource binding is REQUIRED in XMPP client and server implementations.

XMPP客户机和服务器实现中需要支持资源绑定。

7.3. Stream Negotiation Rules
7.3. 流协商规则
7.3.1. Mandatory-to-Negotiate
7.3.1. 强制谈判

The parties to a stream MUST consider resource binding as mandatory-to-negotiate.

流各方必须考虑资源绑定作为谈判的强制性。

7.3.2. Restart
7.3.2. 重新启动

After resource binding, the parties MUST NOT restart the stream.

资源绑定后,各方不得重新启动流。

7.4. Advertising Support
7.4. 广告支持

Upon sending a new response stream header to the client after successful SASL negotiation, the server MUST include a <bind/> element qualified by the 'urn:ietf:params:xml:ns:xmpp-bind' namespace in the stream features it presents to the client.

SASL协商成功后,向客户端发送新的响应流头时,服务器必须在其呈现给客户端的流功能中包含一个由“urn:ietf:params:xml:ns:xmpp bind”命名空间限定的<bind/>元素。

The server MUST NOT include the resource binding stream feature until after the client has authenticated, typically by means of successful SASL negotiation.

在客户端通过身份验证(通常是通过成功的SASL协商)之前,服务器不得包含资源绑定流功能。

   S: <stream:stream
          from='im.example.com'
          id='gPybzaOzBmaADgxKXu9UClbprp0='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   S: <stream:stream
          from='im.example.com'
          id='gPybzaOzBmaADgxKXu9UClbprp0='
          to='juliet@im.example.com'
          version='1.0'
          xml:lang='en'
          xmlns='jabber:client'
          xmlns:stream='http://etherx.jabber.org/streams'>
        
   S: <stream:features>
        <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
      </stream:features>
        
   S: <stream:features>
        <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
      </stream:features>
        

Upon being informed that resource binding is mandatory-to-negotiate, the client MUST bind a resource to the stream as described in the following sections.

当被告知协商必须进行资源绑定时,客户端必须将资源绑定到流,如以下部分所述。

7.5. Generation of Resource Identifiers
7.5. 资源标识符的生成

A resourcepart MUST at a minimum be unique among the connected resources for that <localpart@domainpart>. Enforcement of this policy is the responsibility of the server.

resourcepart必须至少在连接的资源中是唯一的<localpart@domainpart>. 此策略的实施由服务器负责。

Security Warning: A resourcepart can be security-critical. For example, if a malicious entity can guess a client's resourcepart then it might be able to determine if the client (and therefore the controlling principal) is online or offline, thus resulting in a presence leak as described under Section 13.10.2. To prevent that possibility, a client can either (1) generate a random resourcepart on its own or (2) ask the server to generate a resourcepart on its behalf. One method for ensuring that the resourcepart is random is to generate a Universally Unique Identifier (UUID) as specified in [UUID].

安全警告:resourcepart可能是安全关键的。例如,如果恶意实体可以猜测客户端的resourcepart,那么它可能能够确定客户端(以及控制主体)是在线还是离线,从而导致出现第13.10.2节所述的状态泄漏。为了防止这种可能性,客户机可以(1)自行生成随机resourcepart,或者(2)请求服务器代表其生成resourcepart。确保resourcepart是随机的一种方法是生成[UUID]中指定的通用唯一标识符(UUID)。

7.6. Server-Generated Resource Identifier
7.6. 服务器生成的资源标识符

A server MUST be able to generate an XMPP resourcepart on behalf of a client. The resourcepart generated by the server MUST be random (see [RANDOM]).

服务器必须能够代表客户端生成XMPP resourcepart。服务器生成的resourcepart必须是随机的(请参见[random])。

7.6.1. Success Case
7.6.1. 成功案例

A client requests a server-generated resourcepart by sending an IQ stanza of type "set" (see Section 8.2.3) containing an empty <bind/> element qualified by the 'urn:ietf:params:xml:ns:xmpp-bind' namespace.

客户端通过发送“set”类型的IQ节(参见第8.2.3节)请求服务器生成的resourcepart,该IQ节包含由“urn:ietf:params:xml:ns:xmpp bind”命名空间限定的空<bind/>元素。

   C: <iq id='tn281v37' type='set'>
       <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
      </iq>
        
   C: <iq id='tn281v37' type='set'>
       <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
      </iq>
        

Once the server has generated an XMPP resourcepart for the client, it MUST return an IQ stanza of type "result" to the client, which MUST include a <jid/> child element that specifies the full JID for the connected resource as determined by the server.

一旦服务器为客户端生成了XMPP resourcepart,它就必须向客户端返回一个类型为“result”的IQ节,该IQ节必须包含一个<jid/>子元素,该子元素指定由服务器确定的连接资源的完整jid。

   S: <iq id='tn281v37' type='result'>
       <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
         <jid>
           juliet@im.example.com/4db06f06-1ea4-11dc-aca3-000bcd821bfb
         </jid>
       </bind>
      </iq>
        
   S: <iq id='tn281v37' type='result'>
       <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
         <jid>
           juliet@im.example.com/4db06f06-1ea4-11dc-aca3-000bcd821bfb
         </jid>
       </bind>
      </iq>
        
7.6.2. Error Cases
7.6.2. 错误案例

When a client asks the server to generate a resourcepart during resource binding, the following stanza error conditions are defined:

当客户端要求服务器在资源绑定期间生成resourcepart时,将定义以下节错误条件:

o The account has reached a limit on the number of simultaneous connected resources allowed.

o 该帐户已达到允许同时连接的资源数的限制。

o The client is otherwise not allowed to bind a resource to the stream.

o 否则,不允许客户端将资源绑定到流。

Naturally, it is possible that error conditions not specified here might occur, as described under Section 8.3.

当然,可能会出现第8.3节所述的错误条件,此处未规定。

7.6.2.1. Resource Constraint
7.6.2.1. 资源约束

If the account has reached a limit on the number of simultaneous connected resources allowed, the server MUST return a <resource-constraint/> stanza error (Section 8.3.3.18).

如果帐户已达到允许同时连接的资源数量限制,服务器必须返回<resource constraint/>节错误(第8.3.3.18节)。

   S: <iq id='tn281v37' type='error'>
        <error type='wait'>
          <resource-constraint
              xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </iq>
        
   S: <iq id='tn281v37' type='error'>
        <error type='wait'>
          <resource-constraint
              xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </iq>
        
7.6.2.2. Not Allowed
7.6.2.2. 不准

If the client is otherwise not allowed to bind a resource to the stream, the server MUST return a <not-allowed/> stanza error (Section 8.3.3.10).

如果不允许客户端将资源绑定到流,则服务器必须返回<not allowed/>节错误(第8.3.3.10节)。

   S: <iq id='tn281v37' type='error'>
        <error type='cancel'>
          <not-allowed
              xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </iq>
        
   S: <iq id='tn281v37' type='error'>
        <error type='cancel'>
          <not-allowed
              xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </iq>
        
7.7. Client-Submitted Resource Identifier
7.7. 客户端提交的资源标识符

Instead of asking the server to generate a resourcepart on its behalf, a client MAY attempt to submit a resourcepart that it has generated or that the controlling user has provided.

客户机可以尝试提交其已生成或控制用户已提供的resourcepart,而不是请求服务器代表其生成resourcepart。

7.7.1. Success Case
7.7.1. 成功案例

A client asks its server to accept a client-submitted resourcepart by sending an IQ stanza of type "set" containing a <bind/> element with a child <resource/> element containing non-zero-length XML character data.

客户端要求其服务器通过发送包含<bind/>元素的“set”类型IQ节和包含非零长度XML字符数据的子<resource/>元素来接受客户端提交的resourcepart。

   C: <iq id='wy2xa82b4' type='set'>
        <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
          <resource>balcony</resource>
        </bind>
      </iq>
        
   C: <iq id='wy2xa82b4' type='set'>
        <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
          <resource>balcony</resource>
        </bind>
      </iq>
        

The server SHOULD accept the client-submitted resourcepart. It does so by returning an IQ stanza of type "result" to the client, including a <jid/> child element that specifies the full JID for the connected resource and contains without modification the client-submitted text.

服务器应接受客户端提交的resourcepart。它通过将类型为“result”的IQ节返回给客户机来实现,其中包括一个子元素<jid/>,该子元素指定连接资源的完整jid,并包含客户机提交的文本,而无需修改。

   S: <iq id='wy2xa82b4' type='result'>
       <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
         <jid>juliet@im.example.com/balcony</jid>
       </bind>
      </iq>
        
   S: <iq id='wy2xa82b4' type='result'>
       <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
         <jid>juliet@im.example.com/balcony</jid>
       </bind>
      </iq>
        

Alternatively, in accordance with local service policies the server MAY refuse the client-submitted resourcepart and override it with a resourcepart that the server generates.

或者,根据本地服务策略,服务器可以拒绝客户端提交的resourcepart,并使用服务器生成的resourcepart覆盖它。

   S: <iq id='wy2xa82b4' type='result'>
       <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
         <jid>
      juliet@im.example.com/balcony 4db06f06-1ea4-11dc-aca3-000bcd821bfb
         </jid>
       </bind>
      </iq>
        
   S: <iq id='wy2xa82b4' type='result'>
       <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
         <jid>
      juliet@im.example.com/balcony 4db06f06-1ea4-11dc-aca3-000bcd821bfb
         </jid>
       </bind>
      </iq>
        
7.7.2. Error Cases
7.7.2. 错误案例

When a client attempts to submit its own XMPP resourcepart during resource binding, the following stanza error conditions are defined in addition to those described under Section 7.6.2:

当客户端在资源绑定期间尝试提交其自己的XMPP resourcepart时,除了第7.6.2节中描述的错误条件外,还定义了以下节错误条件:

o The provided resourcepart cannot be processed by the server.

o 服务器无法处理提供的resourcepart。

o The provided resourcepart is already in use.

o 提供的resourcepart已在使用中。

Naturally, it is possible that error conditions not specified here might occur, as described under Section 8.3.

当然,可能会出现第8.3节所述的错误条件,此处未规定。

7.7.2.1. Bad Request
7.7.2.1. 错误的请求

If the provided resourcepart cannot be processed by the server (e.g., because it is of zero length or because it otherwise violates the rules for resourceparts specified in [XMPP-ADDR]), the server can return a <bad-request/> stanza error (Section 8.3.3.1) but SHOULD instead process the resourcepart so that it is in conformance.

如果服务器无法处理提供的resourcepart(例如,因为它的长度为零,或者因为它违反了[XMPP-ADDR]中规定的resourcepart规则),则服务器可以返回<bad request/>节错误(第8.3.3.1节),但应改为处理resourcepart以使其符合要求。

   S: <iq id='wy2xa82b4' type='error'>
        <error type='modify'>
          <bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </iq>
        
   S: <iq id='wy2xa82b4' type='error'>
        <error type='modify'>
          <bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </iq>
        
7.7.2.2. Conflict
7.7.2.2. 冲突

If there is a currently connected client whose session has the resourcepart being requested by the newly connecting client, the server MUST do one of the following (which of these the server does is a matter for implementation or local service policy, although suggestions are provided below).

如果当前连接的客户机的会话中有新连接的客户机请求的resourcepart,则服务器必须执行以下操作之一(服务器执行哪项操作取决于实现或本地服务策略,尽管下面提供了建议)。

1. Override the resourcepart provided by the newly connecting client with a server-generated resourcepart. This behavior is encouraged, because it simplifies the resource binding process for client implementations.

1. 使用服务器生成的resourcepart覆盖新连接的客户端提供的resourcepart。鼓励这种行为,因为它简化了客户端实现的资源绑定过程。

2. Disallow the resource binding attempt of the newly connecting client and maintain the session of the currently connected client. This behavior is neither encouraged nor discouraged, despite the fact that it was implicitly encouraged in RFC 3920; however, note that handling of the <conflict/> error is unevenly supported among existing client implementations, which often treat it as an authentication error and have been observed to discard cached credentials when receiving it.

2. 禁止新连接客户端的资源绑定尝试,并维护当前连接客户端的会话。这种行为既不被鼓励也不被劝阻,尽管RFC 3920中暗中鼓励了这种行为;但是,请注意,现有客户机实现对<conflict/>错误的处理支持不均衡,它们通常将其视为身份验证错误,并观察到在接收时丢弃缓存的凭据。

3. Terminate the session of the currently connected client and allow the resource binding attempt of the newly connecting client. Although this was the traditional behavior of early XMPP server implementations, it is now discouraged because it can lead to a never-ending cycle of two clients effectively disconnecting each other; however, note that this behavior can be appropriate in some deployment scenarios or if the server knows that the currently connected client has a dead connection or broken stream as described under Section 4.6.

3. 终止当前连接客户端的会话,并允许新连接客户端的资源绑定尝试。虽然这是早期XMPP服务器实现的传统行为,但现在不鼓励这样做,因为这会导致两个客户端之间的无休止的有效断开连接;但是,请注意,在某些部署场景中,或者如果服务器知道当前连接的客户端具有第4.6节所述的死连接或断流,则此行为可能是适当的。

If the server follows behavior #1, it returns an <iq/> stanza of type "result" to the newly connecting client, where the <jid/> child of the <bind/> element contains XML character data that indicates the full JID of the client, including the resourcepart that was generated by the server.

如果服务器遵循行为#1,它将向新连接的客户端返回类型为“result”的<iq/>节,其中<bind/>元素的<jid/>子元素包含指示客户端完整jid的XML字符数据,包括服务器生成的resourcepart。

   S: <iq id='wy2xa82b4' type='result'>
       <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
         <jid>
      juliet@im.example.com/balcony 4db06f06-1ea4-11dc-aca3-000bcd821bfb
         </jid>
       </bind>
      </iq>
        
   S: <iq id='wy2xa82b4' type='result'>
       <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
         <jid>
      juliet@im.example.com/balcony 4db06f06-1ea4-11dc-aca3-000bcd821bfb
         </jid>
       </bind>
      </iq>
        

If the server follows behavior #2, it sends a <conflict/> stanza error (Section 8.3.3.2) in response to the resource binding attempt of the newly connecting client but maintains the XML stream so that the newly connecting client has an opportunity to negotiate a non-conflicting resourcepart (i.e., the newly connecting client needs to choose a different resourcepart before making another attempt to bind a resource).

如果服务器遵循行为#2,它会发送一个<conflict/>节错误(第8.3.3.2节),以响应新连接的客户端的资源绑定尝试,但会维护XML流,以便新连接的客户端有机会协商非冲突的resourcepart(即,新连接的客户端需要在再次尝试绑定资源之前选择不同的resourcepart)。

   S: <iq id='wy2xa82b4' type='error'>
        <error type='modify'>
          <conflict xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </iq>
        
   S: <iq id='wy2xa82b4' type='error'>
        <error type='modify'>
          <conflict xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </iq>
        

If the server follows behavior #3, it returns a <conflict/> stream error (Section 4.9.3.3) to the currently connected client (as described under Section 4.9.3.3) and returns an IQ stanza of type "result" (indicating success) in response to the resource binding attempt of the newly connecting client.

如果服务器遵循行为#3,它将向当前连接的客户端返回<conflict/>流错误(第4.9.3.3节)(如第4.9.3.3节所述),并返回类型为“result”(表示成功)的IQ节,以响应新连接客户端的资源绑定尝试。

   S: <iq id='wy2xa82b4' type='result'>
        <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
          <jid>
            juliet@im.example.com/balcony
          </jid>
        </bind>
      </iq>
        
   S: <iq id='wy2xa82b4' type='result'>
        <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
          <jid>
            juliet@im.example.com/balcony
          </jid>
        </bind>
      </iq>
        
7.7.3. Retries
7.7.3. 重试

If an error occurs when a client submits a resourcepart, the server SHOULD allow a configurable but reasonable number of retries (at least 5 and no more than 10); this enables the client to tolerate incorrectly provided resourceparts (e.g., bad data formats or duplicate text strings) without being forced to reconnect.

如果客户端提交resourcepart时出错,服务器应允许可配置但合理的重试次数(至少5次,但不超过10次);这使客户端能够容忍错误提供的ResourcePart(例如,错误的数据格式或重复的文本字符串),而无需强制重新连接。

After the client has reached the retry limit, the server MUST close the stream with a <policy-violation/> stream error (Section 4.9.3.14).

客户端达到重试限制后,服务器必须关闭流,并出现<policy invalition/>流错误(第4.9.3.14节)。

8. XML Stanzas
8. XML节

After a client and a server (or two servers) have completed stream negotiation, either party can send XML stanzas. Three kinds of XML stanza are defined for the 'jabber:client' and 'jabber:server' namespaces: <message/>, <presence/>, and <iq/>. In addition, there are five common attributes for these stanza types. These common attributes, as well as the basic semantics of the three stanza types, are defined in this specification; more detailed information regarding the syntax of XML stanzas for instant messaging and presence applications is provided in [XMPP-IM], and for other applications in the relevant XMPP extension specifications.

在客户端和服务器(或两台服务器)完成流协商后,任何一方都可以发送XML节。为“jabber:client”和“jabber:server”名称空间定义了三种XML节:<message/>、<presence/>和<iq/>。此外,这些节类型还有五个常见属性。这些公共属性以及三个节类型的基本语义在本规范中定义;[XMPP-IM]中提供了有关即时消息和状态应用程序的XML节语法的更详细信息,相关XMPP扩展规范中也提供了有关其他应用程序的XML节语法的详细信息。

Support for the XML stanza syntax and semantics defined in this specification is REQUIRED in XMPP client and server implementations.

XMPP客户机和服务器实现中需要支持本规范中定义的XML节语法和语义。

Security Warning: A server MUST NOT process a partial stanza and MUST NOT attach meaning to the transmission timing of any part of a stanza (before receipt of the closing tag).

安全警告:服务器不得处理部分节,也不得将意义附加到节的任何部分的传输定时(在收到结束标记之前)。

8.1. Common Attributes
8.1. 共同属性

The following five attributes are common to message, presence, and IQ stanzas.

以下五个属性是消息、状态和IQ节共有的。

8.1.1. to
8.1.1. 到

The 'to' attribute specifies the JID of the intended recipient for the stanza.

“to”属性指定节的预期收件人的JID。

   <message to='romeo@example.net'>
     <body>Art thou not Romeo, and a Montague?</body>
   </message>
        
   <message to='romeo@example.net'>
     <body>Art thou not Romeo, and a Montague?</body>
   </message>
        

For information about server processing of inbound and outbound XML stanzas based on the 'to' address, refer to Section 10.

有关服务器根据“to”地址处理入站和出站XML节的信息,请参阅第10节。

8.1.1.1. Client-to-Server Streams
8.1.1.1. 客户端到服务器流

The following rules apply to inclusion of the 'to' attribute in stanzas sent from a connected client to its server over an XML stream qualified by the 'jabber:client' namespace.

以下规则适用于在通过“jabber:client”命名空间限定的XML流从连接的客户端发送到其服务器的节中包含“to”属性。

1. A stanza with a specific intended recipient (e.g., a conversation partner, a remote service, the server itself, even another resource associated with the user's bare JID) MUST possess a 'to' attribute whose value is an XMPP address.

1. 具有特定预期收件人(例如,对话伙伴、远程服务、服务器本身,甚至与用户的裸JID相关联的另一个资源)的节必须具有“to”属性,其值为XMPP地址。

2. A stanza sent from a client to a server for direct processing by the server (e.g., roster processing as described in [XMPP-IM] or presence sent to the server for broadcasting to other entities) MUST NOT possess a 'to' attribute.

2. 从客户端发送到服务器以供服务器直接处理的节(例如,[XMPP-IM]中描述的花名册处理或发送到服务器以向其他实体广播的状态)不得具有“to”属性。

The following rules apply to inclusion of the 'to' attribute in stanzas sent from a server to a connected client over an XML stream qualified by the 'jabber:client' namespace.

以下规则适用于在通过“jabber:client”命名空间限定的XML流从服务器发送到连接的客户端的节中包含“to”属性。

1. If the server has received the stanza from another connected client or from a peer server, the server MUST NOT modify the 'to' address before delivering the stanza to the client.

1. 如果服务器已从另一个连接的客户端或对等服务器接收到节,则服务器在将节传递给客户端之前不得修改“收件人”地址。

2. If the server has itself generated the stanza (e.g., a response to an IQ stanza of type "get" or "set", even if the stanza did not include a 'to' address), the stanza MAY include a 'to' address, which MUST be the full JID of the client; however, if the stanza does not include a 'to' address then the client MUST treat it as if the 'to' address were included with a value of the client's full JID.

2. 如果服务器本身已经生成了节(例如,对类型为“get”或“set”的IQ节的响应,即使该节不包括“to”地址),该节可能包括“to”地址,该地址必须是客户端的完整JID;但是,如果该节不包含“收件人”地址,则客户必须将其视为“收件人”地址包含了客户的完整JID值。

Implementation Note: It is the server's responsibility to deliver only stanzas that are addressed to the client's full JID or the user's bare JID; thus, there is no need for the client to check the 'to' address of incoming stanzas. However, if the client does check the 'to' address then it is suggested to check at most the bare JID portion (not the full JID), since the 'to' address might be the user's bare JID, the client's current full JID, or even a full JID with a different resourcepart (e.g., in the case of so-called "offline messages" as described in [XEP-0160]).

实现说明:服务器的责任是仅交付指向客户端完整JID或用户裸JID的节;因此,客户端不需要检查传入节的“to”地址。但是,如果客户端确实检查了“收件人”地址,则建议最多检查裸JID部分(而不是完整JID),因为“收件人”地址可能是用户的裸JID、客户端的当前完整JID,甚至是具有不同资源部分的完整JID(例如,在[XEP-0160]中描述的所谓“脱机消息”的情况下)。

8.1.1.2. Server-to-Server Streams
8.1.1.2. 服务器到服务器流

The following rules apply to inclusion of the 'to' attribute in the context of XML streams qualified by the 'jabber:server' namespace (i.e., server-to-server streams).

以下规则适用于在“jabber:server”命名空间限定的XML流上下文中包含“to”属性(即服务器到服务器流)。

1. A stanza MUST possess a 'to' attribute whose value is an XMPP address; if a server receives a stanza that does not meet this restriction, it MUST close the stream with an <improper-addressing/> stream error (Section 4.9.3.7).

1. 节必须具有值为XMPP地址的“to”属性;如果服务器接收到不符合此限制的节,则它必须关闭流,并出现<不正确寻址/>流错误(第4.9.3.7节)。

2. The domainpart of the JID contained in the stanza's 'to' attribute MUST match the FQDN of the receiving server (or any validated domain thereof) as communicated via SASL negotiation (see Section 6), Server Dialback (see [XEP-0220]), or similar means; if a server receives a stanza that does not meet this restriction, it MUST close the stream with a <host-unknown/> stream error (Section 4.9.3.6) or a <host-gone/> stream error (Section 4.9.3.5).

2. 节的“to”属性中包含的JID域部分必须与通过SASL协商(见第6节)、服务器回拨(见[XEP-0220])或类似方式传输的接收服务器(或其任何验证域)的FQDN相匹配;如果服务器接收到不符合此限制的节,则必须以<host unknown/>流错误(第4.9.3.6节)或<host gone/>流错误(第4.9.3.5节)关闭流。

8.1.2. from
8.1.2. 从…起

The 'from' attribute specifies the JID of the sender.

“from”属性指定发件人的JID。

   <message from='juliet@im.example.com/balcony'
            to='romeo@example.net'>
     <body>Art thou not Romeo, and a Montague?</body>
   </message>
        
   <message from='juliet@im.example.com/balcony'
            to='romeo@example.net'>
     <body>Art thou not Romeo, and a Montague?</body>
   </message>
        
8.1.2.1. Client-to-Server Streams
8.1.2.1. 客户端到服务器流

The following rules apply to the 'from' attribute in the context of XML streams qualified by the 'jabber:client' namespace (i.e., client-to-server streams).

以下规则适用于“jabber:client”命名空间限定的XML流上下文中的“from”属性(即,客户端到服务器的流)。

1. When a server receives an XML stanza from a connected client, the server MUST add a 'from' attribute to the stanza or override the 'from' attribute specified by the client, where the value of the

1. 当服务器从连接的客户端接收到XML节时,服务器必须向该节添加“from”属性,或覆盖客户端指定的“from”属性,其中

'from' attribute MUST be the full JID (<localpart@domainpart/resource>) determined by the server for the connected resource that generated the stanza (see Section 4.3.6), or the bare JID (<localpart@domainpart>) in the case of subscription-related presence stanzas (see [XMPP-IM]).

“from”属性必须是完整的JID(<localpart@domainpart/资源>),由服务器为生成节(见第4.3.6节)或裸JID的连接资源确定(<localpart@domainpart>)对于订阅相关的状态节(参见[XMPP-IM])。

2. When the server generates a stanza on its own behalf for delivery to the client from the server itself, the stanza MUST include a 'from' attribute whose value is the bare JID (i.e., <domainpart>) of the server as agreed upon during stream negotiation (e.g., based on the 'to' attribute of the initial stream header).

2. 当服务器代表自己生成节以从服务器本身交付给客户机时,该节必须包含一个“from”属性,其值为流协商期间商定的服务器的裸JID(即,<domainpart>)(例如,基于初始流头的“to”属性)。

3. When the server generates a stanza from the server for delivery to the client on behalf of the account of the connected client (e.g., in the context of data storage services provided by the server on behalf of the client), the stanza MUST either (a) not include a 'from' attribute or (b) include a 'from' attribute whose value is the account's bare JID (<localpart@domainpart>).

3. 当服务器从服务器生成节以代表连接的客户端的帐户传递到客户端时(例如,在服务器代表客户端提供数据存储服务的上下文中),节必须(a)不包括“from”属性或(b)包括一个“from”属性,其值为帐户的裸JID(<localpart@domainpart>).

4. A server MUST NOT send to the client a stanza without a 'from' attribute if the stanza was not generated by the server on its own behalf (e.g., if it was generated by another client or a peer server and the server is merely delivering it to the client on behalf of some other entity); therefore, when a client receives a stanza that does not include a 'from' attribute, it MUST assume that the stanza is from the user's account on the server.

4. 如果节不是由服务器代表其自身生成的(例如,如果节是由另一个客户端或对等服务器生成的,并且服务器仅代表其他实体将其交付给客户端),则服务器不得向客户端发送没有“from”属性的节;因此,当客户端收到不包含“from”属性的节时,它必须假定该节来自服务器上用户的帐户。

8.1.2.2. Server-to-Server Streams
8.1.2.2. 服务器到服务器流

The following rules apply to the 'from' attribute in the context of XML streams qualified by the 'jabber:server' namespace (i.e., server-to-server streams).

以下规则适用于“jabber:server”命名空间限定的XML流上下文中的“from”属性(即服务器到服务器的流)。

1. A stanza MUST possess a 'from' attribute whose value is an XMPP address; if a server receives a stanza that does not meet this restriction, it MUST close the stream with an <improper-addressing/> stream error (Section 4.9.3.7).

1. 节必须具有值为XMPP地址的“from”属性;如果服务器接收到不符合此限制的节,则它必须关闭流,并出现<不正确寻址/>流错误(第4.9.3.7节)。

2. The domainpart of the JID contained in the stanza's 'from' attribute MUST match the FQDN of the sending server (or any validated domain thereof) as communicated via SASL negotiation (see Section 6), Server Dialback (see [XEP-0220]), or similar means; if a server receives a stanza that does not meet this restriction, it MUST close the stream with an <invalid-from/> stream error (Section 4.9.3.9).

2. 节的“from”属性中包含的JID域部分必须与通过SASL协商(见第6节)、服务器回拨(见[XEP-0220])或类似方式传输的发送服务器(或其任何验证域)的FQDN相匹配;如果服务器收到不符合此限制的节,则必须使用<invalid from/>流错误关闭流(第4.9.3.9节)。

Enforcement of these rules helps to prevent certain denial-of-service attacks as described under Section 13.12.

执行这些规则有助于防止第13.12节所述的某些拒绝服务攻击。

8.1.3. id
8.1.3. 身份证件

The 'id' attribute is used by the originating entity to track any response or error stanza that it might receive in relation to the generated stanza from another entity (such as an intermediate server or the intended recipient).

“id”属性被发起实体用来跟踪它可能从另一个实体(如中间服务器或预期收件人)收到的与生成的节相关的任何响应或错误节。

It is up to the originating entity whether the value of the 'id' attribute is unique only within its current stream or unique globally.

“id”属性的值是仅在其当前流中唯一还是全局唯一取决于原始实体。

For <message/> and <presence/> stanzas, it is RECOMMENDED for the originating entity to include an 'id' attribute; for <iq/> stanzas, it is REQUIRED.

对于<message/>和<presence/>节,建议原始实体包含“id”属性;对于<iq/>节,它是必需的。

If the generated stanza includes an 'id' attribute then it is REQUIRED for the response or error stanza to also include an 'id' attribute, where the value of the 'id' attribute MUST match that of the generated stanza.

如果生成的节包含“id”属性,则响应或错误节也需要包含“id”属性,其中“id”属性的值必须与生成的节的值匹配。

The semantics of IQ stanzas impose additional restrictions as described under Section 8.2.3.

IQ节的语义施加了第8.2.3节所述的额外限制。

8.1.4. type
8.1.4. 类型

The 'type' attribute specifies the purpose or context of the message, presence, or IQ stanza. The particular allowable values for the 'type' attribute vary depending on whether the stanza is a message, presence, or IQ stanza. The defined values for message and presence stanzas are specific to instant messaging and presence applications and therefore are defined in [XMPP-IM], whereas the values for IQ stanzas specify the part of the semantics for all structured request-response exchanges (no matter what the payload) and therefore are specified under Section 8.2.3. The only 'type' value common to all three kinds of stanzas is "error" as described under Section 8.3.

“type”属性指定消息、状态或IQ节的目的或上下文。根据节是消息节、状态节还是IQ节,“type”属性的特定允许值会有所不同。消息和状态节的定义值特定于即时消息和状态应用程序,因此在[XMPP-IM]中定义,而IQ节的值指定了所有结构化请求-响应交换的语义部分(无论负载如何),因此在第8.2.3节中指定。所有三种诗节共有的唯一“类型”值是“错误”,如第8.3节所述。

8.1.5. xml:lang
8.1.5. xml:lang

A stanza SHOULD possess an 'xml:lang' attribute (as defined in Section 2.12 of [XML]) if the stanza contains XML character data that is intended to be presented to a human user (as explained in [CHARSETS], "internationalization is for humans"). The value of the 'xml:lang' attribute specifies the default language of any such human-readable XML character data.

如果节中包含要呈现给人类用户的xml字符数据(如[Charset]中所述,“国际化是为人类的”),则节应具有“xml:lang”属性(如[xml]第2.12节中所定义)。“xml:lang”属性的值指定任何此类人类可读的xml字符数据的默认语言。

   <presence from='romeo@example.net/orchard' xml:lang='en'>
     <show>dnd</show>
     <status>Wooing Juliet</status>
   </presence>
        
   <presence from='romeo@example.net/orchard' xml:lang='en'>
     <show>dnd</show>
     <status>Wooing Juliet</status>
   </presence>
        

The value of the 'xml:lang' attribute MAY be overridden by the 'xml: lang' attribute of a specific child element.

“xml:lang”属性的值可能会被特定子元素的“xml:lang”属性覆盖。

   <presence from='romeo@example.net/orchard' xml:lang='en'>
     <show>dnd</show>
     <status>Wooing Juliet</status>
     <status xml:lang='cs'>Dvo&#x0159;&#x00ED;m se Julii</status>
   </presence>
        
   <presence from='romeo@example.net/orchard' xml:lang='en'>
     <show>dnd</show>
     <status>Wooing Juliet</status>
     <status xml:lang='cs'>Dvo&#x0159;&#x00ED;m se Julii</status>
   </presence>
        

If an outbound stanza generated by a client does not possess an 'xml: lang' attribute, the client's server SHOULD add an 'xml:lang' attribute whose value is that specified for the client's output stream as defined under Section 4.7.4.

如果客户端生成的出站节不具有“xml:lang”属性,则客户端服务器应添加一个“xml:lang”属性,该属性的值为第4.7.4节中为客户端输出流指定的值。

   C: <presence from='romeo@example.net/orchard'>
        <show>dnd</show>
        <status>Wooing Juliet</status>
      </presence>
        
   C: <presence from='romeo@example.net/orchard'>
        <show>dnd</show>
        <status>Wooing Juliet</status>
      </presence>
        
   S: <presence from='romeo@example.net/orchard'
                to='juliet@im.example.com'
                xml:lang='en'>
        <show>dnd</show>
        <status>Wooing Juliet</status>
      </presence>
        
   S: <presence from='romeo@example.net/orchard'
                to='juliet@im.example.com'
                xml:lang='en'>
        <show>dnd</show>
        <status>Wooing Juliet</status>
      </presence>
        

If an inbound stanza received by a client or server does not possess an 'xml:lang' attribute, an implementation MUST assume that the default language is that specified for the entity's input stream as defined under Section 4.7.4.

如果客户端或服务器接收的入站节不具有“xml:lang”属性,则实现必须假定默认语言是为第4.7.4节中定义的实体输入流指定的语言。

The value of the 'xml:lang' attribute MUST conform to the NMTOKEN datatype (as defined in Section 2.3 of [XML]) and MUST conform to the format defined in [LANGTAGS].

“xml:lang”属性的值必须符合NMTOKEN数据类型(如[xml]第2.3节所定义),并且必须符合[LANGTAGS]中定义的格式。

A server MUST NOT modify or delete 'xml:lang' attributes on stanzas it receives from other entities.

服务器不得修改或删除从其他实体接收的节上的“xml:lang”属性。

8.2. Basic Semantics
8.2. 基本语义学
8.2.1. Message Semantics
8.2.1. 消息语义

The <message/> stanza is a "push" mechanism whereby one entity pushes information to another entity, similar to the communications that occur in a system such as email. All message stanzas will possess a 'to' attribute that specifies the intended recipient of the message (see Section 8.1.1 and Section 10.3), unless the message is being sent to the bare JID of a connected client's account. Upon receiving a message stanza with a 'to' address, a server SHOULD attempt to route or deliver it to the intended recipient (see Section 10 for general routing and delivery rules related to XML stanzas).

<message/>节是一种“推送”机制,一个实体将信息推送到另一个实体,类似于电子邮件等系统中发生的通信。所有消息节都将具有一个“to”属性,指定消息的预期收件人(见第8.1.1节和第10.3节),除非消息被发送到连接客户帐户的裸JID。在接收到带有“to”地址的消息节时,服务器应尝试将其路由或传递给预期的收件人(有关XML节的一般路由和传递规则,请参阅第10节)。

8.2.2. Presence Semantics
8.2.2. 存在语义

The <presence/> stanza is a specialized "broadcast" or "publish-subscribe" mechanism, whereby multiple entities receive information (in this case, network availability information) about an entity to which they have subscribed. In general, a publishing client SHOULD send a presence stanza with no 'to' attribute, in which case the server to which the client is connected will broadcast that stanza to all subscribed entities. However, a publishing client MAY also send a presence stanza with a 'to' attribute, in which case the server will route or deliver that stanza to the intended recipient. Although the <presence/> stanza is most often used by XMPP clients, it can also be used by servers, add-on services, and any other kind of XMPP entity. See Section 10 for general routing and delivery rules related to XML stanzas, and [XMPP-IM] for rules specific to presence applications.

<presence/>节是一种专门的“广播”或“发布-订阅”机制,多个实体通过该机制接收有关其已订阅的实体的信息(在本例中为网络可用性信息)。通常,发布客户端应发送不带“to”属性的状态节,在这种情况下,客户端连接到的服务器将向所有订阅的实体广播该节。但是,发布客户端也可以发送带有“to”属性的状态节,在这种情况下,服务器将路由或传递该节到预期的收件人。尽管XMPP客户机最常使用<presence/>节,但它也可以被服务器、附加服务和任何其他类型的XMPP实体使用。有关XML节的一般路由和传递规则,请参见第10节;有关状态应用程序的特定规则,请参见[XMPP-IM]。

8.2.3. IQ Semantics
8.2.3. 智商语义学

Info/Query, or IQ, is a "request-response" mechanism, similar in some ways to the Hypertext Transfer Protocol [HTTP]. The semantics of IQ enable an entity to make a request of, and receive a response from, another entity. The data content of the request and response is defined by the schema or other structural definition associated with the XML namespace that qualifies the direct child element of the IQ element (see Section 8.4), and the interaction is tracked by the requesting entity through use of the 'id' attribute. Thus, IQ interactions follow a common pattern of structured data exchange such as get/result or set/result (although an error can be returned in reply to a request if appropriate):

信息/查询或IQ是一种“请求-响应”机制,在某些方面类似于超文本传输协议[HTTP]。IQ的语义使一个实体能够向另一个实体发出请求,并从另一个实体接收响应。请求和响应的数据内容由与限定IQ元素的直接子元素的XML名称空间相关联的模式或其他结构定义定义(参见第8.4节),请求实体通过使用“id”属性跟踪交互。因此,IQ交互遵循一种常见的结构化数据交换模式,如get/result或set/result(尽管在适当的情况下,可以在响应请求时返回错误):

   Requesting                  Responding
     Entity                      Entity
   ----------                  ----------
       |                            |
       | <iq id='1' type='get'>     |
       |   [ ... payload ... ]      |
       | </iq>                      |
       | -------------------------> |
       |                            |
       | <iq id='1' type='result'>  |
       |   [ ... payload ... ]      |
       | </iq>                      |
       | <------------------------- |
       |                            |
       | <iq id='2' type='set'>     |
       |   [ ... payload ... ]      |
       | </iq>                      |
       | -------------------------> |
       |                            |
       | <iq id='2' type='error'>   |
       |   [ ... condition ... ]    |
       | </iq>                      |
       | <------------------------- |
       |                            |
        
   Requesting                  Responding
     Entity                      Entity
   ----------                  ----------
       |                            |
       | <iq id='1' type='get'>     |
       |   [ ... payload ... ]      |
       | </iq>                      |
       | -------------------------> |
       |                            |
       | <iq id='1' type='result'>  |
       |   [ ... payload ... ]      |
       | </iq>                      |
       | <------------------------- |
       |                            |
       | <iq id='2' type='set'>     |
       |   [ ... payload ... ]      |
       | </iq>                      |
       | -------------------------> |
       |                            |
       | <iq id='2' type='error'>   |
       |   [ ... condition ... ]    |
       | </iq>                      |
       | <------------------------- |
       |                            |
        

Figure 5: Semantics of IQ Stanzas

图5:IQ节的语义

To enforce these semantics, the following rules apply:

要实施这些语义,请应用以下规则:

1. The 'id' attribute is REQUIRED for IQ stanzas.

1. IQ节需要“id”属性。

2. The 'type' attribute is REQUIRED for IQ stanzas. The value MUST be one of the following; if not, the recipient or an intermediate router MUST return a <bad-request/> stanza error (Section 8.3.3.1).

2. IQ节需要“type”属性。该值必须是以下值之一:;否则,接收方或中间路由器必须返回<bad request/>节错误(第8.3.3.1节)。

* get -- The stanza requests information, inquires about what data is needed in order to complete further operations, etc.

* get——该节请求信息,查询完成进一步操作所需的数据,等等。

* set -- The stanza provides data that is needed for an operation to be completed, sets new values, replaces existing values, etc.

* set——该节提供完成操作所需的数据、设置新值、替换现有值等。

* result -- The stanza is a response to a successful get or set request.

* 结果——该节是对成功的get或set请求的响应。

* error -- The stanza reports an error that has occurred regarding processing or delivery of a get or set request (see Section 8.3).

* 错误——该节报告了在处理或传递get或set请求时发生的错误(参见第8.3节)。

3. An entity that receives an IQ request of type "get" or "set" MUST reply with an IQ response of type "result" or "error". The response MUST preserve the 'id' attribute of the request (or be empty if the generated stanza did not include an 'id' attribute).

3. 接收类型为“get”或“set”的IQ请求的实体必须使用类型为“result”或“error”的IQ响应进行回复。响应必须保留请求的“id”属性(如果生成的节不包含“id”属性,则响应必须为空)。

4. An entity that receives a stanza of type "result" or "error" MUST NOT respond to the stanza by sending a further IQ response of type "result" or "error"; however, the requesting entity MAY send another request (e.g., an IQ of type "set" to provide obligatory information discovered through a get/result pair).

4. 接收“结果”或“错误”类型节的实体不得通过发送“结果”或“错误”类型的进一步IQ响应来响应该节;然而,请求实体可以发送另一个请求(例如,“set”类型的IQ,以提供通过get/result对发现的强制性信息)。

5. An IQ stanza of type "get" or "set" MUST contain exactly one child element, which specifies the semantics of the particular request.

5. “get”或“set”类型的IQ节必须恰好包含一个子元素,该子元素指定特定请求的语义。

6. An IQ stanza of type "result" MUST include zero or one child elements.

6. “结果”类型的IQ节必须包含零或一个子元素。

7. An IQ stanza of type "error" MAY include the child element contained in the associated "get" or "set" and MUST include an <error/> child; for details, see Section 8.3.

7. 类型为“error”的IQ节可能包括关联的“get”或“set”中包含的子元素,并且必须包括<error/>子元素;有关详细信息,请参见第8.3节。

8.3. Stanza Errors
8.3. 节错误

Stanza-related errors are handled in a manner similar to stream errors (Section 4.9). Unlike stream errors, stanza errors are recoverable; therefore, they do not result in termination of the XML stream and underlying TCP connection. Instead, the entity that discovers the error condition returns an error stanza, which is a stanza that:

节相关错误的处理方式类似于流错误(第4.9节)。与流错误不同,节错误是可恢复的;因此,它们不会导致XML流和底层TCP连接的终止。相反,发现错误条件的实体返回一个错误节,该节:

o is of the same kind (message, presence, or IQ) as the generated stanza that triggered the error

o 与触发错误的生成节的类型(消息、状态或IQ)相同

o has a 'type' attribute set to a value of "error"

o 将“type”属性的值设置为“error”

o typically swaps the 'from' and 'to' addresses of the generated stanza

o 通常交换生成节的“发件人”和“收件人”地址

o mirrors the 'id' attribute (if any) of the generated stanza that triggered the error

o 镜像触发错误的生成节的“id”属性(如果有)

o contains an <error/> child element that specifies the error condition and therefore provides a hint regarding actions that the sender might be able to take in an effort to remedy the error (however, it is not always possible to remedy the error)

o 包含指定错误条件的<error/>子元素,因此提供了有关发送方在努力纠正错误时可能采取的操作的提示(但是,并非总是能够纠正错误)

8.3.1. Rules
8.3.1. 规则

The following rules apply to stanza errors:

以下规则适用于节错误:

1. The receiving or processing entity that detects an error condition in relation to a stanza SHOULD return an error stanza (and MUST do so for IQ stanzas).

1. 检测到与节相关的错误条件的接收或处理实体应返回错误节(对于IQ节,必须这样做)。

2. The error stanza SHOULD simply swap the 'from' and 'to' addresses from the generated stanza, unless doing so would (1) result in an information leak (see under Section 13.10) or other breach of security, or (2) force the sender of the error stanza to include a malformed JID in the 'from' or 'to' address of the error stanza.

2. 错误节应简单地交换生成节中的“发件人”和“收件人”地址,除非这样做会(1)导致信息泄漏(见第13.10节)或其他安全漏洞,或(2)迫使错误节的发件人在错误节的“发件人”或“收件人”地址中包含格式错误的JID。

3. If the generated stanza was <message/> or <presence/> and included an 'id' attribute then it is REQUIRED for the error stanza to also include an 'id' attribute. If the generated stanza was <iq/> then the error stanza MUST include an 'id' attribute. In all cases, the value of the 'id' attribute MUST match that of the generated stanza (or be empty if the generated stanza did not include an 'id' attribute).

3. 如果生成的节是<message/>或<presence/>并包含“id”属性,则错误节还需要包含“id”属性。如果生成的节是<iq/>,则错误节必须包含“id”属性。在所有情况下,“id”属性的值必须与生成的节的值匹配(如果生成的节不包含“id”属性,则该值为空)。

4. An error stanza MUST contain an <error/> child element.

4. 错误节必须包含<error/>子元素。

5. The entity that returns an error stanza MAY pass along its JID to the sender of the generated stanza (e.g., for diagnostic or tracking purposes) through the addition of a 'by' attribute to the <error/> child element.

5. 返回错误节的实体可以通过向<error/>子元素添加“by”属性,将其JID传递给生成节的发送者(例如,出于诊断或跟踪目的)。

6. The entity that returns an error stanza MAY include the original XML sent so that the sender can inspect and, if necessary, correct the XML before attempting to resend (however, this is a courtesy only and the originating entity MUST NOT depend on receiving the original payload). Naturally, the entity MUST NOT include the original data if it not well-formed XML, violates the XML restrictions of XMPP (see under Section 11.1), or is otherwise harmful (e.g., exceeds a size limit).

6. 返回错误节的实体可以包括发送的原始XML,以便发送方可以在尝试重新发送之前检查并在必要时更正XML(但是,这只是出于礼貌,发起实体不得依赖于接收原始有效负载)。当然,如果实体不是格式良好的XML,违反了XMPP的XML限制(见第11.1节),或者是有害的(例如,超过了大小限制),则实体不得包含原始数据。

7. An <error/> child MUST NOT be included if the 'type' attribute has a value other than "error" (or if there is no 'type' attribute).

7. 如果“type”属性的值不是“error”(或者如果没有“type”属性),则不能包含<error/>子级。

8. An entity that receives an error stanza MUST NOT respond to the stanza with a further error stanza; this helps to prevent looping.

8. 接收错误节的实体不得使用进一步的错误节响应该节;这有助于防止循环。

8.3.2. Syntax
8.3.2. 语法

The syntax for stanza-related errors is as follows, where XML data shown within the square brackets '[' and ']' is OPTIONAL, 'intended-recipient' is the JID of the entity to which the original stanza was addressed, 'sender' is the JID of the originating entity, and 'error-generator' is the entity that detects the fact that an error has occurred and thus returns an error stanza.

节相关错误的语法如下所示,其中方括号“[”和“]”内显示的XML数据是可选的,“预期收件人”是原始节所寻址实体的JID,“发件人”是原始实体的JID,“错误生成器”是一个实体,它检测到错误已经发生,并因此返回错误节。

   <stanza-kind from='intended-recipient' to='sender' type='error'>
     [OPTIONAL to include sender XML here]
     <error [by='error-generator']
            type='error-type'>
       <defined-condition xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
       [<text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'
              xml:lang='langcode'>
         OPTIONAL descriptive text
       </text>]
       [OPTIONAL application-specific condition element]
     </error>
   </stanza-kind>
        
   <stanza-kind from='intended-recipient' to='sender' type='error'>
     [OPTIONAL to include sender XML here]
     <error [by='error-generator']
            type='error-type'>
       <defined-condition xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
       [<text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'
              xml:lang='langcode'>
         OPTIONAL descriptive text
       </text>]
       [OPTIONAL application-specific condition element]
     </error>
   </stanza-kind>
        

The "stanza-kind" MUST be one of message, presence, or iq.

“节类”必须是消息、状态或iq。

The "error-type" MUST be one of the following:

“错误类型”必须是以下类型之一:

o auth -- retry after providing credentials

o 身份验证--提供凭据后重试

o cancel -- do not retry (the error cannot be remedied)

o cancel--不重试(错误无法纠正)

o continue -- proceed (the condition was only a warning)

o continue--继续(该情况只是一个警告)

o modify -- retry after changing the data sent

o 修改--更改发送的数据后重试

o wait -- retry after waiting (the error is temporary)

o 等待--等待后重试(错误是暂时的)

The "defined-condition" MUST correspond to one of the stanza error conditions defined under Section 8.3.3. However, because additional error conditions might be defined in the future, if an entity receives a stanza error condition that it does not understand then it MUST treat the unknown condition as equivalent to <undefined-condition/> (Section 8.3.3.21). If the designers of an XMPP protocol extension or the developers of an XMPP implementation need to communicate a stanza error condition that is not defined in this

“定义条件”必须对应于第8.3.3节中定义的节错误条件之一。但是,由于将来可能会定义其他错误条件,如果实体收到其不理解的节错误条件,则必须将未知条件视为等同于<undefined condition/>(第8.3.3.21节)。如果XMPP协议扩展的设计人员或XMPP实现的开发人员需要传达本节中未定义的节错误条件

specification, they can do so by defining an application-specific error condition element qualified by an application-specific namespace.

规范中,它们可以通过定义由特定于应用程序的命名空间限定的特定于应用程序的错误条件元素来实现。

The <error/> element:

<error/>元素:

o MUST contain a defined condition element.

o 必须包含已定义的条件元素。

o MAY contain a <text/> child element containing XML character data that describes the error in more detail; this element MUST be qualified by the 'urn:ietf:params:xml:ns:xmpp-stanzas' namespace and SHOULD possess an 'xml:lang' attribute specifying the natural language of the XML character data.

o 可能包含<text/>子元素,该子元素包含更详细地描述错误的XML字符数据;此元素必须由“urn:ietf:params:xml:ns:xmpp stanzas”命名空间限定,并应具有指定xml字符数据的自然语言的“xml:lang”属性。

o MAY contain a child element for an application-specific error condition; this element MUST be qualified by an application-specific namespace that defines the syntax and semantics of the element.

o 可能包含应用程序特定错误条件的子元素;此元素必须由定义元素语法和语义的特定于应用程序的命名空间限定。

The <text/> element is OPTIONAL. If included, it is to be used only to provide descriptive or diagnostic information that supplements the meaning of a defined condition or application-specific condition. It MUST NOT be interpreted programmatically by an application. It SHOULD NOT be used as the error message presented to a human user, but MAY be shown in addition to the error message associated with the defined condition element (and, optionally, the application-specific condition element).

<text/>元素是可选的。如果包括,则仅用于提供补充定义条件或特定应用条件含义的描述性或诊断信息。应用程序不能以编程方式解释它。不应将其用作呈现给人类用户的错误消息,但可以在与定义的条件元素(以及,可选的,特定于应用程序的条件元素)相关联的错误消息之外显示。

Interoperability Note: The syntax defined in [RFC3920] included a legacy 'code' attribute, whose semantics have been replaced by the defined condition elements; information about mapping defined condition elements to values of the legacy 'code' attribute can be found in [XEP-0086].

互操作性说明:[RFC3920]中定义的语法包括一个遗留的“code”属性,其语义已被定义的条件元素替换;有关将定义的条件元素映射到遗留“代码”属性值的信息,请参见[XEP-0086]。

8.3.3. Defined Conditions
8.3.3. 定义的条件

The following conditions are defined for use in stanza errors.

以下条件定义用于节错误。

The error-type value that is RECOMMENDED for each defined condition is the usual expected type; however, in some circumstances a different type might be more appropriate.

为每个定义的条件建议的错误类型值是通常的预期类型;然而,在某些情况下,另一种类型可能更合适。

8.3.3.1. bad-request
8.3.3.1. 错误的请求

The sender has sent a stanza containing XML that does not conform to the appropriate schema or that cannot be processed (e.g., an IQ stanza that includes an unrecognized value of the 'type' attribute,

发送方已发送包含不符合适当架构或无法处理的XML的节(例如,包含“type”属性的无法识别值的IQ节,

or an element that is qualified by a recognized namespace but that violates the defined syntax for the element); the associated error type SHOULD be "modify".

或由可识别名称空间限定但违反元素定义语法的元素);关联的错误类型应为“修改”。

   C: <iq from='juliet@im.example.com/balcony'
          id='zj3v142b'
          to='im.example.com'
          type='subscribe'>
        <ping xmlns='urn:xmpp:ping'/>
      </iq>
        
   C: <iq from='juliet@im.example.com/balcony'
          id='zj3v142b'
          to='im.example.com'
          type='subscribe'>
        <ping xmlns='urn:xmpp:ping'/>
      </iq>
        
   S: <iq from='im.example.com'
          id='zj3v142b'
          to='juliet@im.example.com/balcony'
          type='error'>
        <error type='modify'>
          <bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </iq>
        
   S: <iq from='im.example.com'
          id='zj3v142b'
          to='juliet@im.example.com/balcony'
          type='error'>
        <error type='modify'>
          <bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </iq>
        
8.3.3.2. conflict
8.3.3.2. 冲突

Access cannot be granted because an existing resource exists with the same name or address; the associated error type SHOULD be "cancel".

无法授予访问权限,因为存在具有相同名称或地址的现有资源;关联的错误类型应为“取消”。

   C: <iq id='wy2xa82b4' type='set'>
        <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
          <resource>balcony</resource>
        </bind>
      </iq>
        
   C: <iq id='wy2xa82b4' type='set'>
        <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
          <resource>balcony</resource>
        </bind>
      </iq>
        
   S: <iq id='wy2xa82b4' type='error'>
        <error type='cancel'>
          <conflict xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </iq>
        
   S: <iq id='wy2xa82b4' type='error'>
        <error type='cancel'>
          <conflict xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </iq>
        
8.3.3.3. feature-not-implemented
8.3.3.3. 功能未实现

The feature represented in the XML stanza is not implemented by the intended recipient or an intermediate server and therefore the stanza cannot be processed (e.g., the entity understands the namespace but does not recognize the element name); the associated error type SHOULD be "cancel" or "modify".

XML节中表示的功能不是由预期的接收者或中间服务器实现的,因此无法处理该节(例如,实体理解名称空间,但不识别元素名称);关联的错误类型应为“取消”或“修改”。

   C: <iq from='juliet@im.example.com/balcony'
          id='9u2bax16'
          to='pubsub.example.com'
          type='get'>
        <pubsub xmlns='http://jabber.org/protocol/pubsub'>
          <subscriptions/>
        </pubsub>
      </iq>
        
   C: <iq from='juliet@im.example.com/balcony'
          id='9u2bax16'
          to='pubsub.example.com'
          type='get'>
        <pubsub xmlns='http://jabber.org/protocol/pubsub'>
          <subscriptions/>
        </pubsub>
      </iq>
        
   E: <iq from='pubsub.example.com'
          id='9u2bax16'
          to='juliet@im.example.com/balcony'
          type='error'>
        <error type='cancel'>
          <feature-not-implemented
              xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
          <unsupported
              xmlns='http://jabber.org/protocol/pubsub#errors'
              feature='retrieve-subscriptions'/>
        </error>
      </iq>
        
   E: <iq from='pubsub.example.com'
          id='9u2bax16'
          to='juliet@im.example.com/balcony'
          type='error'>
        <error type='cancel'>
          <feature-not-implemented
              xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
          <unsupported
              xmlns='http://jabber.org/protocol/pubsub#errors'
              feature='retrieve-subscriptions'/>
        </error>
      </iq>
        
8.3.3.4. forbidden
8.3.3.4. 被禁止的

The requesting entity does not possess the necessary permissions to perform an action that only certain authorized roles or individuals are allowed to complete (i.e., it typically relates to authorization rather than authentication); the associated error type SHOULD be "auth".

请求实体不具备执行仅允许某些授权角色或个人完成的操作所需的权限(即,该操作通常涉及授权而非身份验证);关联的错误类型应为“auth”。

   C: <presence
          from='juliet@im.example.com/balcony'
          id='y2bs71v4'
          to='characters@muc.example.com/JulieC'>
        <x xmlns='http://jabber.org/protocol/muc'/>
      </presence>
        
   C: <presence
          from='juliet@im.example.com/balcony'
          id='y2bs71v4'
          to='characters@muc.example.com/JulieC'>
        <x xmlns='http://jabber.org/protocol/muc'/>
      </presence>
        
   E: <presence
          from='characters@muc.example.com/JulieC'
          id='y2bs71v4'
          to='juliet@im.example.com/balcony'
          type='error'>
        <error type='auth'>
          <forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </presence>
        
   E: <presence
          from='characters@muc.example.com/JulieC'
          id='y2bs71v4'
          to='juliet@im.example.com/balcony'
          type='error'>
        <error type='auth'>
          <forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </presence>
        
8.3.3.5. gone
8.3.3.5. 跑了

The recipient or server can no longer be contacted at this address, typically on a permanent basis (as opposed to the <redirect/> error condition, which is used for temporary addressing failures); the associated error type SHOULD be "cancel" and the error stanza SHOULD include a new address (if available) as the XML character data of the <gone/> element (which MUST be a Uniform Resource Identifier [URI] or Internationalized Resource Identifier [IRI] at which the entity can be contacted, typically an XMPP IRI as specified in [XMPP-URI]).

无法再通过此地址联系收件人或服务器,通常是永久性的(与用于临时寻址失败的<redirect/>错误情况相反);关联的错误类型应为“cancel”,错误节应包括一个新地址(如果可用)作为<Goe/>元素的XML字符数据(必须是统一资源标识符[URI]或可联系实体的国际化资源标识符[IRI],通常是[XMPP-URI]中指定的XMPP IRI])。

   C: <message
          from='juliet@im.example.com/churchyard'
          id='sj2b371v'
          to='romeo@example.net'
          type='chat'>
        <body>Thy lips are warm.</body>
      </message>
        
   C: <message
          from='juliet@im.example.com/churchyard'
          id='sj2b371v'
          to='romeo@example.net'
          type='chat'>
        <body>Thy lips are warm.</body>
      </message>
        
   S: <message
          from='romeo@example.net'
          id='sj2b371v'
          to='juliet@im.example.com/churchyard'
          type='error'>
        <error by='example.net'
               type='cancel'>
          <gone xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>
            xmpp:romeo@afterlife.example.net
          </gone>
        </error>
      </message>
        
   S: <message
          from='romeo@example.net'
          id='sj2b371v'
          to='juliet@im.example.com/churchyard'
          type='error'>
        <error by='example.net'
               type='cancel'>
          <gone xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>
            xmpp:romeo@afterlife.example.net
          </gone>
        </error>
      </message>
        
8.3.3.6. internal-server-error
8.3.3.6. 内部服务器错误

The server has experienced a misconfiguration or other internal error that prevents it from processing the stanza; the associated error type SHOULD be "cancel".

服务器遇到错误配置或其他内部错误,从而无法处理节;关联的错误类型应为“取消”。

   C: <presence
          from='juliet@im.example.com/balcony'
          id='y2bs71v4'
          to='characters@muc.example.com/JulieC'>
        <x xmlns='http://jabber.org/protocol/muc'/>
      </presence>
        
   C: <presence
          from='juliet@im.example.com/balcony'
          id='y2bs71v4'
          to='characters@muc.example.com/JulieC'>
        <x xmlns='http://jabber.org/protocol/muc'/>
      </presence>
        
   E: <presence
          from='characters@muc.example.com/JulieC'
          id='y2bs71v4'
          to='juliet@im.example.com/balcony'
          type='error'>
        <error type='cancel'>
          <internal-server-error
              xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </presence>
        
   E: <presence
          from='characters@muc.example.com/JulieC'
          id='y2bs71v4'
          to='juliet@im.example.com/balcony'
          type='error'>
        <error type='cancel'>
          <internal-server-error
              xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </presence>
        
8.3.3.7. item-not-found
8.3.3.7. 找不到项目

The addressed JID or item requested cannot be found; the associated error type SHOULD be "cancel".

无法找到已寻址的JID或请求的项目;关联的错误类型应为“取消”。

   C: <presence from='userfoo@example.com/bar'
                id='pwb2n78i'
                to='nosuchroom@conference.example.org/foo'/>
        
   C: <presence from='userfoo@example.com/bar'
                id='pwb2n78i'
                to='nosuchroom@conference.example.org/foo'/>
        
   S: <presence from='nosuchroom@conference.example.org/foo'
                id='pwb2n78i'
                to='userfoo@example.com/bar'
                type='error'>
        <error type='cancel'>
          <item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </presence>
        
   S: <presence from='nosuchroom@conference.example.org/foo'
                id='pwb2n78i'
                to='userfoo@example.com/bar'
                type='error'>
        <error type='cancel'>
          <item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </presence>
        

Security Warning: An application MUST NOT return this error if doing so would provide information about the intended recipient's network availability to an entity that is not authorized to know such information (for a more detailed discussion of presence authorization, refer to the discussion of presence subscriptions in [XMPP-IM]); instead it MUST return a <service-unavailable/> stanza error (Section 8.3.3.19).

安全警告:如果这样做会向未被授权了解此类信息的实体提供有关预期收件人网络可用性的信息,则应用程序不得返回此错误(有关状态授权的更详细讨论,请参阅[XMPP-IM]中的状态订阅讨论);相反,它必须返回<service unavailable/>节错误(第8.3.3.19节)。

8.3.3.8. jid-malformed
8.3.3.8. 畸形的

The sending entity has provided (e.g., during resource binding) or communicated (e.g., in the 'to' address of a stanza) an XMPP address or aspect thereof that violates the rules defined in [XMPP-ADDR]; the associated error type SHOULD be "modify".

发送实体已提供(例如,在资源绑定期间)或传送(例如,在节的“收件人”地址中)违反[XMPP-ADDR]中定义的规则的XMPP地址或其方面;关联的错误类型应为“修改”。

   C: <presence
          from='juliet@im.example.com/balcony'
          id='y2bs71v4'
          to='ch@r@cters@muc.example.com/JulieC'>
        <x xmlns='http://jabber.org/protocol/muc'/>
      </presence>
        
   C: <presence
          from='juliet@im.example.com/balcony'
          id='y2bs71v4'
          to='ch@r@cters@muc.example.com/JulieC'>
        <x xmlns='http://jabber.org/protocol/muc'/>
      </presence>
        
   E: <presence
          from='ch@r@cters@muc.example.com/JulieC'
          id='y2bs71v4'
          to='juliet@im.example.com/balcony'
          type='error'>
        <error by='muc.example.com'
               type='modify'>
          <jid-malformed
              xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </presence>
        
   E: <presence
          from='ch@r@cters@muc.example.com/JulieC'
          id='y2bs71v4'
          to='juliet@im.example.com/balcony'
          type='error'>
        <error by='muc.example.com'
               type='modify'>
          <jid-malformed
              xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </presence>
        

Implementation Note: Enforcement of the format for XMPP localparts is primarily the responsibility of the service at which the associated account or entity is located (e.g., the example.com service is responsible for returning <jid-malformed/> errors related to all JIDs of the form <localpart@example.com>), whereas enforcement of the format for XMPP domainparts is primarily the responsibility of the service that seeks to route a stanza to the service identified by that domainpart (e.g., the example.org service is responsible for returning <jid-malformed/> errors related to stanzas that users of that service have to tried send to JIDs of the form <localpart@example.com>). However, any entity that detects a malformed JID MAY return this error.

实施说明:XMPP localparts格式的实施主要由相关帐户或实体所在的服务负责(例如,example.com服务负责返回与表单的所有jid相关的<jid-malformed/>错误<localpart@example.com>),鉴于XMPP domainparts格式的实施主要是服务的责任,该服务寻求将节路由到该domainpart标识的服务(例如,example.org服务负责返回与节相关的<jid-malformed/>错误,该服务的用户必须尝试发送到表单的JIDs<localpart@example.com>)。但是,任何检测到格式错误JID的实体都可能返回此错误。

8.3.3.9. not-acceptable
8.3.3.9. 不可接受

The recipient or server understands the request but cannot process it because the request does not meet criteria defined by the recipient or server (e.g., a request to subscribe to information that does not simultaneously include configuration parameters needed by the recipient); the associated error type SHOULD be "modify".

接收方或服务器理解该请求,但无法处理该请求,因为该请求不符合接收方或服务器定义的标准(例如,订阅不同时包含接收方所需配置参数的信息的请求);关联的错误类型应为“修改”。

   C: <message to='juliet@im.example.com' id='yt2vs71m'>
        <body>[ ... the-emacs-manual ... ]</body>
      </message>
        
   C: <message to='juliet@im.example.com' id='yt2vs71m'>
        <body>[ ... the-emacs-manual ... ]</body>
      </message>
        
   S: <message from='juliet@im.example.com' id='yt2vs71m'>
        <error type='modify'>
          <not-acceptable
              xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </message>
        
   S: <message from='juliet@im.example.com' id='yt2vs71m'>
        <error type='modify'>
          <not-acceptable
              xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </message>
        
8.3.3.10. not-allowed
8.3.3.10. 不准

The recipient or server does not allow any entity to perform the action (e.g., sending to entities at a blacklisted domain); the associated error type SHOULD be "cancel".

收件人或服务器不允许任何实体执行该操作(例如,发送到黑名单域中的实体);关联的错误类型应为“取消”。

   C: <presence
          from='juliet@im.example.com/balcony'
          id='y2bs71v4'
          to='characters@muc.example.com/JulieC'>
        <x xmlns='http://jabber.org/protocol/muc'/>
      </presence>
        
   C: <presence
          from='juliet@im.example.com/balcony'
          id='y2bs71v4'
          to='characters@muc.example.com/JulieC'>
        <x xmlns='http://jabber.org/protocol/muc'/>
      </presence>
        
   E: <presence
          from='characters@muc.example.com/JulieC'
          id='y2bs71v4'
          to='juliet@im.example.com/balcony'
          type='error'>
        <error type='cancel'>
          <not-allowed xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </presence>
        
   E: <presence
          from='characters@muc.example.com/JulieC'
          id='y2bs71v4'
          to='juliet@im.example.com/balcony'
          type='error'>
        <error type='cancel'>
          <not-allowed xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </presence>
        
8.3.3.11. not-authorized
8.3.3.11. 未授权

The sender needs to provide credentials before being allowed to perform the action, or has provided improper credentials (the name "not-authorized", which was borrowed from the "401 Unauthorized" error of [HTTP], might lead the reader to think that this condition relates to authorization, but instead it is typically used in relation to authentication); the associated error type SHOULD be "auth".

发送方在被允许执行操作之前需要提供凭据,或者提供了不正确的凭据(名称“not authorized”,这是从[HTTP]的“401 Unauthorized”错误借用的),可能会使读者认为该条件与授权有关,但它通常用于认证);关联的错误类型应为“auth”。

   C: <presence
          from='juliet@im.example.com/balcony'
          id='y2bs71v4'
          to='characters@muc.example.com/JulieC'>
        <x xmlns='http://jabber.org/protocol/muc'/>
      </presence>
        
   C: <presence
          from='juliet@im.example.com/balcony'
          id='y2bs71v4'
          to='characters@muc.example.com/JulieC'>
        <x xmlns='http://jabber.org/protocol/muc'/>
      </presence>
        
   E: <presence
          from='characters@muc.example.com/JulieC'
          id='y2bs71v4'
          to='juliet@im.example.com/balcony'>
        <error type='auth'>
          <not-authorized xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </presence>
        
   E: <presence
          from='characters@muc.example.com/JulieC'
          id='y2bs71v4'
          to='juliet@im.example.com/balcony'>
        <error type='auth'>
          <not-authorized xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </presence>
        
8.3.3.12. policy-violation
8.3.3.12. 违反政策

The entity has violated some local service policy (e.g., a message contains words that are prohibited by the service) and the server MAY choose to specify the policy in the <text/> element or in an application-specific condition element; the associated error type SHOULD be "modify" or "wait" depending on the policy being violated.

实体违反了某些本地服务策略(例如,消息包含服务禁止的词语),服务器可以选择在<text/>元素或特定于应用程序的条件元素中指定策略;根据违反的策略,关联的错误类型应为“修改”或“等待”。

(In the following example, the client sends an XMPP message containing words that are forbidden according to the server's local service policy.)

(在下面的示例中,客户端发送一条XMPP消息,其中包含根据服务器的本地服务策略被禁止的单词。)

   C: <message from='romeo@example.net/foo'
               to='bill@im.example.com'
               id='vq71f4nb'>
        <body>%#&@^!!!</body>
      </message>
        
   C: <message from='romeo@example.net/foo'
               to='bill@im.example.com'
               id='vq71f4nb'>
        <body>%#&@^!!!</body>
      </message>
        
   S: <message from='bill@im.example.com'
               id='vq71f4nb'
               to='romeo@example.net/foo'>
        <error by='example.net' type='modify'>
          <policy-violation
              xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </message>
        
   S: <message from='bill@im.example.com'
               id='vq71f4nb'
               to='romeo@example.net/foo'>
        <error by='example.net' type='modify'>
          <policy-violation
              xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </message>
        
8.3.3.13. recipient-unavailable
8.3.3.13. 收件人不可用

The intended recipient is temporarily unavailable, undergoing maintenance, etc.; the associated error type SHOULD be "wait".

预期接收人暂时不可用、正在进行维护等。;关联的错误类型应为“等待”。

   C: <presence
          from='juliet@im.example.com/balcony'
          id='y2bs71v4'
          to='characters@muc.example.com/JulieC'>
        <x xmlns='http://jabber.org/protocol/muc'/>
      </presence>
        
   C: <presence
          from='juliet@im.example.com/balcony'
          id='y2bs71v4'
          to='characters@muc.example.com/JulieC'>
        <x xmlns='http://jabber.org/protocol/muc'/>
      </presence>
        
   E: <presence
          from='characters@muc.example.com/JulieC'
          id='y2bs71v4'
          to='juliet@im.example.com/balcony'>
        <error type='wait'>
          <recipient-unavailable
              xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </presence>
        
   E: <presence
          from='characters@muc.example.com/JulieC'
          id='y2bs71v4'
          to='juliet@im.example.com/balcony'>
        <error type='wait'>
          <recipient-unavailable
              xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </presence>
        

Security Warning: An application MUST NOT return this error if doing so would provide information about the intended recipient's network availability to an entity that is not authorized to know such information (for a more detailed discussion of presence authorization, refer to the discussion of presence subscriptions in [XMPP-IM]); instead it MUST return a <service-unavailable/> stanza error (Section 8.3.3.19).

安全警告:如果这样做会向未被授权了解此类信息的实体提供有关预期收件人网络可用性的信息,则应用程序不得返回此错误(有关状态授权的更详细讨论,请参阅[XMPP-IM]中的状态订阅讨论);相反,它必须返回<service unavailable/>节错误(第8.3.3.19节)。

8.3.3.14. redirect
8.3.3.14. 重新使用

The recipient or server is redirecting requests for this information to another entity, typically in a temporary fashion (as opposed to the <gone/> error condition, which is used for permanent addressing failures); the associated error type SHOULD be "modify" and the error stanza SHOULD contain the alternate address in the XML character data of the <redirect/> element (which MUST be a URI or IRI with which the sender can communicate, typically an XMPP IRI as specified in [XMPP-URI]).

接收方或服务器通常以临时方式将该信息的请求重定向到另一个实体(与用于永久寻址失败的<gone/>错误条件相反);关联的错误类型应该是“modify”,错误节应该包含<redirect/>元素的XML字符数据中的备用地址(必须是发送方可以与其通信的URI或IRI,通常是[XMPP-URI]中指定的XMPP IRI)。

   C: <presence
          from='juliet@im.example.com/balcony'
          id='y2bs71v4'
          to='characters@muc.example.com/JulieC'>
        <x xmlns='http://jabber.org/protocol/muc'/>
      </presence>
        
   C: <presence
          from='juliet@im.example.com/balcony'
          id='y2bs71v4'
          to='characters@muc.example.com/JulieC'>
        <x xmlns='http://jabber.org/protocol/muc'/>
      </presence>
        
   E: <presence
          from='characters@muc.example.com/JulieC'
          id='y2bs71v4'
          to='juliet@im.example.com/balcony'
          type='error'>
        <error type='modify'>
          <redirect xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>
            xmpp:characters@conference.example.org
          </redirect>
        </error>
      </presence>
        
   E: <presence
          from='characters@muc.example.com/JulieC'
          id='y2bs71v4'
          to='juliet@im.example.com/balcony'
          type='error'>
        <error type='modify'>
          <redirect xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>
            xmpp:characters@conference.example.org
          </redirect>
        </error>
      </presence>
        

Security Warning: An application receiving a stanza-level redirect SHOULD warn a human user of the redirection attempt and request approval before proceeding to communicate with the entity whose address is contained in the XML character data of the <redirect/> element, because that entity might have a different identity or might enforce different security policies. The end-to-end authentication or signing of XMPP stanzas could help to mitigate this risk, since it would enable the sender to determine if the entity to which it has been redirected has the same identity as the entity it originally attempted to contact. An application MAY have a policy of following redirects only if it has authenticated the receiving entity. In addition, an application SHOULD abort the communication attempt after a certain number of successive redirects (e.g., at least 2 but no more than 5).

安全警告:接收节级重定向的应用程序应在继续与地址包含在<redirect/>元素的XML字符数据中的实体通信之前,警告人类用户重定向尝试并请求批准,因为该实体可能具有不同的标识,或者可能实施不同的安全策略。XMPP节的端到端身份验证或签名有助于降低这一风险,因为这将使发送方能够确定其被重定向到的实体是否与最初试图联系的实体具有相同的身份。仅当应用程序已对接收实体进行身份验证时,应用程序可能具有遵循重定向的策略。此外,应用程序应在一定数量的连续重定向(例如,至少2次但不超过5次)后中止通信尝试。

8.3.3.15. registration-required
8.3.3.15. 需要注册

The requesting entity is not authorized to access the requested service because prior registration is necessary (examples of prior registration include members-only rooms in XMPP multi-user chat [XEP-0045] and gateways to non-XMPP instant messaging services, which traditionally required registration in order to use the gateway [XEP-0100]); the associated error type SHOULD be "auth".

请求实体无权访问请求的服务,因为需要事先注册(事先注册的示例包括XMPP多用户聊天室[XEP-0045]中的会员专用房间和非XMPP即时消息服务的网关,传统上需要注册才能使用网关[XEP-0100]);关联的错误类型应为“auth”。

   C: <presence
          from='juliet@im.example.com/balcony'
          id='y2bs71v4'
          to='characters@muc.example.com/JulieC'>
        <x xmlns='http://jabber.org/protocol/muc'/>
      </presence>
        
   C: <presence
          from='juliet@im.example.com/balcony'
          id='y2bs71v4'
          to='characters@muc.example.com/JulieC'>
        <x xmlns='http://jabber.org/protocol/muc'/>
      </presence>
        
   E: <presence
          from='characters@muc.example.com/JulieC'
          id='y2bs71v4'
          to='juliet@im.example.com/balcony'>
        <error type='auth'>
          <registration-required
              xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </presence>
        
   E: <presence
          from='characters@muc.example.com/JulieC'
          id='y2bs71v4'
          to='juliet@im.example.com/balcony'>
        <error type='auth'>
          <registration-required
              xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </presence>
        
8.3.3.16. remote-server-not-found
8.3.3.16. 找不到远程服务器

A remote server or service specified as part or all of the JID of the intended recipient does not exist or cannot be resolved (e.g., there is no _xmpp-server._tcp DNS SRV record, the A or AAAA fallback

指定为预期收件人JID的一部分或全部的远程服务器或服务不存在或无法解析(例如,没有\u xmpp-server.\u tcp DNS SRV记录、A或AAAA回退

resolution fails, or A/AAAA lookups succeed but there is no response on the IANA-registered port 5269); the associated error type SHOULD be "cancel".

解析失败,或A/AAAA查找成功,但IANA注册端口5269上没有响应);关联的错误类型应为“取消”。

   C: <message
          from='romeo@example.net/home'
          id='ud7n1f4h'
          to='bar@example.org'
          type='chat'>
       <body>yt?</body>
      </message>
        
   C: <message
          from='romeo@example.net/home'
          id='ud7n1f4h'
          to='bar@example.org'
          type='chat'>
       <body>yt?</body>
      </message>
        
   E: <message
          from='bar@example.org'
          id='ud7n1f4h'
          to='romeo@example.net/home'
          type='error'>
        <error type='cancel'>
          <remote-server-not-found
              xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </message>
        
   E: <message
          from='bar@example.org'
          id='ud7n1f4h'
          to='romeo@example.net/home'
          type='error'>
        <error type='cancel'>
          <remote-server-not-found
              xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </message>
        
8.3.3.17. remote-server-timeout
8.3.3.17. 远程服务器超时

A remote server or service specified as part or all of the JID of the intended recipient (or needed to fulfill a request) was resolved but communications could not be established within a reasonable amount of time (e.g., an XML stream cannot be established at the resolved IP address and port, or an XML stream can be established but stream negotiation fails because of problems with TLS, SASL, Server Dialback, etc.); the associated error type SHOULD be "wait" (unless the error is of a more permanent nature, e.g., the remote server is found but it cannot be authenticated or it violates security policies).

指定为预期收件人JID的一部分或全部(或满足请求所需)的远程服务器或服务已解决,但无法在合理的时间内建立通信(例如,无法在解析的IP地址和端口建立XML流,或者可以建立XML流,但由于TLS、SASL、服务器回拨等问题,流协商失败);相关错误类型应为“等待”(除非错误具有更持久的性质,例如,找到远程服务器但无法对其进行身份验证或违反安全策略)。

   C: <message
          from='romeo@example.net/home'
          id='ud7n1f4h'
          to='bar@example.org'
          type='chat'>
       <body>yt?</body>
      </message>
        
   C: <message
          from='romeo@example.net/home'
          id='ud7n1f4h'
          to='bar@example.org'
          type='chat'>
       <body>yt?</body>
      </message>
        
   E: <message
          from='bar@example.org'
          id='ud7n1f4h'
          to='romeo@example.net/home'
          type='error'>
        <error type='wait'>
          <remote-server-timeout
              xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </message>
        
   E: <message
          from='bar@example.org'
          id='ud7n1f4h'
          to='romeo@example.net/home'
          type='error'>
        <error type='wait'>
          <remote-server-timeout
              xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </message>
        
8.3.3.18. resource-constraint
8.3.3.18. 资源约束

The server or recipient is busy or lacks the system resources necessary to service the request; the associated error type SHOULD be "wait".

服务器或收件人正忙或缺少服务请求所需的系统资源;关联的错误类型应为“等待”。

   C: <iq from='romeo@example.net/foo'
          id='kj4vz31m'
          to='pubsub.example.com'
          type='get'>
        <pubsub xmlns='http://jabber.org/protocol/pubsub'>
          <items node='my_musings'/>
        </pubsub>
      </iq>
        
   C: <iq from='romeo@example.net/foo'
          id='kj4vz31m'
          to='pubsub.example.com'
          type='get'>
        <pubsub xmlns='http://jabber.org/protocol/pubsub'>
          <items node='my_musings'/>
        </pubsub>
      </iq>
        
   E: <iq from='pubsub.example.com'
          id='kj4vz31m'
          to='romeo@example.net/foo'
          type='error'>
        <error type='wait'>
          <resource-constraint
              xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </iq>
        
   E: <iq from='pubsub.example.com'
          id='kj4vz31m'
          to='romeo@example.net/foo'
          type='error'>
        <error type='wait'>
          <resource-constraint
              xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </iq>
        
8.3.3.19. service-unavailable
8.3.3.19. 服务不可用

The server or recipient does not currently provide the requested service; the associated error type SHOULD be "cancel".

服务器或收件人当前未提供请求的服务;关联的错误类型应为“取消”。

   C: <message from='romeo@example.net/foo'
               to='juliet@im.example.com'>
        <body>Hello?</body>
      </message>
        
   C: <message from='romeo@example.net/foo'
               to='juliet@im.example.com'>
        <body>Hello?</body>
      </message>
        
   S: <message from='juliet@im.example.com/foo'
               to='romeo@example.net'>
        <error type='cancel'>
          <service-unavailable
              xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </message>
        
   S: <message from='juliet@im.example.com/foo'
               to='romeo@example.net'>
        <error type='cancel'>
          <service-unavailable
              xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </message>
        

Security Warning: An application MUST return a <service-unavailable/> stanza error (Section 8.3.3.19) instead of <item-not-found/> (Section 8.3.3.7) or <recipient-unavailable/> (Section 8.3.3.13) if sending one of the latter errors would provide information about the intended recipient's network availability to an entity that is not authorized to know such information (for a more detailed discussion of presence authorization, refer to [XMPP-IM]).

安全警告:应用程序必须返回<service unavailable/>节错误(第8.3.3.19节),而不是<item not found/>(第8.3.3.7节)或<recipient unavailable/>(第8.3.13节)如果发送后一个错误将向未被授权了解此类信息的实体提供有关预期收件人网络可用性的信息(有关状态授权的更详细讨论,请参阅[XMPP-IM])。

8.3.3.20. subscription-required
8.3.3.20. 需要订阅

The requesting entity is not authorized to access the requested service because a prior subscription is necessary (examples of prior subscription include authorization to receive presence information as defined in [XMPP-IM] and opt-in data feeds for XMPP publish-subscribe as defined in [XEP-0060]); the associated error type SHOULD be "auth".

请求实体未被授权访问请求的服务,因为需要事先订阅(事先订阅的示例包括[XMPP-IM]中定义的接收状态信息的授权和[XEP-0060]中定义的XMPP发布订阅的选择性加入数据源);关联的错误类型应为“auth”。

   C: <message
          from='romeo@example.net/orchard'
          id='pa73b4n7'
          to='playwright@shakespeare.example.com'
          type='chat'>
        <subject>ACT II, SCENE II</subject>
        <body>help, I forgot my lines!</body>
      </message>
        
   C: <message
          from='romeo@example.net/orchard'
          id='pa73b4n7'
          to='playwright@shakespeare.example.com'
          type='chat'>
        <subject>ACT II, SCENE II</subject>
        <body>help, I forgot my lines!</body>
      </message>
        
   E: <message
          from='playwright@shakespeare.example.com'
          id='pa73b4n7'
          to='romeo@example.net/orchard'
          type='error'>
        <error type='auth'>
          <subscription-required
              xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </message>
        
   E: <message
          from='playwright@shakespeare.example.com'
          id='pa73b4n7'
          to='romeo@example.net/orchard'
          type='error'>
        <error type='auth'>
          <subscription-required
              xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </message>
        
8.3.3.21. undefined-condition
8.3.3.21. 未定义条件

The error condition is not one of those defined by the other conditions in this list; any error type can be associated with this condition, and it SHOULD NOT be used except in conjunction with an application-specific condition.

错误条件不是此列表中其他条件定义的条件之一;任何错误类型都可以与此条件关联,除非与特定于应用程序的条件结合使用,否则不应使用此错误类型。

   C: <message
          from='northumberland@shakespeare.example'
          id='richard2-4.1.247'
          to='kingrichard@royalty.england.example'>
        <body>My lord, dispatch; read o'er these articles.</body>
        <amp xmlns='http://jabber.org/protocol/amp'>
          <rule action='notify'
                condition='deliver'
                value='stored'/>
        </amp>
      </message>
        
   C: <message
          from='northumberland@shakespeare.example'
          id='richard2-4.1.247'
          to='kingrichard@royalty.england.example'>
        <body>My lord, dispatch; read o'er these articles.</body>
        <amp xmlns='http://jabber.org/protocol/amp'>
          <rule action='notify'
                condition='deliver'
                value='stored'/>
        </amp>
      </message>
        
   S: <message from='example.org'
               id='amp1'
               to='northumberland@example.net/field'
               type='error'>
        <amp xmlns='http://jabber.org/protocol/amp'
             from='kingrichard@example.org'
             status='error'
             to='northumberland@example.net/field'>
          <rule action='error'
                condition='deliver'
                value='stored'/>
        </amp>
        <error type='modify'>
          <undefined-condition
              xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
          <failed-rules xmlns='http://jabber.org/protocol/amp#errors'>
            <rule action='error'
                  condition='deliver'
                  value='stored'/>
          </failed-rules>
        </error>
      </message>
        
   S: <message from='example.org'
               id='amp1'
               to='northumberland@example.net/field'
               type='error'>
        <amp xmlns='http://jabber.org/protocol/amp'
             from='kingrichard@example.org'
             status='error'
             to='northumberland@example.net/field'>
          <rule action='error'
                condition='deliver'
                value='stored'/>
        </amp>
        <error type='modify'>
          <undefined-condition
              xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
          <failed-rules xmlns='http://jabber.org/protocol/amp#errors'>
            <rule action='error'
                  condition='deliver'
                  value='stored'/>
          </failed-rules>
        </error>
      </message>
        
8.3.3.22. unexpected-request
8.3.3.22. 意外请求

The recipient or server understood the request but was not expecting it at this time (e.g., the request was out of order); the associated error type SHOULD be "wait" or "modify".

收件人或服务器理解该请求,但此时不希望收到该请求(例如,该请求出现故障);关联的错误类型应为“等待”或“修改”。

   C: <iq from='romeo@example.net/foo'
          id='o6hsv25z'
          to='pubsub.example.com'
          type='set'>
        <pubsub xmlns='http://jabber.org/protocol/pubsub'>
           <unsubscribe
               node='my_musings'
               jid='romeo@example.net'/>
        </pubsub>
      </iq>
        
   C: <iq from='romeo@example.net/foo'
          id='o6hsv25z'
          to='pubsub.example.com'
          type='set'>
        <pubsub xmlns='http://jabber.org/protocol/pubsub'>
           <unsubscribe
               node='my_musings'
               jid='romeo@example.net'/>
        </pubsub>
      </iq>
        
   E: <iq from='pubsub.example.com'
          id='o6hsv25z'
          to='romeo@example.net/foo'
          type='error'>
        <error type='modify'>
          <unexpected-request
              xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
          <not-subscribed
              xmlns='http://jabber.org/protocol/pubsub#errors'/>
        </error>
      </iq>
        
   E: <iq from='pubsub.example.com'
          id='o6hsv25z'
          to='romeo@example.net/foo'
          type='error'>
        <error type='modify'>
          <unexpected-request
              xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
          <not-subscribed
              xmlns='http://jabber.org/protocol/pubsub#errors'/>
        </error>
      </iq>
        
8.3.4. Application-Specific Conditions
8.3.4. 应用特定条件

As noted, an application MAY provide application-specific stanza error information by including a properly namespaced child within the error element. Typically, the application-specific element supplements or further qualifies a defined element. Thus, the <error/> element will contain two or three child elements.

如前所述,应用程序可以通过在error元素中包含正确命名的子元素来提供特定于应用程序的节错误信息。通常,特定于应用程序的元素补充或进一步限定已定义的元素。因此,<error/>元素将包含两个或三个子元素。

   <iq id='ixc3v1b9' type='error'>
     <error type='modify'>
       <bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
       <too-many-parameters xmlns='http://example.org/ns'/>
     </error>
   </iq>
        
   <iq id='ixc3v1b9' type='error'>
     <error type='modify'>
       <bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
       <too-many-parameters xmlns='http://example.org/ns'/>
     </error>
   </iq>
        
   <message type='error' id='7h3baci9'>
     <error type='modify'>
       <undefined-condition
             xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
       <text xml:lang='en'
             xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>
         [ ... application-specific information ... ]
       </text>
       <too-many-parameters xmlns='http://example.org/ns'/>
     </error>
   </message>
        
   <message type='error' id='7h3baci9'>
     <error type='modify'>
       <undefined-condition
             xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
       <text xml:lang='en'
             xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>
         [ ... application-specific information ... ]
       </text>
       <too-many-parameters xmlns='http://example.org/ns'/>
     </error>
   </message>
        

An entity that receives an application-specific error condition it does not understand MUST ignore that condition but appropriately process the rest of the error stanza.

接收到它不理解的特定于应用程序的错误条件的实体必须忽略该条件,但适当地处理错误节的其余部分。

8.4. Extended Content
8.4. 扩展内容

Although the message, presence, and IQ stanzas provide basic semantics for messaging, availability, and request-response interactions, XMPP uses XML namespaces (see [XML-NAMES]) to extend the basic stanza syntax for the purpose of providing additional functionality.

尽管message、presence和IQ节为消息传递、可用性和请求-响应交互提供了基本语义,但XMPP使用XML名称空间(参见[XML-NAMES])来扩展基本节语法,以提供附加功能。

A message or presence stanza MAY contain one or more optional child elements specifying content that extends the meaning of the message (e.g., an XHTML-formatted version of the message body as described in [XEP-0071]), and an IQ stanza of type "get" or "set" MUST contain one such child element. Such a child element MAY have any name and MUST possess a namespace declaration (other than "jabber:client", "jabber: server", or "http://etherx.jabber.org/streams") that defines the data contained within the child element. Such a child element is called an "extension element". An extension element can be included either at the direct child level of the stanza or in any mix of levels.

消息或状态节可能包含一个或多个可选子元素,指定扩展消息含义的内容(例如,[XEP-0071]中描述的消息正文的XHTML格式版本),并且类型为“get”或“set”的IQ节必须包含一个这样的子元素。这样的子元素可以有任何名称,并且必须具有名称空间声明(除了“jabber:client”、“jabber:server”或http://etherx.jabber.org/streams)定义子元素中包含的数据。这样的子元素称为“扩展元素”。扩展元素既可以包含在节的直接子级,也可以包含在任何级别的混合中。

Similarly, "extension attributes" are allowed. That is: a stanza itself (i.e., an <iq/>, <message/>, or <presence/> element qualified by the "jabber:client" or "jabber:server" content namespace) or any child element of such a stanza (whether an extension element or a child element qualified by the content namespace) MAY also include one or more attributes qualified by XML namespaces other than the content namespace or the reserved "http://www.w3.org/XML/1998/namespace" namespace (including the so-called "empty namespace" if the attribute is not prefixed as described under [XML-NAMES]).

类似地,允许使用“扩展属性”。即:节本身(即由“jabber:client”或“jabber:server”内容命名空间限定的<iq/>、<message/>或<presence/>元素)或此类节的任何子元素(无论是扩展元素还是由内容命名空间限定的子元素)还可能包括一个或多个由XML名称空间限定的属性,而不是内容名称空间或保留名称空间”http://www.w3.org/XML/1998/namespace“名称空间(包括所谓的“空名称空间”,如果属性没有按照[XML-NAMES]中所述的前缀)。

Interoperability Note: For the sake of backward compatibility and maximum interoperability, an entity that generates a stanza SHOULD NOT include such attributes in the stanza itself or in child elements of the stanza that are qualified by the content namespaces "jabber:client" or "jabber:server" (e.g., the <body/> child of the <message/> stanza).

互操作性注意:为了向后兼容性和最大互操作性,生成节的实体不应在节本身或节的子元素中包含由内容名称空间“jabber:client”或“jabber:server”(例如,<message/>节的<body/>子元素)限定的此类属性。

An extension element or extension attribute is said to be "extended content" and the qualifying namespace for such an element or attribute is said to be an "extended namespace".

扩展元素或扩展属性称为“扩展内容”,而此类元素或属性的限定命名空间称为“扩展命名空间”。

Informational Note: Although extended namespaces for XMPP are commonly defined by the XMPP Standards Foundation (XSF) and by the IETF, no specification or IETF standards action is necessary to define extended namespaces, and any individual or organization is free to define XMPP extensions.

信息注释:虽然XMPP的扩展命名空间通常由XMPP标准基金会(XSF)和IETF定义,但没有定义或扩展IETF标准操作来定义扩展名称空间,任何个人或组织都可以自由定义XMPP扩展。

To illustrate these concepts, several examples follow.

为了说明这些概念,下面举几个例子。

The following stanza contains one direct child element whose extended namespace is 'jabber:iq:roster':

以下小节包含一个直接子元素,其扩展名称空间为“jabber:iq:花名册”:

   <iq from='juliet@capulet.com/balcony'
       id='h83vxa4c'
       type='get'>
    <query xmlns='jabber:iq:roster'/>
   </iq>
        
   <iq from='juliet@capulet.com/balcony'
       id='h83vxa4c'
       type='get'>
    <query xmlns='jabber:iq:roster'/>
   </iq>
        

The following stanza contains two direct child elements with two different extended namespaces.

以下小节包含两个具有两个不同扩展名称空间的直接子元素。

   <presence from='juliet@capulet.com/balcony'>
     <c xmlns='http://jabber.org/protocol/caps'
        hash='sha-1'
        node='http://code.google.com/p/exodus'
        ver='QgayPKawpkPSDYmwT/WM94uAlu0='/>
     <x xmlns='vcard-temp:x:update'>
       <photo>sha1-hash-of-image</photo>
     </x>
   </presence>
        
   <presence from='juliet@capulet.com/balcony'>
     <c xmlns='http://jabber.org/protocol/caps'
        hash='sha-1'
        node='http://code.google.com/p/exodus'
        ver='QgayPKawpkPSDYmwT/WM94uAlu0='/>
     <x xmlns='vcard-temp:x:update'>
       <photo>sha1-hash-of-image</photo>
     </x>
   </presence>
        

The following stanza contains two child elements, one of which is qualified by the "jabber:client" or "jabber:server" content namespace and one of which is qualified by an extended namespace; the extension element in turn contains a child element that is qualified by a different extended namespace.

以下小节包含两个子元素,其中一个由“jabber:client”或“jabber:server”内容命名空间限定,另一个由扩展命名空间限定;扩展元素又包含一个子元素,该子元素由不同的扩展命名空间限定。

   <message to='juliet@capulet.com'>
     <body>Hello?</body>
     <html xmlns='http://jabber.org/protocol/xhtml-im'>
       <body xmlns='http://www.w3.org/1999/xhtml'>
         <p style='font-weight:bold'>Hello?</p>
       </body>
     </html>
   </message>
        
   <message to='juliet@capulet.com'>
     <body>Hello?</body>
     <html xmlns='http://jabber.org/protocol/xhtml-im'>
       <body xmlns='http://www.w3.org/1999/xhtml'>
         <p style='font-weight:bold'>Hello?</p>
       </body>
     </html>
   </message>
        

It is conventional in the XMPP community for implementations to not generate namespace prefixes for elements that are qualified by extended namespaces (in the XML community, this convention is sometimes called "prefix-free canonicalization"). However, if an implementation generates such namespace prefixes then it MUST include the namespace declaration in the stanza itself or a child element of the stanza, not in the stream header (see Section 4.8.4).

在XMPP社区中,实现通常不为扩展名称空间限定的元素生成名称空间前缀(在XML社区中,此约定有时称为“无前缀规范化”)。但是,如果实现生成这样的名称空间前缀,那么它必须在节本身或节的子元素中包含名称空间声明,而不是在流头中(请参见第4.8.4节)。

Routing entities (typically servers) SHOULD try to maintain prefixes when serializing XML stanzas for processing, but receiving entities MUST NOT depend on the prefix strings to have any particular value (the allowance for the 'stream' prefix, described under Section 4.8.5, is an exception to this rule, albeit for streams rather than stanzas).

当序列化XML节以进行处理时,路由实体(通常是服务器)应尝试维护前缀,但接收实体不得依赖前缀字符串来具有任何特定值(第4.8.5节中描述的“流”前缀的容差是此规则的例外,尽管是流而不是节)。

Support for any given extended namespace is OPTIONAL on the part of any implementation. If an entity does not understand such a namespace, the entity's expected behavior depends on whether the entity is (1) the recipient or (2) a server that is routing or delivering the stanza to the recipient.

对任何给定扩展命名空间的支持在任何实现中都是可选的。如果一个实体不理解这样的名称空间,那么该实体的预期行为取决于该实体是(1)收件人还是(2)将节路由或传递给收件人的服务器。

If a recipient receives a stanza that contains an element or attribute it does not understand, it MUST NOT attempt to process that XML data and instead MUST proceed as follows.

如果收件人接收到包含其不理解的元素或属性的节,则不得尝试处理该XML数据,而是必须按照以下步骤进行处理。

o If an intended recipient receives a message stanza whose only child element is qualified by a namespace it does not understand, then depending on the XMPP application it MUST either ignore the entire stanza or return a stanza error, which SHOULD be <service-unavailable/> (Section 8.3.3.19).

o 如果预期收件人收到的消息节的唯一子元素由其不理解的命名空间限定,则根据XMPP应用程序的不同,它必须忽略整个节或返回节错误,该节错误应为<service unavailable/>(第8.3.3.19节)。

o If an intended recipient receives a presence stanza whose only child element is qualified by a namespace it does not understand, then it MUST ignore the child element by treating the presence stanza as if it contained no child element.

o 如果目标接收者接收到一个presence节,该节的唯一子元素由它不理解的名称空间限定,那么它必须通过将presence节视为不包含子元素来忽略该子元素。

o If an intended recipient receives a message or presence stanza that contains XML data qualified by a namespace it does not understand, then it MUST ignore the portion of the stanza qualified by the unknown namespace.

o 如果预期收件人接收到包含由其不理解的命名空间限定的XML数据的消息或状态节,则必须忽略由未知命名空间限定的节部分。

o If an intended recipient receives an IQ stanza of type "get" or "set" containing a child element qualified by a namespace it does not understand, then the entity MUST return an IQ stanza of type "error" with an error condition of <service-unavailable/>.

o 如果预期收件人接收到类型为“get”或“set”的IQ节,其中包含由其不理解的命名空间限定的子元素,则实体必须返回类型为“error”的IQ节,错误条件为<service unavailable/>。

If a server handles a stanza that is intended for delivery to another entity and that contains a child element it does not understand, it MUST route the stanza unmodified to a remote server or deliver the stanza unmodified to a connected client associated with a local account.

如果服务器处理要传递给另一个实体的节,并且该节包含它不理解的子元素,则它必须将未修改的节路由到远程服务器,或者将未修改的节传递到与本地帐户关联的连接客户端。

9. Detailed Examples
9. 详细例子

The detailed examples in this section further illustrate the protocols defined in this specification.

本节中的详细示例进一步说明了本规范中定义的协议。

9.1. Client-to-Server Examples
9.1. 客户端到服务器示例

The following examples show the XMPP data flow for a client negotiating an XML stream with a server, exchanging XML stanzas, and closing the negotiated stream. The server is "im.example.com", the server requires use of TLS, the client authenticates via the SASL SCRAM-SHA-1 mechanism as <juliet@im.example.com> with a password of "r0m30myr0m30", and the client binds a client-submitted resource to the stream. It is assumed that before sending the initial stream header, the client has already resolved an SRV record of _xmpp-client._tcp.im.example.com and has opened a TCP connection to the advertised port at the resolved IP address.

以下示例显示了客户端与服务器协商XML流、交换XML节以及关闭协商流的XMPP数据流。服务器为“im.example.com”,服务器要求使用TLS,客户端通过SASL SCRAM-SHA-1机制进行身份验证,如下所示:<juliet@im.example.com>密码为“r0m30myr0m30”,客户端将客户端提交的资源绑定到流。假设在发送初始流头之前,客户端已经解析了_xmpp-client._tcp.im.example.com的SRV记录,并且已经在解析的IP地址打开了到播发端口的tcp连接。

9.1.1. TLS
9.1.1. TLS

Step 1: Client initiates stream to server:

步骤1:客户端向服务器发起流:

   C: <stream:stream
        from='juliet@im.example.com'
        to='im.example.com'
        version='1.0'
        xml:lang='en'
        xmlns='jabber:client'
        xmlns:stream='http://etherx.jabber.org/streams'>
        
   C: <stream:stream
        from='juliet@im.example.com'
        to='im.example.com'
        version='1.0'
        xml:lang='en'
        xmlns='jabber:client'
        xmlns:stream='http://etherx.jabber.org/streams'>
        

Step 2: Server responds by sending a response stream header to client:

步骤2:服务器通过向客户端发送响应流头进行响应:

   S: <stream:stream
        from='im.example.com'
        id='t7AMCin9zjMNwQKDnplntZPIDEI='
        to='juliet@im.example.com'
        version='1.0'
        xml:lang='en'
        xmlns='jabber:client'
        xmlns:stream='http://etherx.jabber.org/streams'>
        
   S: <stream:stream
        from='im.example.com'
        id='t7AMCin9zjMNwQKDnplntZPIDEI='
        to='juliet@im.example.com'
        version='1.0'
        xml:lang='en'
        xmlns='jabber:client'
        xmlns:stream='http://etherx.jabber.org/streams'>
        

Step 3: Server sends stream features to client (only the STARTTLS extension at this point, which is mandatory-to-negotiate):

步骤3:服务器向客户机发送流功能(此时只有STARTTLS扩展,协商时必须使用该扩展):

   S: <stream:features>
        <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'>
          <required/>
        </starttls>
      </stream:features>
        
   S: <stream:features>
        <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'>
          <required/>
        </starttls>
      </stream:features>
        

Step 4: Client sends STARTTLS command to server:

步骤4:客户端向服务器发送STARTTLS命令:

   C: <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
        
   C: <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
        

Step 5: Server informs client that it is allowed to proceed:

步骤5:服务器通知客户端允许继续:

   S: <proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
        
   S: <proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
        

Step 5 (alt): Server informs client that STARTTLS negotiation has failed, closes the XML stream, and terminates the TCP connection (thus, the stream negotiation process ends unsuccessfully and the parties do not move on to the next step):

步骤5(alt):服务器通知客户端STARTTLS协商失败,关闭XML流,并终止TCP连接(因此,流协商过程失败,双方不继续下一步):

   S: <failure xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
      </stream:stream>
        
   S: <failure xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
      </stream:stream>
        

Step 6: Client and server attempt to complete TLS negotiation over the existing TCP connection (see [TLS] for details).

步骤6:客户端和服务器尝试通过现有TCP连接完成TLS协商(有关详细信息,请参阅[TLS])。

Step 7: If TLS negotiation is successful, client initiates a new stream to server over the TLS-protected TCP connection:

步骤7:如果TLS协商成功,客户端将通过受TLS保护的TCP连接向服务器发起新流:

   C: <stream:stream
        from='juliet@im.example.com'
        to='im.example.com'
        version='1.0'
        xml:lang='en'
        xmlns='jabber:client'
        xmlns:stream='http://etherx.jabber.org/streams'>
        
   C: <stream:stream
        from='juliet@im.example.com'
        to='im.example.com'
        version='1.0'
        xml:lang='en'
        xmlns='jabber:client'
        xmlns:stream='http://etherx.jabber.org/streams'>
        

Step 7 (alt): If TLS negotiation is unsuccessful, server closes TCP connection (thus, the stream negotiation process ends unsuccessfully and the parties do not move on to the next step):

步骤7(alt):如果TLS协商不成功,服务器将关闭TCP连接(因此,流协商过程将不成功结束,双方不会继续进行下一步):

9.1.2. SASL
9.1.2. 萨斯勒

Step 8: Server responds by sending a stream header to client along with any available stream features:

步骤8:服务器通过向客户端发送流头以及任何可用的流功能进行响应:

   S: <stream:stream
        from='im.example.com'
        id='vgKi/bkYME8OAj4rlXMkpucAqe4='
        to='juliet@im.example.com'
        version='1.0'
        xml:lang='en'
        xmlns='jabber:client'
        xmlns:stream='http://etherx.jabber.org/streams'>
        
   S: <stream:stream
        from='im.example.com'
        id='vgKi/bkYME8OAj4rlXMkpucAqe4='
        to='juliet@im.example.com'
        version='1.0'
        xml:lang='en'
        xmlns='jabber:client'
        xmlns:stream='http://etherx.jabber.org/streams'>
        
   S: <stream:features>
        <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
          <mechanism>SCRAM-SHA-1-PLUS</mechanism>
          <mechanism>SCRAM-SHA-1</mechanism>
          <mechanism>PLAIN</mechanism>
        </mechanisms>
      </stream:features>
        
   S: <stream:features>
        <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
          <mechanism>SCRAM-SHA-1-PLUS</mechanism>
          <mechanism>SCRAM-SHA-1</mechanism>
          <mechanism>PLAIN</mechanism>
        </mechanisms>
      </stream:features>
        

Step 9: Client selects an authentication mechanism (in this case, SCRAM-SHA-1), including initial response data:

步骤9:客户端选择身份验证机制(在本例中为SCRAM-SHA-1),包括初始响应数据:

   C: <auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl"
            mechanism="SCRAM-SHA-1">
        biwsbj1qdWxpZXQscj1vTXNUQUF3QUFBQU1BQUFBTlAwVEFBQUFBQUJQVTBBQQ==
      </auth>
        
   C: <auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl"
            mechanism="SCRAM-SHA-1">
        biwsbj1qdWxpZXQscj1vTXNUQUF3QUFBQU1BQUFBTlAwVEFBQUFBQUJQVTBBQQ==
      </auth>
        

The decoded base 64 data is "n,,n=juliet,r=oMsTAAwAAAAMAAAANP0TAAAAAABPU0AA".

解码后的base 64数据为“n,n=juliet,r=OMSTAAWAAAAANP0TAAAABPU0AA”。

Step 10: Server sends a challenge:

步骤10:服务器发送质询:

   S: <challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
        cj1vTXNUQUF3QUFBQU1BQUFBTlAwVEFBQUFBQUJQVTBBQWUxMjQ2OTViLTY5Y
        TktNGRlNi05YzMwLWI1MWIzODA4YzU5ZSxzPU5qaGtZVE0wTURndE5HWTBaaT
        AwTmpkbUxUa3hNbVV0TkRsbU5UTm1ORE5rTURNeixpPTQwOTY=
      </challenge>
        
   S: <challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
        cj1vTXNUQUF3QUFBQU1BQUFBTlAwVEFBQUFBQUJQVTBBQWUxMjQ2OTViLTY5Y
        TktNGRlNi05YzMwLWI1MWIzODA4YzU5ZSxzPU5qaGtZVE0wTURndE5HWTBaaT
        AwTmpkbUxUa3hNbVV0TkRsbU5UTm1ORE5rTURNeixpPTQwOTY=
      </challenge>
        

The decoded base 64 data is "r=oMsTAAwAAAAMAAAANP0TAAAAAABPU0AAe12469 5b-69a9-4de6-9c30- b51b3808c59e,s=NjhkYTM0MDgtNGY0Zi00NjdmLTkxMmUtNDlmNTNmNDNkMDMz,i=409 6" (line breaks not included in actual data).

解码后的基64数据为“r=OMSTAAWAAAMAAANP0TAAAABPU0AAE12469 5b-69a9-4de6-9c30-b51b3808c59e,s=NJHKYTM0MDGTNGY0ZI00NJDMLTKXMMUTNTNDNKMDMZ,i=409 6”(实际数据中不包括换行符)。

Step 11: Client sends a response:

步骤11:客户端发送响应:

   C: <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
        Yz1iaXdzLHI9b01zVEFBd0FBQUFNQUFBQU5QMFRBQUFBQUFCUFUwQUFlMTI0N
        jk1Yi02OWE5LTRkZTYtOWMzMC1iNTFiMzgwOGM1OWUscD1VQTU3dE0vU3ZwQV
        RCa0gyRlhzMFdEWHZKWXc9
      </response>
        
   C: <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
        Yz1iaXdzLHI9b01zVEFBd0FBQUFNQUFBQU5QMFRBQUFBQUFCUFUwQUFlMTI0N
        jk1Yi02OWE5LTRkZTYtOWMzMC1iNTFiMzgwOGM1OWUscD1VQTU3dE0vU3ZwQV
        RCa0gyRlhzMFdEWHZKWXc9
      </response>
        

The decoded base 64 data is "c=biws,r=oMsTAAwAAAAMAAAANP0TAAAAAABPU0 AAe124695b-69a9-4de6-9c30-b51b3808c59e,p=UA57tM/ SvpATBkH2FXs0WDXvJYw=" (line breaks not included in actual data).

解码后的base 64数据为“c=biws,r=OMSTAAWAAAMAAANP0TAAAABPU0 AAe124695b-69a9-4de6-9c30-b51b3808c59e,p=UA57tM/SvpATBkH2FXs0WDXvJYw=”(实际数据中不包括换行符)。

Step 12: Server informs client of success, including additional data with success:

步骤12:服务器通知客户端成功,包括其他成功数据:

   S: <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        dj1wTk5ERlZFUXh1WHhDb1NFaVc4R0VaKzFSU289
      </success>
        
   S: <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        dj1wTk5ERlZFUXh1WHhDb1NFaVc4R0VaKzFSU289
      </success>
        

The decoded base 64 data is "v=pNNDFVEQxuXxCoSEiW8GEZ+1RSo=".

解码的base 64数据为“v=pNNDFVEQxuXxCoSEiW8GEZ+1RSo=”。

Step 12 (alt): Server returns a SASL error to client (thus, the stream negotiation process ends unsuccessfully and the parties do not move on to the next step):

步骤12(alt):服务器将SASL错误返回给客户端(因此,流协商过程结束失败,双方不继续下一步):

   S: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        <not-authorized/>
      </failure>
      </stream>
        
   S: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        <not-authorized/>
      </failure>
      </stream>
        

Step 13: Client initiates a new stream to server:

步骤13:客户端向服务器发起新流:

   C: <stream:stream
        from='juliet@im.example.com'
        to='im.example.com'
        version='1.0'
        xml:lang='en'
        xmlns='jabber:client'
        xmlns:stream='http://etherx.jabber.org/streams'>
        
   C: <stream:stream
        from='juliet@im.example.com'
        to='im.example.com'
        version='1.0'
        xml:lang='en'
        xmlns='jabber:client'
        xmlns:stream='http://etherx.jabber.org/streams'>
        
9.1.3. Resource Binding
9.1.3. 资源绑定

Step 14: Server responds by sending a stream header to client along with supported features (in this case, resource binding):

步骤14:服务器通过向客户端发送流头以及支持的功能(在本例中为资源绑定)进行响应:

   S: <stream:stream
        from='im.example.com'
        id='gPybzaOzBmaADgxKXu9UClbprp0='
        to='juliet@im.example.com'
        version='1.0'
        xml:lang='en'
        xmlns='jabber:client'
        xmlns:stream='http://etherx.jabber.org/streams'>
        
   S: <stream:stream
        from='im.example.com'
        id='gPybzaOzBmaADgxKXu9UClbprp0='
        to='juliet@im.example.com'
        version='1.0'
        xml:lang='en'
        xmlns='jabber:client'
        xmlns:stream='http://etherx.jabber.org/streams'>
        
   S: <stream:features>
        <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
      </stream:features>
        
   S: <stream:features>
        <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
      </stream:features>
        

Upon being informed that resource binding is mandatory-to-negotiate, the client needs to bind a resource to the stream; here we assume that the client submits a human-readable text string.

当被告知协商必须进行资源绑定时,客户端需要将资源绑定到流;这里我们假设客户机提交了一个人类可读的文本字符串。

Step 15: Client binds a resource:

步骤15:客户端绑定资源:

   C: <iq id='yhc13a95' type='set'>
        <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
          <resource>balcony</resource>
        </bind>
      </iq>
        
   C: <iq id='yhc13a95' type='set'>
        <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
          <resource>balcony</resource>
        </bind>
      </iq>
        

Step 16: Server accepts submitted resourcepart and informs client of successful resource binding:

步骤16:服务器接受提交的resourcepart并通知客户端资源绑定成功:

   S: <iq id='yhc13a95' type='result'>
        <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
          <jid>
            juliet@im.example.com/balcony
          </jid>
        </bind>
      </iq>
        
   S: <iq id='yhc13a95' type='result'>
        <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
          <jid>
            juliet@im.example.com/balcony
          </jid>
        </bind>
      </iq>
        

Step 16 (alt): Server returns error to client (thus, the stream negotiation process ends unsuccessfully and the parties do not move on to the next step):

步骤16(alt):服务器将错误返回给客户端(因此,流协商过程结束失败,双方不继续下一步):

   S: <iq id='yhc13a95' type='error'>
        <error type='cancel'>
          <conflict xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </iq>
        
   S: <iq id='yhc13a95' type='error'>
        <error type='cancel'>
          <conflict xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </iq>
        
9.1.4. Stanza Exchange
9.1.4. 节交换

Now the client is allowed to send XML stanzas over the negotiated stream.

现在,允许客户端通过协商流发送XML节。

   C: <message from='juliet@im.example.com/balcony'
               id='ju2ba41c'
               to='romeo@example.net'
               type='chat'
               xml:lang='en'>
        <body>Art thou not Romeo, and a Montague?</body>
      </message>
        
   C: <message from='juliet@im.example.com/balcony'
               id='ju2ba41c'
               to='romeo@example.net'
               type='chat'
               xml:lang='en'>
        <body>Art thou not Romeo, and a Montague?</body>
      </message>
        

If necessary, sender's server negotiates XML streams with intended recipient's server (see Section 9.2).

如有必要,发送方的服务器将与目标接收方的服务器协商XML流(参见第9.2节)。

The intended recipient replies, and the message is delivered to the client.

预期的收件人会回复,并且消息会传递给客户端。

   E: <message from='romeo@example.net/orchard'
               id='ju2ba41c'
               to='juliet@im.example.com/balcony'
               type='chat'
               xml:lang='en'>
        <body>Neither, fair saint, if either thee dislike.</body>
      </message>
        
   E: <message from='romeo@example.net/orchard'
               id='ju2ba41c'
               to='juliet@im.example.com/balcony'
               type='chat'
               xml:lang='en'>
        <body>Neither, fair saint, if either thee dislike.</body>
      </message>
        

The client can subsequently send and receive an unbounded number of subsequent XML stanzas over the stream.

客户端随后可以通过流发送和接收无限数量的后续XML节。

9.1.5. Close
9.1.5. 关

Desiring to send no further messages, the client closes its stream to the server but waits for incoming data from the server.

希望不再发送任何消息,客户机关闭其到服务器的流,但等待来自服务器的传入数据。

   C: </stream:stream>
        
   C: </stream:stream>
        

Consistent with Section 4.4, the server might send additional data to the client and then closes its stream to the client.

与第4.4节一致,服务器可能会向客户端发送额外的数据,然后关闭向客户端发送的数据流。

   S: </stream:stream>
        
   S: </stream:stream>
        

The client now sends a TLS close_notify alert, receives a responding close_notify alert from the server, and then terminates the underlying TCP connection.

客户端现在发送TLS close_notify警报,从服务器接收响应的close_notify警报,然后终止底层TCP连接。

9.2. Server-to-Server Examples
9.2. 服务器到服务器示例

The following examples show the data flow for a server negotiating an XML stream with a peer server, exchanging XML stanzas, and closing the negotiated stream. The initiating server ("Server1") is im.example.com; the receiving server ("Server2") is example.net and it requires use of TLS; im.example.com presents a certificate and authenticates via the SASL EXTERNAL mechanism. It is assumed that before sending the initial stream header, Server1 has already resolved an SRV record of _xmpp-server._tcp.example.net and has opened a TCP connection to the advertised port at the resolved IP address. Note how Server1 declares the content namespace "jabber: server" as the default namespace and uses prefixes for stream-related elements, whereas Server2 uses prefix-free canonicalization.

以下示例显示了服务器与对等服务器协商XML流、交换XML节以及关闭协商流的数据流。发起服务器(“服务器1”)是im.example.com;接收服务器(“Server2”)是example.net,需要使用TLS;im.example.com通过SASL外部机制提供证书和身份验证。假设在发送初始流头之前,Server1已经解析了_xmpp-server._tcp.example.net的SRV记录,并在解析的IP地址处打开了到播发端口的tcp连接。请注意,Server1如何将内容命名空间“jabber:server”声明为默认命名空间,并为流相关元素使用前缀,而Server2使用无前缀规范化。

9.2.1. TLS
9.2.1. TLS

Step 1: Server1 initiates stream to Server2:

步骤1:Server1向Server2发起流:

   S1: <stream:stream
         from='im.example.com'
         to='example.net'
         version='1.0'
         xmlns='jabber:server'
         xmlns:stream='http://etherx.jabber.org/streams'>
        
   S1: <stream:stream
         from='im.example.com'
         to='example.net'
         version='1.0'
         xmlns='jabber:server'
         xmlns:stream='http://etherx.jabber.org/streams'>
        

Step 2: Server2 responds by sending a response stream header to Server1:

步骤2:Server2通过向Server1发送响应流头进行响应:

   S2: <stream
         from='example.net'
         id='hTiXkW+ih9k2SqdGkk/AZi0OJ/Q='
         to='im.example.com'
         version='1.0'
         xmlns='http://etherx.jabber.org/streams'>
        
   S2: <stream
         from='example.net'
         id='hTiXkW+ih9k2SqdGkk/AZi0OJ/Q='
         to='im.example.com'
         version='1.0'
         xmlns='http://etherx.jabber.org/streams'>
        

Step 3: Server2 sends stream features to Server1 (only the STARTTLS extension at this point, which is mandatory-to-negotiate):

步骤3:Server2将流功能发送到Server1(此时只有STARTTLS扩展,这是协商所必需的):

   S2: <features xmlns='http://etherx.jabber.org/streams'>
         <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'>
           <required/>
         </starttls>
       </features>
        
   S2: <features xmlns='http://etherx.jabber.org/streams'>
         <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'>
           <required/>
         </starttls>
       </features>
        

Step 4: Server1 sends the STARTTLS command to Server2:

步骤4:Server1向Server2发送STARTTLS命令:

   S1: <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
        
   S1: <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
        

Step 5: Server2 informs Server1 that it is allowed to proceed:

步骤5:Server2通知Server1允许继续:

   S2: <proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
        
   S2: <proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
        

Step 5 (alt): Server2 informs Server1 that STARTTLS negotiation has failed, closes the stream, and terminates the TCP connection (thus, the stream negotiation process ends unsuccessfully and the parties do not move on to the next step):

步骤5(alt):Server2通知Server1 STARTTLS协商失败,关闭流,并终止TCP连接(因此,流协商过程失败,双方不继续下一步):

   S2: <failure xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
       </stream>
        
   S2: <failure xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
       </stream>
        

Step 6: Server1 and Server2 attempt to complete TLS negotiation via TCP (see [TLS] for details).

步骤6:Server1和Server2尝试通过TCP完成TLS协商(有关详细信息,请参阅[TLS])。

Step 7: If TLS negotiation is successful, Server1 initiates a new stream to Server2 over the TLS-protected TCP connection:

步骤7:如果TLS协商成功,Server1将通过受TLS保护的TCP连接向Server2发起一个新流:

   S1: <stream:stream
         from='im.example.com'
         to='example.net'
         version='1.0'
         xmlns='jabber:server'
         xmlns:stream='http://etherx.jabber.org/streams'>
        
   S1: <stream:stream
         from='im.example.com'
         to='example.net'
         version='1.0'
         xmlns='jabber:server'
         xmlns:stream='http://etherx.jabber.org/streams'>
        

Step 7 (alt): If TLS negotiation is unsuccessful, Server2 closes the TCP connection (thus, the stream negotiation process ends unsuccessfully and the parties do not move on to the next step).

步骤7(alt):如果TLS协商不成功,Server2将关闭TCP连接(因此,流协商过程将失败结束,双方不会继续下一步)。

9.2.2. SASL
9.2.2. 萨斯勒

Step 8: Server2 sends a response stream header to Server1 along with available stream features (including a preference for the SASL EXTERNAL mechanism):

步骤8:Server2向Server1发送响应流头以及可用的流功能(包括SASL外部机制的首选项):

   S2: <stream
         from='example.net'
         id='RChdjlgj/TIBcbT9Keu31zDihH4='
         to='im.example.com'
         version='1.0'
         xmlns='http://etherx.jabber.org/streams'>
        
   S2: <stream
         from='example.net'
         id='RChdjlgj/TIBcbT9Keu31zDihH4='
         to='im.example.com'
         version='1.0'
         xmlns='http://etherx.jabber.org/streams'>
        
   S2: <features xmlns='http://etherx.jabber.org/streams'>
         <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
           <mechanism>EXTERNAL</mechanism>
         </mechanisms>
       </features>
        
   S2: <features xmlns='http://etherx.jabber.org/streams'>
         <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
           <mechanism>EXTERNAL</mechanism>
         </mechanisms>
       </features>
        

Step 9: Server1 selects the EXTERNAL mechanism (including an empty response of "="):

步骤9:Server1选择外部机制(包括“=”的空响应):

   S1: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
             mechanism='EXTERNAL'>=</auth>
        
   S1: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
             mechanism='EXTERNAL'>=</auth>
        

Step 10: Server2 returns success:

步骤10:Server2返回成功:

   S2: <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
        
   S2: <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
        

Step 10 (alt): Server2 informs Server1 of failed authentication (thus, the stream negotiation process ends unsuccessfully and the parties do not move on to the next step):

步骤10(alt):Server2通知Server1身份验证失败(因此,流协商过程结束失败,双方不继续进行下一步):

   S2: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
         <not-authorized/>
       </failure>
       </stream>
        
   S2: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
         <not-authorized/>
       </failure>
       </stream>
        

Step 11: Server1 initiates a new stream to Server2:

步骤11:Server1向Server2启动一个新流:

   S1: <stream:stream
         from='im.example.com'
         to='example.net'
         version='1.0'
         xmlns='jabber:server'
         xmlns:stream='http://etherx.jabber.org/streams'>
        
   S1: <stream:stream
         from='im.example.com'
         to='example.net'
         version='1.0'
         xmlns='jabber:server'
         xmlns:stream='http://etherx.jabber.org/streams'>
        

Step 12: Server2 responds by sending a stream header to Server1 along with any additional features (or, in this case, an empty features element):

步骤12:Server2通过向Server1发送流头以及任何附加功能(或者在本例中为空的features元素)进行响应:

   S2: <stream
         from='example.net'
         id='MbbV2FeojySpUIP6J91qaa+TWHM='
         to='im.example.com'
         version='1.0'
         xmlns='http://etherx.jabber.org/streams'>
        
   S2: <stream
         from='example.net'
         id='MbbV2FeojySpUIP6J91qaa+TWHM='
         to='im.example.com'
         version='1.0'
         xmlns='http://etherx.jabber.org/streams'>
        
   S2: <features xmlns='http://etherx.jabber.org/streams'/>
        
   S2: <features xmlns='http://etherx.jabber.org/streams'/>
        
9.2.3. Stanza Exchange
9.2.3. 节交换

Now Server1 is allowed to send XML stanzas to Server2 over the negotiated stream from im.example.com to example.net; here we assume that the transferred stanzas are those shown earlier for client-to-server communication, albeit over a server-to-server stream qualified by the 'jabber:server' namespace.

现在,允许Server1通过从im.example.com到example.net的协商流向Server2发送XML节;在这里,我们假设传输的节是前面为客户机到服务器通信显示的节,尽管是通过“jabber:server”名称空间限定的服务器到服务器流。

Server1 sends XML stanza to Server2:

Server1向Server2发送XML节:

   S1: <message from='juliet@im.example.com/balcony'
                id='ju2ba41c'
                to='romeo@example.net'
                type='chat'
                xml:lang='en'>
       <body>Art thou not Romeo, and a Montague?</body>
      </message>
        
   S1: <message from='juliet@im.example.com/balcony'
                id='ju2ba41c'
                to='romeo@example.net'
                type='chat'
                xml:lang='en'>
       <body>Art thou not Romeo, and a Montague?</body>
      </message>
        
9.2.4. Close
9.2.4. 关

Desiring to send no further messages, Server1 closes its stream to Server2 but waits for incoming data from Server2. (In practice, the stream would most likely remain open for some time, since Server1 and Server2 do not immediately know if the stream will be needed for further communication.)

希望不再发送任何消息,Server1关闭其到Server2的流,但等待来自Server2的传入数据。(实际上,流很可能会保持打开状态一段时间,因为Server1和Server2无法立即知道是否需要流进行进一步通信。)

   S1: </stream:stream>
        
   S1: </stream:stream>
        

Consistent with the recommended stream closing handshake, Server2 closes the stream as well:

与建议的流关闭握手一致,Server2也关闭流:

   S2: </stream>
        
   S2: </stream>
        

Server1 now sends a TLS close_notify alert, receives a responding close_notify alert from Server2, and then terminates the underlying TCP connection.

Server1现在发送TLS close_notify警报,从Server2接收响应的close_notify警报,然后终止底层TCP连接。

10. Server Rules for Processing XML Stanzas
10. 处理XML节的服务器规则

Each server implementation will contain its own logic for processing stanzas it receives. Such logic determines whether the server needs to route a given stanza to another domain, deliver it to a local entity (typically a connected client associated with a local account), or handle it directly within the server itself. This section provides general rules for processing XML stanzas. However, particular XMPP applications MAY specify delivery rules that modify or supplement the following rules (e.g., a set of delivery rules for instant messaging and presence applications is defined in [XMPP-IM]).

每个服务器实现都将包含自己的逻辑,用于处理接收到的节。这种逻辑确定服务器是否需要将给定的节路由到另一个域,将其传递到本地实体(通常是与本地帐户关联的连接客户端),或者直接在服务器本身内处理它。本节提供处理XML节的一般规则。然而,特定的XMPP应用程序可以指定修改或补充以下规则的传递规则(例如,[XMPP-IM]中定义了一组即时消息和状态应用程序的传递规则)。

10.1. In-Order Processing
10.1. 订单处理

An XMPP server MUST ensure in-order processing of the stanzas and other XML elements it receives over a given input stream from a connected client or remote server.

XMPP服务器必须确保按顺序处理通过给定输入流从连接的客户端或远程服务器接收的节和其他XML元素。

In-order processing applies (a) to any XML elements used to negotiate and manage XML streams, and (b) to all uses of XML stanzas, including but not limited to the following:

顺序处理适用于(a)用于协商和管理XML流的任何XML元素,以及(b)所有XML节的使用,包括但不限于以下内容:

1. Stanzas sent by a client to its server or to its own bare JID for direct processing by the server (e.g., in-order processing of a roster get and initial presence as described in [XMPP-IM]).

1. 客户机发送到其服务器或其自己的裸JID以供服务器直接处理的节(例如,[XMPP-IM]中所述的花名册获取和初始存在的顺序处理)。

2. Stanzas sent by a connected client and intended for delivery to another entity associated with the server (e.g., stanzas addressed from <juliet@im.example.com> to <nurse@im.example.com>). The server MUST ensure that it delivers stanzas addressed to the intended recipient in the order it receives them over the input stream from the sending client, treating stanzas addressed to the bare JID and the full JID of the intended recipient as equivalent for delivery purposes.

2. 由连接的客户端发送并打算传递到与服务器关联的另一个实体的节(例如,从<juliet@im.example.com>到<nurse@im.example.com>). 服务器必须确保按照从发送客户端通过输入流接收到的顺序,将发送到预期接收者的裸JID和完整JID的节视为等效的交付目的。

3. Stanzas sent by a connected client and intended for delivery to an entity located at a remote domain (e.g., stanzas addressed from <juliet@im.example.com> to <romeo@example.net>). The routing server MUST ensure that it routes stanzas addressed to the intended recipient in the order it receives them over the input stream from the sending client, treating stanzas addressed to the bare JID and the full JID of the intended recipient as equivalent for routing purposes. To help ensure in-order processing, the routing server MUST route such stanzas over a single output stream to the remote domain, rather than sending some stanzas over one server-to-server stream and other stanzas over another server-to-server stream.

3. 由连接的客户端发送并打算发送到位于远程域的实体的节(例如,从<juliet@im.example.com>到<romeo@example.net>). 路由服务器必须确保它按照从发送客户端通过输入流接收到的顺序,将发送到预期收件人的节路由到预期收件人,并将发送到预期收件人的裸JID和完整JID的节视为等效的路由。为了帮助确保顺序处理,路由服务器必须通过单个输出流将这些节路由到远程域,而不是通过一个服务器向服务器流发送一些节,通过另一个服务器向服务器流发送其他节。

4. Stanzas routed from one server to another server for delivery to an entity associated with the remote domain (e.g., stanzas addressed from <juliet@im.example.com> to <romeo@example.net> and routed by <im.example.com> over a server-to-server stream to <example.net>). The delivering server MUST ensure that it delivers stanzas to the intended recipient in the order it receives them over the input stream from the routing server, treating stanzas addressed to the bare JID and the full JID of the intended recipient as equivalent for delivery purposes.

4. 节从一台服务器路由到另一台服务器,以传递到与远程域关联的实体(例如,从<juliet@im.example.com>到<romeo@example.net>并由<im.example.com>通过服务器到服务器的流路由到<example.net>)。传递服务器必须确保按照从路由服务器通过输入流接收的顺序将节传递给预期收件人,并将发送给预期收件人的裸JID和完整JID的节视为等效的传递目的。

5. Stanzas sent by one server to another server for direct processing by the server that is hosting the remote domain (e.g., stanzas addressed from <im.example.com> to <example.net>).

5. 由一台服务器发送到另一台服务器以供托管远程域的服务器直接处理的节(例如,从<im.example.com>到<example.net>的节)。

If the server's processing of a particular request could have an effect on its processing of subsequent data it might receive over that input stream (e.g., enforcement of communication policies), it MUST suspend processing of subsequent data until it has processed the request.

如果服务器对特定请求的处理可能会对其通过该输入流接收的后续数据的处理产生影响(例如,强制执行通信策略),则必须暂停后续数据的处理,直到处理完该请求为止。

In-order processing applies only to a single input stream. Therefore, a server is not responsible for ensuring the coherence of data it receives across multiple input streams associated with the same local account (e.g., stanzas received over two different input streams from <juliet@im.example.com/balcony> and <juliet@im.example.com/chamber>) or the same remote domain (e.g., two different input streams negotiated by a remote domain; however, a server MAY close the stream with a <conflict/> stream error (Section 4.9.3.3) if a remote server attempts to negotiate more than one stream, as described under Section 4.9.3.3).

顺序处理仅适用于单个输入流。因此,服务器不负责确保其在与同一本地帐户相关联的多个输入流中接收的数据的一致性(例如,通过来自本地帐户的两个不同输入流接收的节)<juliet@im.example.com/阳台>和<juliet@im.example.com/商会>)或相同的远程域(例如,由远程域协商的两个不同的输入流;但是,如果远程服务器尝试协商多个流,则服务器可能会以<conflict/>流错误关闭流(第4.9.3.3节),如第4.9.3.3节所述)。

10.2. General Considerations
10.2. 一般考虑

At high level, there are three primary considerations at play in server processing of XML stanzas, which sometimes are at odds but need to be managed in a consistent way:

在高层次上,在XML节的服务器处理中有三个主要考虑因素,它们有时会有冲突,但需要以一致的方式进行管理:

1. It is good to deliver a stanza to the intended recipient if possible.

1. 如果可能的话,最好将一节诗交给预期的接受者。

2. If a stanza cannot be delivered, it is helpful to inform the sender.

2. 如果一节无法交付,通知发件人是有帮助的。

3. It is bad to facilitate directory harvesting attacks (Section 13.11) and presence leaks (Section 13.10.2).

3. 不利于目录捕获攻击(第13.11节)和存在漏洞(第13.10.2节)。

With regard to possible delivery-related attacks, the following points need to be kept in mind:

关于可能的交付相关攻击,需要记住以下几点:

1. From the perspective of an attacker, there is little if any effective difference between the server's (i) delivering the stanza or storing it offline for later delivery (see [XMPP-IM]) and (ii) silently ignoring it (because an error is not returned immediately in any of those cases); therefore, in scenarios where a server delivers a stanza or places the stanza into offline storage for later delivery, it needs to silently ignore the stanza if that account does not exist.

1. 从攻击者的角度来看,服务器(i)交付节或离线存储节以供以后交付(请参见[XMPP-IM])和(ii)默默忽略节(因为在任何情况下都不会立即返回错误)之间的有效区别几乎没有;因此,在服务器交付一个节或将该节放入脱机存储以便稍后交付的场景中,如果该帐户不存在,则需要默默地忽略该节。

2. How a server processes stanzas sent to the bare JID <localpart@domainpart> has implications for directory harvesting, because an attacker could determine whether an account exists if the server responds differently depending on whether there is an account for a given bare JID.

2. 服务器如何处理发送到裸JID的节<localpart@domainpart>对目录捕获有影响,因为如果服务器根据给定的裸JID是否有帐户做出不同的响应,攻击者可以确定帐户是否存在。

3. How a server processes stanzas sent to a full JID has implications for presence leaks, because an attacker could send requests to multiple full JIDs and receive different replies depending on whether the user has a device currently online at that full JID. The use of randomized resourceparts (whether generated by the client or the server as described under Section 7) significantly helps to mitigate this attack, so it is of somewhat lesser concern than the directory harvesting attack.

3. 服务器如何处理发送到完整JID的节会导致存在泄漏,因为攻击者可以向多个完整JID发送请求并接收不同的回复,这取决于用户当前是否有设备在该完整JID上联机。使用随机化resourceparts(无论是由第7节中所述的客户端还是服务器生成)有助于显著减轻此攻击,因此它的关注度略低于目录捕获攻击。

Naturally, presence is not leaked if the entity to which a user's server returns an error already knows the user's presence or is authorized to do so (e.g., by means of a presence subscription or directed presence), and a server does not enable a directory

当然,如果用户的服务器返回错误的实体已经知道用户的存在或被授权这样做(例如,通过存在订阅或定向存在),并且服务器不启用目录,则存在不会泄漏

harvesting attack if it returns an error to an entity that already knows if a user exists (e.g., because the entity is in the user's contact list); these matters are discussed more fully in [XMPP-IM].

如果向已经知道用户是否存在的实体返回错误(例如,因为该实体在用户的联系人列表中),则捕获攻击;[XMPP-IM]对这些问题进行了更全面的讨论。

10.3. No 'to' Address
10.3. 没有“收件人”地址

If the stanza possesses no 'to' attribute, the server MUST handle it directly on behalf of the entity that sent it, where the meaning of "handle it directly" depends on whether the stanza is message, presence, or IQ. Because all stanzas received from other servers MUST possess a 'to' attribute, this rule applies only to stanzas received from a local entity (typically a client) that is connected to the server.

如果节不具有“to”属性,则服务器必须代表发送该节的实体直接处理该节,其中“直接处理”的含义取决于节是消息、状态还是IQ。由于从其他服务器接收的所有节都必须具有“to”属性,因此此规则仅适用于从连接到服务器的本地实体(通常是客户端)接收的节。

10.3.1. Message
10.3.1. 消息

If the server receives a message stanza with no 'to' attribute, it MUST treat the message as if the 'to' address were the bare JID <localpart@domainpart> of the sending entity.

如果服务器接收到没有“to”属性的消息节,则必须将该消息视为“to”地址是裸JID<localpart@domainpart>发送实体的名称。

10.3.2. Presence
10.3.2. 在场

If the server receives a presence stanza with no 'to' attribute, it MUST broadcast it to the entities that are subscribed to the sending entity's presence, if applicable ([XMPP-IM] defines the semantics of such broadcasting for presence applications).

如果服务器接收到不带“to”属性的状态节,则必须将其广播给订阅发送实体状态的实体(如果适用)([XMPP-IM]定义了状态应用程序的此类广播语义)。

10.3.3. IQ
10.3.3. 智商

If the server receives an IQ stanza with no 'to' attribute, it MUST process the stanza on behalf of the account from which received the stanza, as follows:

如果服务器接收到不带“to”属性的IQ节,则必须代表接收该节的帐户处理该节,如下所示:

1. If the IQ stanza is of type "get" or "set" and the server understands the namespace that qualifies the payload, the server MUST handle the stanza on behalf of the sending entity or return an appropriate error to the sending entity. Although the meaning of "handle" is determined by the semantics of the qualifying namespace, in general the server will respond to the IQ stanza of type "get" or "set" by returning an appropriate IQ stanza of type "result" or "error", responding as if the server were the bare JID of the sending entity. As an example, if the sending entity sends an IQ stanza of type "get" where the payload is qualified by the 'jabber:iq:roster' namespace (as described in [XMPP-IM]), then the server will return the roster associated with the sending entity's bare JID to the particular resource of the sending entity that requested the roster.

1. 如果IQ节的类型为“get”或“set”,并且服务器了解限定有效负载的命名空间,则服务器必须代表发送实体处理该节,或者向发送实体返回适当的错误。尽管“handle”的含义由限定名称空间的语义决定,但通常情况下,服务器将通过返回类型为“result”或“error”的适当IQ节来响应类型为“get”或“set”的IQ节,就像服务器是发送实体的裸JID一样进行响应。例如,如果发送实体发送类型为“get”的IQ节,其中有效负载由“jabber:IQ:Floster”命名空间限定(如[XMPP-IM]中所述),则服务器将把与发送实体的裸JID相关联的花名册返回给请求花名册的发送实体的特定资源。

2. If the IQ stanza is of type "get" or "set" and the server does not understand the namespace that qualifies the payload, the server MUST return an error to the sending entity, which MUST be <service-unavailable/>.

2. 如果IQ节的类型为“get”或“set”,并且服务器不理解限定有效负载的命名空间,则服务器必须向发送实体返回一个错误,该错误必须为<service unavailable/>。

3. If the IQ stanza is of type "error" or "result", the server MUST handle the error or result in accordance with the payload of the associated IQ stanza or type "get" or "set" (if there is no such associated stanza, the server MUST ignore the error or result stanza).

3. 如果IQ节类型为“错误”或“结果”,服务器必须根据相关IQ节或类型“获取”或“设置”的有效负载处理错误或结果(如果没有此类相关节,服务器必须忽略错误或结果节)。

10.4. Remote Domain
10.4. 远程域

If the domainpart of the JID contained in the 'to' attribute does not match one of the configured FQDNs of the server, the server SHOULD attempt to route the stanza to the remote domain (subject to local service provisioning and security policies regarding inter-domain communication, since such communication is OPTIONAL for any given deployment). As described in the following sections, there are two possible cases.

如果“to”属性中包含的JID的domainpart与服务器的某个已配置FQDN不匹配,服务器应尝试将节路由到远程域(取决于本地服务提供和域间通信的安全策略,因为此类通信对于任何给定部署都是可选的)。如以下章节所述,有两种可能的情况。

Security Warning: These rules apply only client-to-server streams. As described under Section 8.1.1.2, a server MUST NOT accept a stanza over a server-to-server stream if the domainpart of the JID in the 'to' attribute does not match an FQDN serviced by the receiving server.

安全警告:这些规则仅适用于客户端到服务器流。如第8.1.1.2节所述,如果“to”属性中JID的domainpart与接收服务器提供的FQDN不匹配,则服务器不得通过服务器到服务器流接受节。

10.4.1. Existing Stream
10.4.1. 现有河流

If a server-to-server stream already exists between the two domains, the sender's server SHOULD attempt to route the stanza to the authoritative server for the remote domain over the existing stream.

如果两个域之间已经存在服务器到服务器的流,则发送方的服务器应尝试通过现有流将节路由到远程域的权威服务器。

10.4.2. No Existing Stream
10.4.2. 无现有河流

If there exists no server-to-server stream between the two domains, the sender's server will proceed as follows:

如果两个域之间不存在服务器到服务器的流,则发送方的服务器将按如下方式进行:

1. Resolve the FQDN of the remote domain (as described under Section 13.9.2).

1. 解析远程域的FQDN(如第13.9.2节所述)。

2. Negotiate a server-to-server stream between the two domains (as defined under Section 5 and Section 6).

2. 协商两个域之间的服务器到服务器流(如第5节和第6节所定义)。

3. Route the stanza to the authoritative server for the remote domain over the newly established stream.

3. 通过新建立的流将节路由到远程域的权威服务器。

10.4.3. Error Handling
10.4.3. 错误处理

If routing of a stanza to the intended recipient's server is unsuccessful, the sender's server MUST return an error to the sender. If resolution of the remote domain is unsuccessful, the stanza error MUST be <remote-server-not-found/> (Section 8.3.3.16). If resolution succeeds but streams cannot be negotiated, the stanza error MUST be <remote-server-timeout/> (Section 8.3.3.17).

如果将节路由到预期收件人的服务器失败,则发件人的服务器必须向发件人返回错误。如果远程域解析失败,则节错误必须为<remote server not found/>(第8.3.3.16节)。如果解析成功但无法协商流,则节错误必须为<remote server timeout/>(第8.3.3.17节)。

If stream negotiation with the intended recipient's server is successful but the remote server cannot deliver the stanza to the recipient, the remote server MUST return an appropriate error to the sender by way of the sender's server.

如果与预期收件人服务器的流协商成功,但远程服务器无法将节传递给收件人,则远程服务器必须通过发件人服务器向发件人返回适当的错误。

10.5. Local Domain
10.5. 本地域

If the domainpart of the JID contained in the 'to' attribute matches one of the configured FQDNs of the server, the server MUST first determine if the FQDN is serviced by the server itself or by a specialized local service. If the latter, the server MUST route the stanza to that service. If the former, the server MUST proceed as follows. However, the server MUST NOT route or "forward" the stanza to another domain, because it is the server's responsibility to process all stanzas for which the domainpart of the 'to' address matches one of the configured FQDNs of the server (among other things, this helps to prevent looping).

如果“to”属性中包含的JID的domainpart与服务器的某个已配置FQDN匹配,则服务器必须首先确定FQDN是由服务器本身还是由专门的本地服务提供服务。如果是后者,服务器必须将节路由到该服务。如果是前者,则服务器必须按以下步骤进行。但是,服务器不得将节路由或“转发”到另一个域,因为服务器有责任处理“to”地址的domainpart与服务器的一个已配置FQDN匹配的所有节(除其他外,这有助于防止循环)。

10.5.1. domainpart
10.5.1. 域部分

If the JID contained in the 'to' attribute is of the form <domainpart>, then the server MUST either (a) handle the stanza as appropriate for the stanza kind or (b) return an error stanza to the sender.

如果“to”属性中包含的JID的形式为<domainpart>,则服务器必须(a)根据节类型处理节,或者(b)将错误节返回给发送方。

10.5.2. domainpart/resourcepart
10.5.2. 域部分/资源部分

If the JID contained in the 'to' attribute is of the form <domainpart/resourcepart>, then the server MUST either (a) handle the stanza as appropriate for the stanza kind or (b) return an error stanza to the sender.

如果“to”属性中包含的JID格式为<domainpart/resourcepart>,则服务器必须(a)根据节类型处理节,或者(b)将错误节返回给发送方。

10.5.3. localpart@domainpart
10.5.3. localpart@domainpart

An address of this type is normally associated with an account on the server. The following rules provide some general guidelines; more detailed rules in the context of instant messaging and presence applications are provided in [XMPP-IM].

这种类型的地址通常与服务器上的帐户相关联。以下规则提供了一些一般准则;[XMPP-IM]中提供了即时消息和状态应用程序上下文中更详细的规则。

10.5.3.1. No Such User
10.5.3.1. 没有这样的用户

If there is no local account associated with the <localpart@domainpart>, how the stanza is processed depends on the stanza type.

如果没有与关联的本地帐户<localpart@domainpart>,节的处理方式取决于节类型。

o For a message stanza, the server MUST either (a) silently ignore the stanza or (b) return a <service-unavailable/> stanza error (Section 8.3.3.19) to the sender.

o 对于消息节,服务器必须(a)静默忽略该节,或(b)向发送方返回<service unavailable/>节错误(第8.3.3.19节)。

o For a presence stanza, the server SHOULD ignore the stanza (or behave as described in [XMPP-IM]).

o 对于状态节,服务器应该忽略该节(或者按照[XMPP-IM]中的描述进行操作)。

o For an IQ stanza, the server MUST return a <service-unavailable/> stanza error (Section 8.3.3.19) to the sender.

o 对于IQ节,服务器必须向发送方返回<service unavailable/>节错误(第8.3.3.19节)。

10.5.3.2. User Exists
10.5.3.2. 用户存在

If the JID contained in the 'to' attribute is of the form <localpart@domainpart>, how the stanza is processed depends on the stanza type.

如果“to”属性中包含的JID的形式为<localpart@domainpart>,节的处理方式取决于节类型。

o For a message stanza, if there exists at least one connected resource for the account then the server SHOULD deliver it to at least one of the connected resources. If there exists no connected resource then the server MUST either (a) store the message offline for delivery when the account next has a connected resource or (b) return a <service-unavailable/> stanza error (Section 8.3.3.19).

o 对于消息节,如果帐户至少存在一个连接的资源,则服务器应将其传递给至少一个连接的资源。如果不存在连接的资源,则服务器必须(a)在帐户下一个有连接的资源时脱机存储邮件以进行传递,或(b)返回<service unavailable/>节错误(第8.3.3.19节)。

o For a presence stanza, if there exists at least one connected resource that has sent initial presence (i.e., has a "presence session" as defined in [XMPP-IM]) then the server SHOULD deliver it to such resources. If there exists no connected resource then the server SHOULD ignore the stanza (or behave as described in [XMPP-IM]).

o 对于状态节,如果存在至少一个已发送初始状态的连接资源(即,具有[XMPP-IM]中定义的“状态会话”),则服务器应将其交付给此类资源。如果不存在已连接的资源,则服务器应忽略该节(或按照[XMPP-IM]中的描述进行操作)。

o For an IQ stanza, the server MUST handle it directly on behalf of the intended recipient.

o 对于IQ节,服务器必须直接代表预期的收件人处理它。

10.5.4. localpart@domainpart/resourcepart
10.5.4. localpart@domainpart/资源部分

If the JID contained in the 'to' attribute is of the form <localpart@domainpart/resourcepart> and the user exists but there is no connected resource that exactly matches the full JID, the stanza SHOULD be processed as if the JID were of the form <localpart@domainpart> as described under Section 10.5.3.2.

如果“to”属性中包含的JID的形式为<localpart@domainpart/resourcepart>并且用户存在,但是没有与完整JID完全匹配的连接资源,应该像处理JID一样处理该节<localpart@domainpart>如第10.5.3.2节所述。

If the JID contained in the 'to' attribute is of the form <localpart@domainpart/resourcepart>, the user exists, and there is a connected resource that exactly matches the full JID, the server MUST deliver the stanza to that connected resource.

如果“to”属性中包含的JID的形式为<localpart@domainpart/resourcepart>,用户存在,并且存在与完整JID完全匹配的连接资源,服务器必须将节传递给该连接资源。

11. XML Usage
11. XML使用
11.1. XML Restrictions
11.1. XML限制

XMPP defines a class of data objects called XML streams as well as the behavior of computer programs that process XML streams. XMPP is an application profile or restricted form of the Extensible Markup Language [XML], and a complete XML stream (including start and end stream tags) is a conforming XML document.

XMPP定义了一类称为XML流的数据对象,以及处理XML流的计算机程序的行为。XMPP是可扩展标记语言[XML]的应用程序配置文件或受限形式,完整的XML流(包括开始和结束流标记)是一致的XML文档。

However, XMPP does not deal with XML documents but with XML streams. Because XMPP does not require the parsing of arbitrary and complete XML documents, there is no requirement that XMPP needs to support the full feature set of [XML]. Furthermore, XMPP uses XML to define protocol data structures and extensions for the purpose of structured interactions between network entities and therefore adheres to the recommendations provided in [XML-GUIDE] regarding restrictions on the use of XML in IETF protocols. As a result, the following features of XML are prohibited in XMPP:

但是,XMPP不处理XML文档,而是处理XML流。因为XMPP不需要解析任意完整的XML文档,所以XMPP不需要支持[XML]的完整特性集。此外,XMPP使用XML定义协议数据结构和扩展,以实现网络实体之间的结构化交互,因此遵守[XML-GUIDE]中关于在IETF协议中使用XML的限制的建议。因此,XML的以下特性在XMPP中被禁止:

o comments (as defined in Section 2.5 of [XML])

o 注释(定义见[XML]第2.5节)

o processing instructions (Section 2.6 therein)

o 处理说明(其中第2.6节)

o internal or external DTD subsets (Section 2.8 therein)

o 内部或外部DTD子集(其中第2.8节)

o internal or external entity references (Section 4.2 therein) with the exception of the predefined entities (Section 4.6 therein)

o 内部或外部实体参考(其中第4.2节),预定义实体除外(其中第4.6节)

An XMPP implementation MUST behave as follows with regard to these features:

就这些特性而言,XMPP实现的行为必须如下所示:

1. An XMPP implementation MUST NOT inject characters matching such features into an XML stream.

1. XMPP实现不能将与这些特性匹配的字符注入XML流。

2. If an XMPP implementation receives characters matching such features over an XML stream, it MUST close the stream with a stream error, which SHOULD be <restricted-xml/> (Section 4.9.3.18), although some existing implementations send <bad-format/> (Section 4.9.3.1) instead.

2. 如果XMPP实现通过XML流接收到与这些特性匹配的字符,它必须关闭流错误,这应该是<restricted XML/>(第4.9.3.18节),尽管一些现有实现发送<bad format/>(第4.9.3.1节)。

11.2. XML Namespace Names and Prefixes
11.2. XML名称空间名称和前缀

XML namespaces (see [XML-NAMES]) are used within XMPP streams to create strict boundaries of data ownership. The basic function of namespaces is to separate different vocabularies of XML elements that are structurally mixed together. Ensuring that XMPP streams are namespace-aware enables any allowable XML to be structurally mixed with any data element within XMPP. XMPP-specific rules for XML namespace names and prefixes are defined under Section 4.8 for XML streams and Section 8.4 for XML stanzas.

XML名称空间(参见[XML-NAMES])在XMPP流中用于创建严格的数据所有权边界。名称空间的基本功能是分离在结构上混合在一起的XML元素的不同词汇表。确保XMPP流具有名称空间意识,使得任何允许的XML在结构上都可以与XMPP中的任何数据元素混合。XML命名空间名称和前缀的XMPP特定规则在第4.8节XML流和第8.4节XML节中定义。

11.3. Well-Formedness
11.3. 良好形式

In XML, there are two varieties of well-formedness:

在XML中,有两种格式良好:

o "XML-well-formedness" in accordance with the definition of "well-formed" from Section 2.1 of [XML].

o “XML格式良好”符合[XML]第2.1节中“格式良好”的定义。

o "Namespace-well-formedness" in accordance with the definition of "namespace-well-formed" from Section 7 of [XML-NAMES].

o 根据[XML-NAMES]第7节“名称空间格式良好”的定义,“名称空间格式良好”。

The following rules apply:

以下规则适用:

1. An XMPP entity MUST NOT generate data that is not XML-well-formed.

1. XMPP实体不能生成XML格式不正确的数据。

2. An XMPP entity MUST NOT accept data that is not XML-well-formed; instead it MUST close the stream over which the data was received with a <not-well-formed/> stream error (Section 4.9.3.13).

2. XMPP实体不能接受XML格式不正确的数据;相反,它必须关闭接收数据的流,并出现<not well format/>流错误(第4.9.3.13节)。

3. An XMPP entity MUST NOT generate data that is not namespace-well-formed.

3. XMPP实体不能生成命名空间格式不正确的数据。

4. An XMPP entity MUST NOT accept data that is not namespace-well-formed (in particular, an XMPP server MUST NOT route or deliver data that is not namespace-well-formed); instead it MUST return either a <not-acceptable/> stanza error (Section 8.3.3.9) or close the stream with a <not-well-formed/> stream error (Section 4.9.3.13), where it is preferable to close the stream with a stream error because accepting such data can open an entity to certain denial-of-service attacks.

4. XMPP实体不得接受命名空间格式不正确的数据(特别是,XMPP服务器不得路由或传递命名空间格式不正确的数据);相反,它必须返回<not acceptable/>节错误(第8.3.3.9节)或使用<not well format/>流错误关闭流(第4.9.3.13节),其中最好使用流错误关闭流,因为接受此类数据会使实体遭受某些拒绝服务攻击。

Interoperability Note: Because these restrictions were underspecified in [RFC3920], it is possible that implementations based on that specification will send data that does not comply with these restrictions.

互操作性说明:由于[RFC3920]中未对这些限制进行详细说明,因此基于该规范的实现可能会发送不符合这些限制的数据。

11.4. Validation
11.4. 验证

A server is not responsible for ensuring that XML data delivered to a connected client or routed to a peer server is valid, in accordance with the definition of "valid" provided in Section 2.8 of [XML]. An implementation MAY choose to accept or send only data that has been explicitly validated against the schemas provided in this document, but such behavior is OPTIONAL. Clients are advised not to rely on the ability to send data that does not conform to the schemas, and SHOULD ignore any non-conformant elements or attributes on the incoming XML stream.

根据[XML]第2.8节中提供的“有效”定义,服务器不负责确保交付到连接的客户端或路由到对等服务器的XML数据有效。实现可以选择只接受或发送已根据本文档中提供的模式显式验证的数据,但这种行为是可选的。建议客户机不要依赖于发送不符合模式的数据的能力,并且应该忽略传入XML流上的任何不一致的元素或属性。

Informational Note: The terms "valid" and "well-formed" are distinct in XML.

信息性说明:“有效”和“格式良好”这两个术语在XML中是不同的。

11.5. Inclusion of XML Declaration
11.5. 包含XML声明

Before sending a stream header, an implementation SHOULD send an XML declaration (matching the "XMLDecl" production from [XML]). Applications MUST follow the rules provided in [XML] regarding the format of the XML declaration and the circumstances under which the XML declaration is included.

在发送流头之前,实现应该发送一个XML声明(与[XML]中的“XMLDecl”产品相匹配)。应用程序必须遵循[XML]中提供的有关XML声明格式和包含XML声明的环境的规则。

Because external markup declarations are prohibited in XMPP (as described under Section 11.1), the standalone document declaration (matching the "SDDecl" production from [XML]) would have no meaning and therefore MUST NOT be included in an XML declaration sent over an XML stream. If an XMPP entity receives an XML declaration containing a standalone document declaration set to a value of "no", the entity MUST either ignore the standalone document declaration or close the stream with a stream error, which SHOULD be <restricted-xml/> (Section 4.9.3.18).

由于XMPP中禁止外部标记声明(如第11.1节所述),独立文档声明(与[XML]中的“SDDecl”产品相匹配)将没有任何意义,因此不得包含在通过XML流发送的XML声明中。如果XMPP实体接收到一个XML声明,其中包含一个设置为“否”的独立文档声明,则该实体必须忽略该独立文档声明,或者使用流错误关闭流,该错误应为<restricted XML/>(第4.9.3.18节)。

11.6. Character Encoding
11.6. 字符编码

Implementations MUST support the UTF-8 transformation of Universal Character Set [UCS2] characters, as needed for conformance with [CHARSETS] and as defined in [UTF-8]. Implementations MUST NOT attempt to use any other encoding. If one party to an XML stream detects that the other party has attempted to send XML data with an encoding other than UTF-8, it MUST close the stream with a stream error, which SHOULD be <unsupported-encoding/> (Section 4.9.3.22), although some existing implementations send <bad-format/> (Section 4.9.3.1) instead.

实现必须支持通用字符集[UCS2]字符的UTF-8转换,这是符合[Charset]的需要和[UTF-8]中定义的。实现不得尝试使用任何其他编码。如果XML流的一方检测到另一方试图使用UTF-8以外的编码发送XML数据,则它必须使用流错误关闭该流,该错误应为<unsupported encoding/>(第4.9.3.22节),尽管某些现有实现发送<bad format/>(第4.9.3.1节)。

Because it is mandatory for an XMPP implementation to support all and only the UTF-8 encoding and because UTF-8 always has the same byte order, an implementation MUST NOT send a byte order mark ("BOM") at

因为XMPP实现必须支持所有且仅支持UTF-8编码,而且UTF-8始终具有相同的字节顺序,所以实现不能在任何时候发送字节顺序标记(“BOM”)

the beginning of the data stream. If an entity receives the [UNICODE] character U+FEFF anywhere in an XML stream (including as the first character of the stream), it MUST interpret that character as a zero width no-break space, not as a byte order mark.

数据流的开始。如果实体在XML流中的任何位置(包括作为流的第一个字符)接收到[UNICODE]字符U+FEFF,它必须将该字符解释为零宽度无中断空格,而不是字节顺序标记。

11.7. Whitespace
11.7. 空白

Except where explicitly disallowed (e.g., during TLS negotiation (Section 5) and SASL negotiation (Section 6)), either entity MAY send whitespace as separators between XML stanzas or between any other first-level elements sent over the stream. One common use for sending such whitespace is explained under Section 4.4.

除非明确禁止(例如,在TLS协商(第5节)和SASL协商(第6节)期间),否则任何实体都可以在XML节之间或通过流发送的任何其他一级元素之间发送空白作为分隔符。第4.4节解释了发送此类空白的一种常见用法。

11.8. XML Versions
11.8. XML版本

XMPP is an application profile of XML 1.0. A future version of XMPP might be defined in terms of higher versions of XML, but this specification defines XMPP only in terms of XML 1.0.

XMPP是XML 1.0的应用程序配置文件。XMPP的未来版本可能根据更高版本的XML定义,但本规范仅根据XML1.0定义XMPP。

12. Internationalization Considerations
12. 国际化考虑

As specified under Section 11.6, XML streams MUST be encoded in UTF-8.

如第11.6节所述,XML流必须以UTF-8编码。

As specified under Section 4.7, an XML stream SHOULD include an 'xml: lang' attribute specifying the default language for any XML character data that is intended to be presented to a human user. As specified under Section 8.1.5, an XML stanza SHOULD include an 'xml:lang' attribute if the stanza contains XML character data that is intended to be presented to a human user. A server SHOULD apply the default 'xml:lang' attribute to stanzas it routes or delivers on behalf of connected entities, and MUST NOT modify or delete 'xml:lang' attributes on stanzas it receives from other entities.

如第4.7节所述,XML流应包含一个“XML:lang”属性,该属性指定任何XML字符数据的默认语言,该数据将呈现给人类用户。如第8.1.5节所述,如果XML节包含拟呈现给人类用户的XML字符数据,则XML节应包含“XML:lang”属性。服务器应将默认的“xml:lang”属性应用于代表连接实体路由或传递的节,并且不得修改或删除从其他实体接收的节上的“xml:lang”属性。

Internationalization of XMPP addresses is specified in [XMPP-ADDR].

XMPP地址的国际化在[XMPP-ADDR]中指定。

13. Security Considerations
13. 安全考虑
13.1. Fundamentals
13.1. 基本原理

XMPP technologies are typically deployed using a decentralized client-server architecture. As a result, several paths are possible when two XMPP entities need to communicate:

XMPP技术通常使用分散的客户机-服务器体系结构进行部署。因此,当两个XMPP实体需要通信时,有几种路径是可能的:

1. Both entities are servers. In this case, the entities can establish a direct server-to-server stream between themselves.

1. 这两个实体都是服务器。在这种情况下,实体可以在它们之间建立直接的服务器到服务器的流。

2. One entity is a server and the other entity is a client whose account is hosted on that server. In this case, the entities can establish a direct client-to-server stream between themselves.

2. 一个实体是服务器,另一个实体是客户机,其帐户托管在该服务器上。在这种情况下,实体可以在它们之间建立直接的客户端到服务器的流。

3. Both entities are clients whose accounts are hosted on the same server. In this case, the entities cannot establish a direct stream between themselves, but there is only one intermediate entity between them, whose policies they might understand and in which they might have some level of trust (e.g., the server might require the use of Transport Layer Security for all client connections).

3. 这两个实体都是客户机,其帐户托管在同一台服务器上。在这种情况下,实体无法在它们之间建立直接流,但它们之间只有一个中间实体,它们可能了解其策略,并且在其中它们可能具有某种程度的信任(例如,服务器可能要求对所有客户端连接使用传输层安全性)。

4. Both entities are clients but their accounts are hosted on different servers. In this case, the entities cannot establish a direct stream between themselves and there are two intermediate entities between them; each client might have some trust in the server that hosts its account but might know nothing about the policies of the server to which the other client connects.

4. 这两个实体都是客户端,但它们的帐户托管在不同的服务器上。在这种情况下,实体之间不能建立直接流,并且它们之间有两个中间实体;每个客户机可能对托管其帐户的服务器有一定的信任,但可能对另一个客户机连接到的服务器的策略一无所知。

This specification covers only the security of a direct XML stream between two servers or between a client and a server (cases #1 and #2), where each stream can be considered a single "hop" along a communication path. The goal of security for a multi-hop path (cases #3 and #4), although very desirable, is out of scope for this specification.

本规范仅涵盖两台服务器之间或客户机与服务器之间的直接XML流的安全性(案例1和案例2),其中每个流可以被视为沿通信路径的单个“跃点”。多跳路径(情况3和情况4)的安全性目标虽然非常理想,但超出了本规范的范围。

In accordance with [SEC-GUIDE], this specification covers communication security (confidentiality, data integrity, and peer entity authentication), non-repudiation, and systems security (unauthorized usage, inappropriate usage, and denial of service). We also discuss common security issues such as information leaks, firewalls, and directory harvesting, as well as best practices related to the reuse of technologies such as base 64, DNS, cryptographic hash functions, SASL, TLS, UTF-8, and XML.

根据[SEC-GUIDE],本规范涵盖通信安全性(保密性、数据完整性和对等实体认证)、不可否认性和系统安全性(未经授权使用、不当使用和拒绝服务)。我们还讨论了常见的安全问题,如信息泄漏、防火墙和目录捕获,以及与重用技术(如base 64、DNS、加密哈希函数、SASL、TLS、UTF-8和XML)相关的最佳实践。

13.2. Threat Model
13.2. 威胁模型

The threat model for XMPP is in essence the standard "Internet Threat Model" described in [SEC-GUIDE]. Attackers are assumed to be interested in and capable of launching the following attacks against unprotected XMPP systems:

XMPP的威胁模型本质上是[SEC-GUIDE]中描述的标准“互联网威胁模型”。假定攻击者感兴趣并能够对未受保护的XMPP系统发起以下攻击:

o Eavesdropping

o 窃听

o Sniffing passwords

o 嗅探密码

o Breaking passwords through dictionary attacks

o 通过字典攻击破坏密码

o Discovering usernames through directory harvesting attacks

o 通过目录捕获攻击发现用户名

o Replaying, inserting, deleting, or modifying stanzas

o 重放、插入、删除或修改节

o Spoofing users

o 欺骗用户

o Gaining unauthorized entry to a server or account

o 未经授权进入服务器或帐户

o Using a server or account inappropriately

o 不适当地使用服务器或帐户

o Denying service to other entities

o 拒绝向其他实体提供服务

o Subverting communication streams through man-in-the-middle attacks

o 通过中间人攻击颠覆通信流

o Gaining control over on-path servers

o 获得对路径服务器的控制

Where appropriate, the following sections describe methods for protecting against these threats.

在适当的情况下,以下各节描述了防范这些威胁的方法。

13.3. Order of Layers
13.3. 层次顺序

The order of layers in which protocols MUST be stacked is as follows:

协议必须堆叠的层顺序如下:

1. TCP

1. 传输控制协议

2. TLS

2. TLS

3. SASL

3. 萨斯勒

4. XMPP

4. XMPP

This order has important security implications, as described throughout these security considerations.

正如在这些安全注意事项中所述,此顺序具有重要的安全含义。

Within XMPP, XML stanzas are further ordered on top of XML streams, as described under Section 4.

在XMPP中,XML节在XML流之上进一步排序,如第4节所述。

13.4. Confidentiality and Integrity
13.4. 机密性和完整性

The use of Transport Layer Security (TLS) with appropriate ciphersuites provides a reliable mechanism to ensure the confidentiality and integrity of data exchanged between a client and a server or between two servers. Therefore, TLS can help to protect against eavesdropping, password sniffing, man-in-the-middle attacks, and stanza replays, insertion, deletion, and modification over an XML stream. XMPP clients and servers MUST support TLS as defined under Section 5.

使用传输层安全性(TLS)和适当的密码套件提供了一种可靠的机制,以确保客户机和服务器之间或两台服务器之间交换的数据的机密性和完整性。因此,TLS有助于防止偷听、密码嗅探、中间人攻击以及XML流上的节重放、插入、删除和修改。XMPP客户端和服务器必须支持第5节中定义的TLS。

Informational Note: The confidentiality and integrity of a stream can be protected by methods other than TLS, e.g., by means of a SASL mechanism that involves negotiation of a security layer.

信息性说明:流的机密性和完整性可以通过TLS以外的方法进行保护,例如,通过涉及安全层协商的SASL机制。

Security Warning: The use of TLS in XMPP applies to a single stream. Because XMPP is typically deployed using a distributed client-server architecture (as explained under Section 2.5), a stanza might traverse multiple streams, and not all of those streams might be TLS-protected. For example, a stanza sent from a client with a session at one server (e.g., <romeo@example.net/orchard>) and intended for delivery to a client with a session at another server (e.g., <juliet@example.com/balcony>) will traverse three streams: (1) the stream from the sender's client to its server, (2) the stream from the sender's server to the recipient's server, and (3) the stream from the recipient's server to the recipient's client. Furthermore, the stanza will be processed as cleartext within the sender's server and the recipient's server. Therefore, even if the stream from the sender's client to its server is protected, the confidentiality and integrity of a stanza sent over that protected stream cannot be guaranteed when the stanza is processed by the sender's server, sent from the sender's server to the recipient's server, processed by the recipient's server, or sent from the recipient's server to the recipient's client. Only a robust technology for end-to-end encryption could ensure the confidentiality and integrity of a stanza as it traverses all of the "hops" along a communication path (e.g., a technology that meets the requirements defined in [E2E-REQS]). Unfortunately, the XMPP community has so far failed to produce an end-to-end encryption technology that might be suitable for widespread implementation and deployment, and definition of such a technology is out of scope for this document.

安全警告:在XMPP中使用TLS适用于单个流。由于XMPP通常使用分布式客户机-服务器体系结构(如第2.5节所述)进行部署,因此一节可能会遍历多个流,并且并非所有这些流都受TLS保护。例如,在一台服务器上通过会话从客户端发送的节(例如<romeo@example.net/orchard>),并打算通过另一台服务器(例如<juliet@example.com/)将遍历三个流:(1)从发送方客户端到其服务器的流,(2)从发送方服务器到接收方服务器的流,以及(3)从接收方服务器到接收方客户端的流。此外,该节将作为明文在发送方服务器和接收方服务器中进行处理。因此,即使从发送者的客户端到其服务器的流受到保护,当节由发送者的服务器处理、从发送者的服务器发送到接收方的服务器、由接收方的服务器处理时,通过该受保护流发送的节的机密性和完整性也无法得到保证,或从收件人的服务器发送到收件人的客户端。只有用于端到端加密的稳健技术才能确保一节沿着通信路径(例如,满足[E2E-REQS]中定义的要求的技术)穿越所有“跃点”时的机密性和完整性。不幸的是,XMPP社区到目前为止还未能产生一种可能适合广泛实施和部署的端到端加密技术,而这种技术的定义超出了本文档的范围。

13.5. Peer Entity Authentication
13.5. 对等实体认证

The use of the Simple Authentication and Security Layer (SASL) for authentication provides a reliable mechanism for peer entity authentication. Therefore, SASL helps to protect against user spoofing, unauthorized usage, and man-in-the middle attacks. XMPP clients and servers MUST support SASL as defined under Section 6.

使用简单身份验证和安全层(SASL)进行身份验证为对等实体身份验证提供了可靠的机制。因此,SASL有助于防止用户欺骗、未经授权的使用和中间人攻击。XMPP客户端和服务器必须支持第6节中定义的SASL。

13.6. Strong Security
13.6. 强安全性

[STRONGSEC] defines "strong security" and its importance to communication over the Internet. For the purpose of XMPP communication over client-to-server and server-to-server streams, the term "strong security" refers to the use of security technologies

[STRONGSEC]定义了“强安全性”及其对互联网通信的重要性。为了通过客户端到服务器和服务器到服务器流进行XMPP通信,术语“强安全性”指的是安全技术的使用

that provide both mutual authentication and integrity checking (e.g., a combination of TLS encryption and SASL authentication using appropriate SASL mechanisms).

提供相互身份验证和完整性检查(例如,使用适当的SASL机制结合TLS加密和SASL身份验证)。

Implementations MUST support strong security. Service provisioning SHOULD use strong security.

实现必须支持强大的安全性。服务供应应使用强安全性。

An implementation SHOULD make it possible for an end user or service administrator to provision a deployment with specific trust anchors for the certificate presented by a connecting entity (either client or server); when an application is thus provisioned, it MUST NOT use a generic PKI trust store to authenticate the connecting entity. More detailed rules and guidelines regarding certificate validation are provided in the next section.

实现应使最终用户或服务管理员能够为连接实体(客户端或服务器)提供的证书提供具有特定信任锚的部署;当应用程序被这样配置时,它不能使用通用PKI信任存储对连接实体进行身份验证。下一节将提供有关证书验证的更详细规则和指南。

The initial stream and the response stream MUST be secured separately, although security in both directions MAY be established via mechanisms that provide mutual authentication.

尽管可以通过提供相互认证的机制来建立两个方向上的安全性,但初始流和响应流必须分别受到保护。

13.7. Certificates
13.7. 证书

Channel encryption of an XML stream using Transport Layer Security as described under Section 5, and in some cases also authentication as described under Section 6, is commonly based on a PKIX certificate presented by the receiving entity (or, in the case of mutual certificate authentication, both the receiving entity and the initiating entity). This section describes best practices regarding the generation of PKIX certificates to be presented by XMPP entities and the verification of PKIX certificates presented by XMPP entities.

使用第5节所述的传输层安全性对XML流进行通道加密,在某些情况下,还包括第6节所述的身份验证,通常基于接收实体(或者,在相互证书身份验证的情况下,接收实体和发起实体)提供的PKIX证书。本节介绍有关生成由XMPP实体提供的PKIX证书以及验证由XMPP实体提供的PKIX证书的最佳实践。

In general, the following sections rely on and extend the rules and guidelines provided in the [PKIX] profile of [X509], and in [TLS-CERTS]. The reader is referred to those specifications for a detailed understanding of PKIX certificates and their use in TLS.

一般而言,以下章节依赖并扩展了[X509]的[PKIX]概要文件和[TLS-CERTS]中提供的规则和指南。读者可以参考这些规范,以详细了解PKIX证书及其在TLS中的使用。

13.7.1. Certificate Generation
13.7.1. 证书生成
13.7.1.1. General Considerations
13.7.1.1. 一般考虑

The following rules apply to end entity public key certificates that are issued to XMPP servers or clients:

以下规则适用于颁发给XMPP服务器或客户端的终端实体公钥证书:

1. The certificate MUST conform to [PKIX].

1. 证书必须符合[PKIX]。

2. The certificate MUST NOT contain a basicConstraints extension with the cA boolean set to TRUE.

2. 证书不能包含cA布尔值设置为TRUE的basicConstraints扩展。

3. The subject field MUST NOT be null.

3. “主题”字段不能为空。

4. The signatureAlgorithm SHOULD be the PKCS #1 version 1.5 signature algorithm with SHA-256 as defined by [PKIX-ALGO], or a stronger algorithm if available.

4. 签名算法应该是PKCS#1版本1.5签名算法,带有[PKIX-ALGO]定义的SHA-256,或者更强大的算法(如果可用)。

5. The certificate SHOULD include an Authority Information Access (AIA) extension that specifies the address of an Online Certificate Status Protocol [OCSP] responder (if not, a relying party would need to fall back on the use of Certificate Revocation Lists (CRLs) as described in [PKIX]).

5. 证书应包括一个授权信息访问(AIA)扩展,该扩展指定在线证书状态协议[OCSP]响应者的地址(如果不是,依赖方将需要使用[PKIX]中所述的证书撤销列表(CRL))。

The following rules apply to certification authority (CA) certificates that are used by issuers of XMPP end entity certificates:

以下规则适用于XMPP终端实体证书颁发者使用的证书颁发机构(CA)证书:

1. The certificate MUST conform to [PKIX].

1. 证书必须符合[PKIX]。

2. The certificate MUST contain a keyUsage extension with the digitalSignature bit set.

2. 证书必须包含设置了digitalSignature位的keyUsage扩展。

3. The subject field MUST NOT be null.

3. “主题”字段不能为空。

4. The signatureAlgorithm SHOULD be the PKCS #1 version 1.5 signature algorithm with SHA-256 as defined by [PKIX-ALGO], or a stronger algorithm if available.

4. 签名算法应该是PKCS#1版本1.5签名算法,带有[PKIX-ALGO]定义的SHA-256,或者更强大的算法(如果可用)。

5. For issuers of public key certificates, the issuer's certificate MUST contain a basicConstraints extension with the cA boolean set to TRUE.

5. 对于公钥证书的颁发者,颁发者的证书必须包含cA布尔值设置为TRUE的basicConstraints扩展。

13.7.1.2. Server Certificates
13.7.1.2. 服务器证书
13.7.1.2.1. Rules
13.7.1.2.1. 规则

In a PKIX certificate to be presented by an XMPP server (i.e., a "server certificate"), the certificate SHOULD include one or more XMPP addresses (i.e., domainparts) associated with XMPP services hosted at the server. The rules and guidelines defined in [TLS-CERTS] apply to XMPP server certificates, with the following XMPP-specific considerations:

在由XMPP服务器提供的PKIX证书(即“服务器证书”)中,该证书应包括一个或多个与服务器上托管的XMPP服务相关联的XMPP地址(即domainparts)。[TLS-CERTS]中定义的规则和指导原则适用于XMPP服务器证书,具体考虑如下XMPP:

o Support for the DNS-ID identifier type [PKIX] is REQUIRED in XMPP client and server software implementations. Certification authorities that issue XMPP-specific certificates MUST support the DNS-ID identifier type. XMPP service providers SHOULD include the DNS-ID identifier type in certificate requests.

o XMPP客户端和服务器软件实现中需要支持DNS-ID标识符类型[PKIX]。颁发XMPP特定证书的证书颁发机构必须支持DNS-ID标识符类型。XMPP服务提供商应在证书请求中包含DNS-ID标识符类型。

o Support for the SRV-ID identifier type [PKIX-SRV] is REQUIRED for XMPP client and server software implementations (for verification purposes XMPP client implementations need to support only the "_xmpp-client" service type, whereas XMPP server implementations need to support both the "_xmpp-client" and "_xmpp-server" service types). Certification authorities that issue XMPP-specific certificates SHOULD support the SRV-ID identifier type. XMPP service providers SHOULD include the SRV-ID identifier type in certificate requests.

o XMPP客户端和服务器软件实现需要支持SRV-ID标识符类型[PKIX-SRV](出于验证目的,XMPP客户端实现只需要支持“\u XMPP-client”服务类型,而XMPP服务器实现需要同时支持“\u XMPP-client”和“\u XMPP-server”服务类型)。颁发XMPP特定证书的证书颁发机构应支持SRV-ID标识符类型。XMPP服务提供者应该在证书请求中包含SRV-ID标识符类型。

o Support for the XmppAddr identifier type (specified under Section 13.7.1.4) is encouraged in XMPP client and server software implementations for the sake of backward-compatibility, but is no longer encouraged in certificates issued by certification authorities or requested by XMPP service providers.

o 为了向后兼容,XMPP客户端和服务器软件实现中鼓励支持XmppAddr标识符类型(在第13.7.1.4节中指定),但认证机构颁发的证书或XMPP服务提供商请求的证书中不再鼓励支持XmppAddr标识符类型。

o DNS domain names in server certificates MAY contain the wildcard character '*' as the complete left-most label within the identifier.

o 服务器证书中的DNS域名可能包含通配符“*”作为标识符中最左侧的完整标签。

13.7.1.2.2. Examples
13.7.1.2.2. 例子

For our first (relatively simple) example, consider a company called "Example Products, Inc." It hosts an XMPP service at "im.example.com" (i.e., user addresses at the service are of the form "user@im.example.com"), and SRV lookups for the xmpp-client and xmpp-server services at "im.example.com" yield one machine, called "x.example.com", as follows:

对于我们的第一个(相对简单的)示例,考虑一个名为“示例产品公司”的公司,它在“IM .Simult.com”上托管XMPP服务(即,服务的用户地址是形式的)。user@im.example.com)和SRV在“im.example.com”上查找xmpp客户机和xmpp服务器服务,得到一台名为“x.example.com”的机器,详情如下:

_xmpp-client._tcp.im.example.com. 400 IN SRV 20 0 5222 x.example.com _xmpp-server._tcp.im.example.com. 400 IN SRV 20 0 5269 x.example.com

_xmpp客户端。\u tcp.im.example.com。400在SRV 20 0 5222 x.example.com_xmpp-server._tcp.im.example.com中。SRV 20 0 5269 x.example.com中的400

The certificate presented by x.example.com contains the following representations:

x.example.com提供的证书包含以下声明:

o An otherName type of SRVName (id-on-dnsSRV) containing an IA5String (ASCII) string of "_xmpp-client.im.example.com"

o 一种其他名称类型的SRVName(dnsSRV上的id),包含IA5String(ASCII)字符串“_xmpp-client.im.example.com”

o An otherName type of SRVName (id-on-dnsSRV) containing an IA5String (ASCII) string of "_xmpp-server.im.example.com"

o 一种其他名称类型的SRVName(dnsSRV上的id),包含IA5String(ASCII)字符串“_xmpp-server.im.example.com”

o A dNSName containing an ASCII string of "im.example.com"

o 包含ASCII字符串“im.example.com”的dNSName

o An otherName type of XmppAddr (id-on-xmppAddr) containing a UTF-8 string of "im.example.com"

o XmppAddr的其他名称类型(XmppAddr上的id),包含UTF-8字符串“im.example.com”

o A CN containing an ASCII string of "Example Products, Inc."

o 包含ASCII字符串“Example Products,Inc.”的CN

For our second (more complex) example, consider an ISP called "Example Internet Services". It hosts an XMPP service at "example.net" (i.e., user addresses at the service are of the form "user@example.net"), but SRV lookups for the xmpp-client and xmpp-server services at "example.net" yield two machines ("x1.example.net" and "x2.example.net"), as follows:

对于我们的第二个(更复杂的)例子,考虑一个称为“示例Internet服务”的ISP。它在“example.net”上托管一个XMPP服务(即,服务上的用户地址的格式为“user@example.net),但在“example.net”上对xmpp客户机和xmpp服务器服务的SRV查找会产生两台机器(“x1.example.net”和“x2.example.net”),如下所示:

_xmpp-client._tcp.example.net. 68400 IN SRV 20 0 5222 x1.example.net. _xmpp-client._tcp.example.net. 68400 IN SRV 20 0 5222 x2.example.net. _xmpp-server._tcp.example.net. 68400 IN SRV 20 0 5269 x1.example.net. _xmpp-server._tcp.example.net. 68400 IN SRV 20 0 5269 x2.example.net.

_xmpp客户端。\u tcp.example.net。SRV 20 0 5222 x1.example.net中的68400_xmpp客户端。\u tcp.example.net。SRV 20 0 5222 x2.example.net中的68400_xmpp服务器。_tcp.example.net。SRV 20 0 5269 x1.example.net中的68400_xmpp服务器。_tcp.example.net。SRV 20 0 5269 x2.example.net中的68400。

Example Internet Services also hosts chatrooms at chat.example.net, and provides an xmpp-server SRV record for that service as well (thus enabling entities from remote domains to access that service). It also might provide other such services in the future, so it wishes to represent a wildcard in its certificate to handle such growth.

示例Internet服务还在chat.Example.net上托管聊天室,并为该服务提供xmpp服务器SRV记录(从而使远程域的实体能够访问该服务)。它将来还可能提供其他此类服务,因此它希望在其证书中表示一个通配符来处理这种增长。

The certificate presented by either x1.example.net or x2.example.net contains the following representations:

由x1.example.net或x2.example.net提供的证书包含以下表示形式:

o An otherName type of SRVName (id-on-dnsSRV) containing an IA5String (ASCII) string of "_xmpp-client.example.net"

o 一种其他名称类型的SRVName(dnsSRV上的id),包含IA5String(ASCII)字符串“_xmpp-client.example.net”

o An otherName type of SRVName (id-on-dnsSRV) containing an IA5String (ASCII) string of "_xmpp-server.example.net"

o 一种其他名称类型的SRVName(dnsSRV上的id),包含IA5String(ASCII)字符串“\u xmpp-server.example.net”

o An otherName type of SRVName (id-on-dnsSRV) containing an IA5String (ASCII) string of "_xmpp-server.chat.example.net"

o 一种其他名称类型的SRVName(dnsSRV上的id),包含IA5String(ASCII)字符串“_xmpp-server.chat.example.net”

o A dNSName containing an ASCII string of "example.net"

o 包含ASCII字符串“example.net”的dNSName

o A dNSName containing an ASCII string of "*.example.net"

o 包含“*.example.net”ASCII字符串的dNSName

o An otherName type of XmppAddr (id-on-xmppAddr) containing a UTF-8 string of "example.net"

o XmppAddr的其他名称类型(XmppAddr上的id),包含UTF-8字符串“example.net”

o An otherName type of XmppAddr (id-on-xmppAddr) containing a UTF-8 string of "chat.example.net"

o XmppAddr的其他名称类型(XmppAddr上的id),包含UTF-8字符串“chat.example.net”

o A CN containing an ASCII string of "Example Internet Services"

o 包含“示例Internet服务”ASCII字符串的CN

13.7.1.3. Client Certificates
13.7.1.3. 客户端证书

In a PKIX certificate to be presented by an XMPP client controlled by a human user (i.e., a "client certificate"), it is RECOMMENDED for the certificate to include one or more JIDs associated with an XMPP user. If included, a JID MUST be represented as an XmppAddr as specified under Section 13.7.1.4.

在由人工用户控制的XMPP客户机提供的PKIX证书(即“客户机证书”)中,建议该证书包括一个或多个与XMPP用户关联的JID。如果包括,JID必须按照第13.7.1.4节的规定表示为XmppAddr。

13.7.1.4. XmppAddr Identifier Type
13.7.1.4. XmppAddr标识符类型

The XmppAddr identifier type is a UTF8String within an otherName entity inside the subjectAltName, using the [ASN.1] Object Identifier "id-on-xmppAddr" specified below.

XmppAddr标识符类型是subjectAltName中otherName实体内的UTF8String,使用下面指定的[ASN.1]对象标识符“XmppAddr上的id”。

   id-pkix OBJECT IDENTIFIER ::= { iso(1) identified-organization(3)
           dod(6) internet(1) security(5) mechanisms(5) pkix(7) }
        
   id-pkix OBJECT IDENTIFIER ::= { iso(1) identified-organization(3)
           dod(6) internet(1) security(5) mechanisms(5) pkix(7) }
        
   id-on  OBJECT IDENTIFIER ::= { id-pkix 8 }  -- other name forms
        
   id-on  OBJECT IDENTIFIER ::= { id-pkix 8 }  -- other name forms
        
   id-on-xmppAddr  OBJECT IDENTIFIER ::= { id-on 5 }
        
   id-on-xmppAddr  OBJECT IDENTIFIER ::= { id-on 5 }
        
   XmppAddr ::= UTF8String
        
   XmppAddr ::= UTF8String
        

As an alternative to the "id-on-xmppAddr" notation, this Object Identifier MAY be represented in dotted display format (i.e., "1.3.6.1.5.5.7.8.5") or in the Uniform Resource Name notation specified in [URN-OID] (i.e., "urn:oid:1.3.6.1.5.5.7.8.5").

作为“xmppAddr上的id”表示法的替代方法,该对象标识符可以用点显示格式(即“1.3.6.1.5.5.7.8.5”)或[URN-OID]中指定的统一资源名称表示法(即“URN:OID:1.3.6.1.5.5.7.8.5”)。

Thus for example the JID <juliet@im.example.com> as included in a certificate could be formatted in any of the following three ways:

例如,JID<juliet@im.example.com>证书中包含的内容可以通过以下三种方式之一进行格式化:

   id-on-xmppAddr:
      subjectAltName=otherName:id-on-xmppAddr;UTF8:juliet@im.example.com
        
   id-on-xmppAddr:
      subjectAltName=otherName:id-on-xmppAddr;UTF8:juliet@im.example.com
        
   dotted display format:  subjectAltName=otherName:
      1.3.6.1.5.5.7.8.5;UTF8:juliet@im.example.com
        
   dotted display format:  subjectAltName=otherName:
      1.3.6.1.5.5.7.8.5;UTF8:juliet@im.example.com
        
   URN notation:  subjectAltName=otherName:urn:oid:
      1.3.6.1.5.5.7.8.5;UTF8:juliet@im.example.com
        
   URN notation:  subjectAltName=otherName:urn:oid:
      1.3.6.1.5.5.7.8.5;UTF8:juliet@im.example.com
        

Use of the "id-on-xmppAddr" format is RECOMMENDED in the generation of certificates, but all three formats MUST be supported for the purpose of certificate validation.

建议在生成证书时使用“xmppAddr上的id”格式,但为了进行证书验证,必须支持所有三种格式。

The "id-on-xmppAddr" object identifier MAY be used in conjunction with the extended key usage extension specified in Section 4.2.1.12 of [PKIX] in order to explicitly define and limit the intended use of a certificate to the XMPP network.

“xmppAddr上的id”对象标识符可与[PKIX]第4.2.1.12节规定的扩展密钥使用扩展一起使用,以明确定义并限制XMPP网络对证书的预期用途。

13.7.2. Certificate Validation
13.7.2. 证书验证

When an XMPP entity is presented with a server certificate or client certificate by a peer for the purpose of encryption or authentication of XML streams as described under Section 5 and Section 6, the entity MUST attempt to validate the certificate to determine if the certificate will be considered a "trusted certificate", i.e., a certificate that is acceptable for encryption and/or authentication in accordance with the XMPP entity's local service policies or configured settings.

如第5节和第6节所述,当对等方向XMPP实体提供服务器证书或客户端证书以加密或验证XML流时,该实体必须尝试验证该证书,以确定该证书是否被视为“可信证书”,即。,根据XMPP实体的本地服务策略或配置的设置,可接受加密和/或身份验证的证书。

For both server certificates and client certificates, the validating entity MUST do the following:

对于服务器证书和客户端证书,验证实体必须执行以下操作:

1. Attempt to verify the integrity of the certificate.

1. 尝试验证证书的完整性。

2. Attempt to verify that the certificate has been properly signed by the issuing Certificate Authority.

2. 尝试验证证书是否已由颁发证书的颁发机构正确签署。

3. Attempt to validate the full certification path.

3. 尝试验证完整的证书路径。

4. Check the rules for end entity public key certificates and certification authority certificates specified under Section 13.7.1.1 for the general case and under either Section 13.7.1.2 or Section 13.7.1.3 for XMPP server or client certificates, respectively.

4. 对于一般情况,检查第13.7.1.1节中规定的终端实体公钥证书和证书颁发机构证书的规则,对于XMPP服务器或客户端证书,分别检查第13.7.1.2节或第13.7.1.3节中规定的规则。

5. Check certificate revocation messages via Certificate Revocation Lists (CRLs), the Online Certificate Status Protocol [OCSP], or both.

5. 通过证书吊销列表(CRL)、联机证书状态协议[OCSP]或两者检查证书吊销消息。

If any of those validation attempts fail, the validating entity MUST unilaterally terminate the session.

如果任何验证尝试失败,验证实体必须单方面终止会话。

The following sections describe the additional identity verification rules that apply to server-to-server and client-to-server streams.

以下各节描述了应用于服务器到服务器和客户端到服务器流的其他身份验证规则。

Once the identity of the stream peer has been validated, the validating entity SHOULD also correlate the validated identity with the 'from' address (if any) of the stream header it received from the peer. If the two identities do not match, the validating entity SHOULD terminate the connection attempt (however, there might be good reasons why the identities do not match, as described under Section 4.7.1).

验证流对等方的标识后,验证实体还应将验证的标识与从对等方接收的流头的“发件人”地址(如果有)关联。如果两个标识不匹配,验证实体应终止连接尝试(但是,可能存在标识不匹配的充分原因,如第4.7.1节所述)。

13.7.2.1. Server Certificates
13.7.2.1. 服务器证书

For server certificates, the rules and guidelines defined in [TLS-CERTS] apply, with the proviso that the XmppAddr identifier specified under Section 13.7.1.4 is allowed as a reference identifier.

对于服务器证书,[TLS-CERTS]中定义的规则和指南适用,但有一个条件,即允许第13.7.1.4节中指定的XmppAddr标识符作为参考标识符。

The identities to be checked are set as follows:

要检查的标识设置如下:

o The initiating entity sets the source domain of its reference identifiers to the 'to' address it communicates in the initial stream header; i.e., this is the identity it expects the receiving entity to provide in a PKIX certificate.

o 发起实体将其参考标识符的源域设置为其在初始流报头中通信的“to”地址;i、 例如,这是它期望接收实体在PKIX证书中提供的标识。

o The receiving entity sets the source domain of its reference identifiers to the 'from' address communicated by the initiating entity in the initial stream header; i.e., this is the identity that the initiating entity is trying to assert.

o 接收实体将其参考标识符的源域设置为初始流报头中发起实体通信的“发件人”地址;i、 例如,这是发起实体试图声明的身份。

In the case of server-to-server communication, the matching procedure described in [TLS-CERTS] can be performed by an application server (receiving entity) when verifying an incoming server-to-server connection from a peer server (initiating entity). In this case, the receiving entity verifies the identity of the initiating entity and uses as the source domain of its reference identifiers the DNS domain name asserted by the initiating entity in the 'from' attribute of the initial stream header. However, the matching procedure described in [TLS-CERTS] remains unchanged and is applied in the same way.

在服务器到服务器通信的情况下,[TLS-CERTS]中描述的匹配过程可由应用服务器(接收实体)在验证来自对等服务器(发起实体)的传入服务器到服务器连接时执行。在这种情况下,接收实体验证发起实体的身份,并将发起实体在初始流头的“from”属性中声明的DNS域名用作其参考标识符的源域。然而,[TLS-CERTS]中描述的匹配程序保持不变,并以相同的方式应用。

13.7.2.2. Client Certificates
13.7.2.2. 客户端证书

When an XMPP server validates a certificate presented by a client, there are three possible cases, as discussed in the following sections.

当XMPP服务器验证客户机提供的证书时,有三种可能的情况,如下部分所述。

The identities to be checked are set as follows:

要检查的标识设置如下:

o The client sets the source domain of its reference identifiers to the 'to' address it communicates in the initial stream header; i.e., this is the identity it expects the server to provide in a PKIX certificate.

o 客户端将其引用标识符的源域设置为其在初始流报头中通信的“to”地址;i、 例如,这是它希望服务器在PKIX证书中提供的标识。

o The server sets the bare JID of its reference identifiers to the 'from' address communicated by the initiating entity in the initial stream header; i.e., this is the identity that the client is trying to assert.

o 服务器将其参考标识符的裸JID设置为初始流报头中发起实体通信的“发件人”地址;i、 例如,这是客户机试图声明的身份。

13.7.2.2.1. Case #1
13.7.2.2.1. 案例1

If the client certificate appears to be certified by a certification path terminating in a trust anchor (as described in Section 6.1 of [PKIX]), the server MUST check the certificate for any instances of the XmppAddr as described under Section 13.7.1.4. There are three possible sub-cases:

如果客户端证书似乎是由终止于信任锚点的认证路径认证的(如[PKIX]第6.1节所述),则服务器必须按照第13.7.1.4节所述检查证书中是否存在XmppAddr的任何实例。有三种可能的子情况:

Sub-Case #1: The server finds one XmppAddr for which the domainpart of the represented JID matches one of the configured FQDNs of the server; the server SHOULD use this represented JID as the validated identity of the client.

子案例#1:服务器找到一个XmppAddr,表示的JID的domainpart与服务器的一个已配置FQDN匹配;服务器应使用此表示的JID作为客户端的验证标识。

Sub-Case #2: The server finds more than one XmppAddr for which the domainpart of the represented JID matches one of the configured FQDNs of the server; the server SHOULD use one of these represented JIDs as the validated identity of the client, choosing among them based on the bare JID contained in the 'from' address of the initial stream header (if any), based on the domainpart contained in the 'to' address of the initial stream header, or in accordance with local service policies (such as a lookup in a user database based on other information contained in the client certificate).

子案例#2:服务器找到多个XmppAddr,其中表示的JID的domainpart与服务器的一个已配置FQDN匹配;服务器应使用其中一个表示的JID作为客户机的验证身份,根据初始流头的“from”地址中包含的裸JID(如果有)、初始流头的“to”地址中包含的domainpart或根据本地服务策略进行选择(例如,基于客户端证书中包含的其他信息在用户数据库中进行查找)。

Sub-Case #3: The server finds no XmppAddrs, or finds at least one XmppAddr but the domainpart of the represented JID does not match one of the configured FQDNs of the server; the server MUST NOT use the represented JID (if any) as the validated identity of the client but instead MUST validate the identity of the client using other means in accordance with local service policies (such as a lookup in a user database based on other information contained in the client certificate). If the identity cannot be so validated, the server MAY abort the validation process and terminate the TLS negotiation.

子案例#3:服务器未找到XmppAddr,或至少找到一个XmppAddr,但所表示JID的domainpart与服务器的一个已配置FQDN不匹配;服务器不得使用所表示的JID(如果有)作为客户端的验证身份,而是必须根据本地服务策略(例如基于客户端证书中包含的其他信息在用户数据库中查找)使用其他方式验证客户端的身份。如果无法验证身份,服务器可能会中止验证过程并终止TLS协商。

13.7.2.2.2. Case #2
13.7.2.2.2. 案例2

If the client certificate is certified by a Certificate Authority not known to the server, the server MUST proceed as under Case #1, Sub-Case #3.

如果客户端证书由服务器不知道的证书颁发机构认证,则服务器必须按照案例1,子案例3进行操作。

13.7.2.2.3. Case #3
13.7.2.2.3. 案例3

If the client certificate is self-signed, the server MUST proceed as under Case #1, Sub-Case #3.

如果客户机证书是自签名的,则服务器必须按照案例1,子案例3进行操作。

13.7.2.3. Checking of Certificates in Long-Lived Streams
13.7.2.3. 在长寿命流中检查证书

Because XMPP uses long-lived XML streams, it is possible that a certificate presented during stream negotiation might expire or be revoked while the stream is still live (this is especially relevant in the context of server-to-server streams). Therefore, each party to a long-lived stream SHOULD:

因为XMPP使用长寿命的XML流,所以流协商期间提供的证书可能会在流仍然有效时过期或被吊销(这在服务器到服务器流的上下文中尤其相关)。因此,长寿流的各方应:

1. Cache the expiration date of the certificate presented by the other party and any certificates on which that certificate depends (such as a root or intermediate certificate for a certification authority), and close the stream when any such certificate expires, with a stream error of <reset/> (Section 4.9.3.16).

1. 缓存由另一方提供的证书的过期日期以及该证书所依赖的任何证书(如证书颁发机构的根证书或中间证书),并在任何此类证书过期时关闭流,流错误为<reset/>(第4.9.3.16节)。

2. Periodically query the Online Certificate Status Protocol [OCSP] responder listed in the Authority Information Access (AIA) extension of the certificate presented by the other party and any certificates on which that certificate depends (such as a root or intermediate certificate for a certification authority), and close the stream if any such certificate has been revoked, with a stream error of <reset/> (Section 4.9.3.16). It is RECOMMENDED to query the OSCP responder at or near the time communicated via the nextUpdate field received in the OCSP response or, if the nextUpdate field is not set, to query every 24 hours.

2. 定期查询另一方提交的证书的授权信息访问(AIA)扩展中列出的在线证书状态协议[OCSP]响应程序,以及该证书所依赖的任何证书(如证书颁发机构的根证书或中间证书),如果任何此类证书被撤销,则关闭流,流错误为<reset/>(第4.9.3.16节)。建议在通过OCSP响应中接收的nextUpdate字段进行通信的时间或附近查询OSCP响应者,或者,如果未设置nextUpdate字段,则每24小时查询一次。

After the stream is closed, the initiating entity from the closed stream will need to reconnect and the receiving entity will need to authenticate the initiating entity based on whatever certificate it presents during negotiation of the new stream.

在流关闭之后,来自关闭流的发起实体将需要重新连接,并且接收实体将需要基于其在新流协商期间呈现的任何证书来认证发起实体。

13.7.2.4. Use of Certificates in XMPP Extensions
13.7.2.4. 在XMPP扩展中使用证书

Certificates MAY be used in extensions to XMPP for the purpose of application-layer encryption or authentication above the level of XML streams (e.g., for end-to-end encryption). Such extensions will define their own certificate handling rules. At a minimum, such extensions are encouraged to remain consistent with the rules defined in this specification, specifying additional rules only when necessary.

证书可用于XMPP的扩展,用于XML流级别以上的应用层加密或身份验证(例如,用于端到端加密)。这些扩展将定义它们自己的证书处理规则。至少,鼓励此类扩展与本规范中定义的规则保持一致,仅在必要时指定附加规则。

13.8. Mandatory-to-Implement TLS and SASL Technologies
13.8. 强制实施TLS和SASL技术

The following TLS ciphersuites and SASL mechanisms are mandatory-to-implement (naturally, implementations MAY support other ciphersuites and mechanisms as well). For security considerations related to TLS ciphersuites, see Section 13.9.4 and [TLS]. For security

必须实现以下TLS密码套件和SASL机制(当然,实现也可能支持其他密码套件和机制)。有关TLS密码套件的安全注意事项,请参见第13.9.4节和[TLS]。为了安全

considerations related to SASL mechanisms, see Section 13.9.4, [SASL], and specifications for particular SASL mechanisms such as [SCRAM], [DIGEST-MD5], and [PLAIN].

与SASL机制相关的注意事项,请参见第13.9.4节[SASL],以及特定SASL机制的规范,如[紧急停堆]、[DIGEST-MD5]和[PLAIN]。

13.8.1. For Authentication Only
13.8.1. 仅用于身份验证

For authentication only, servers and clients MUST support the SASL Salted Challenge Response Authentication Mechanism [SCRAM] -- in particular, the SCRAM-SHA-1 and SCRAM-SHA-1-PLUS variants.

仅对于身份验证,服务器和客户端必须支持SASL Salted质询响应身份验证机制[SCRAM]——特别是SCRAM-SHA-1和SCRAM-SHA-1-PLUS变体。

Security Warning: Even though it is possible to complete authentication only without confidentiality, it is RECOMMENDED for servers and clients to protect the stream with TLS before attempting authentication with SASL, both to help protect the information exchanged during SASL negotiation and to help prevent certain downgrade attacks as described under Section 13.9.4 and Section 13.9.5. Even if TLS is used, implementations SHOULD also enforce channel binding as described under Section 13.9.4.

安全警告:尽管可以在不保密的情况下完成身份验证,但建议服务器和客户端在尝试使用SASL进行身份验证之前使用TLS保护流,既有助于保护SASL协商期间交换的信息,又有助于防止第13.9.4节和第13.9.5节所述的某些降级攻击。即使使用TLS,实现也应按照第13.9.4节所述强制通道绑定。

Interoperability Note: The SCRAM-SHA-1 or SASL-SCRAM-SHA-1-PLUS variants of the SCRAM mechanism replace the SASL DIGEST-MD5 mechanism as XMPP's mandatory-to-implement password-based method for authentication only. For backward-compatibility with existing deployed infrastructure, implementations are encouraged to continue supporting the DIGEST-MD5 mechanism as specified in [DIGEST-MD5]; however, there are known interoperability issues with DIGEST-MD5 that make it impractical in the long term.

互操作性说明:紧急停堆机制的SCRAM-SHA-1或SASL-SCRAM-SHA-1-PLUS变体取代了SASL DIGEST-MD5机制,因为XMPP强制实施基于密码的认证方法。为了与现有部署的基础设施向后兼容,鼓励实现继续支持[DIGEST-MD5]中指定的DIGEST-MD5机制;然而,DIGEST-MD5存在已知的互操作性问题,这使得它在长期内不切实际。

13.8.2. For Confidentiality Only
13.8.2. 仅供保密

For confidentiality only, servers MUST support TLS with the TLS_RSA_WITH_AES_128_CBC_SHA ciphersuite.

仅出于保密目的,服务器必须支持TLS和TLS\U RSA\U和\U AES\U 128\U CBC\U SHA密码套件。

Security Warning: Because a connection with confidentiality only has weaker security properties than a connection with both confidentiality and authentication, it is RECOMMENDED for servers and clients to prefer connections with both qualities (e.g., by protecting the stream with TLS before attempting authentication with SASL). In practice, confidentiality only is employed merely for server-to-server connections when the peer server does not present a trusted certificate and the servers use Server Dialback [XEP-0220] for weak identity verification, but TLS with confidentiality only is still desirable to protect the connection against casual eavesdropping.

安全警告:由于具有机密性的连接的安全属性仅比同时具有机密性和身份验证的连接弱,因此建议服务器和客户端选择具有这两种质量的连接(例如,在尝试使用SASL进行身份验证之前使用TLS保护流)。在实践中,当对等服务器不提供可信证书且服务器使用服务器回拨[XEP-0220]进行弱身份验证时,仅对服务器到服务器的连接使用机密性,但仍需要仅具有机密性的TLS来保护连接免受偶然窃听。

13.8.3. For Confidentiality and Authentication with Passwords
13.8.3. 用于保密和使用密码进行身份验证

For both confidentiality and authentication with passwords, servers and clients MUST implement TLS with the TLS_RSA_WITH_AES_128_CBC_SHA ciphersuite plus SASL SCRAM, in particular the SCRAM-SHA-1 and SCRAM-SHA-1-PLUS variants (with SCRAM-SHA1-PLUS being preferred, as described under Section 13.9.4).

对于机密性和密码认证,服务器和客户端必须使用TLS_RSA_和_AES_128_CBC_SHA密码套件加SASL紧急停堆来实施TLS,特别是SCRAM-SHA-1和SCRAM-SHA-1-plus变体(如第13.9.4节所述,首选SCRAM-SHA1-plus)。

As further explained in the following Security Warning, in certain circumstances a server MAY offer TLS with the TLS_RSA_WITH_AES_128_CBC_SHA ciphersuite plus SASL PLAIN when it is not possible to offer more secure alternatives; in addition, clients SHOULD implement PLAIN over TLS in order to maximize interoperability with servers that are not able to deploy more secure alternatives.

如以下安全警告中进一步解释的,在某些情况下,当无法提供更安全的替代方案时,服务器可能会向TLS提供TLS_RSA_和_AES_128_CBC_SHA密码套件加SASL平原;此外,客户机应该实现纯TLS,以便最大限度地提高与无法部署更安全替代方案的服务器的互操作性。

Security Warning: In practice, many servers offer, and many clients use, TLS plus SASL PLAIN. The SCRAM-SHA-1 and especially SCRAM-SHA-1-PLUS variants of the SCRAM mechanism are strongly preferred over the PLAIN mechanism because of their superior security properties (including for SCRAM-SHA-1-PLUS the ability to enforce channel binding as described under Section 13.9.4). A client SHOULD treat TLS plus SASL PLAIN as a technology of last resort to be used only when interacting with a server that does not offer SCRAM (or other alternatives that are more secure than TLS plus SASL PLAIN), MUST prefer more secure mechanisms (e.g., EXTERNAL, SCRAM-SHA-1-PLUS, SCRAM-SHA-1, or the older DIGEST-MD5 mechanism) to the PLAIN mechanism, and MUST NOT use the PLAIN mechanism if the stream does not at a minimum have confidentiality and integrity protection via TLS with full certificate validation as described under Section 13.7.2.1. A server MUST NOT offer SASL PLAIN if the confidentiality and integrity of the stream are not protected via TLS or an equivalent security layer. A server SHOULD NOT offer TLS plus SASL PLAIN unless it is unable to offer some variant of SASL SCRAM (or other alternatives that are more secure than TLS plus SASL PLAIN), e.g., because the XMPP service depends for authentication purposes on a database or directory that is not under the control of the XMPP administrators, such as Pluggable Authentication Modules (PAM), an Lightweight Directory Access Protocol (LDAP) directory [LDAP], or an Authentication, Authorization, and Accounting (AAA) key management protocol (for guidance, refer to [AAA]). However, offering TLS plus SASL PLAIN even when the server supports more secure alternatives might be appropriate if the server needs to enable interoperability with an installed base of clients that do not yet support SCRAM or other alternatives that are more secure than TLS plus SASL PLAIN.

安全警告:在实践中,许多服务器提供TLS+SASL平原,许多客户端使用TLS+SASL平原。紧急停堆机制的紧急停堆-SHA-1,尤其是紧急停堆-SHA-1-PLUS变型,由于其优越的安全性能(包括紧急停堆-SHA-1-PLUS,以及第13.9.4节所述的强制通道绑定的能力),强烈优于普通机制。客户应将TLS+SASL平原视为最后手段,仅在与不提供紧急停堆(或比TLS+SASL平原更安全的其他替代方案)的服务器交互时使用,必须选择更安全的机制(例如,外部、紧急停堆-SHA-1-plus、紧急停堆-SHA-1或旧的DIGEST-MD5机制)如第13.7.2.1节所述,如果流至少没有通过TLS进行完整证书验证的机密性和完整性保护,则不得使用普通机制。如果流的机密性和完整性未通过TLS或等效安全层得到保护,则服务器不得提供SASL平原。服务器不应提供TLS+SASL平原,除非它无法提供SASL紧急停堆的某些变体(或比TLS+SASL平原更安全的其他替代方案),例如,因为XMPP服务出于身份验证目的依赖于不受XMPP管理员控制的数据库或目录,例如可插拔身份验证模块(PAM)、轻型目录访问协议(LDAP)目录[LDAP]或身份验证、授权和记帐(AAA)密钥管理协议(有关指导,请参阅[AAA])。但是,如果服务器需要与尚未支持紧急停堆的已安装客户机群或比TLS plus SASL平原更安全的其他备选方案实现互操作性,则即使服务器支持更安全的备选方案,也可以提供TLS plus SASL平原。

13.8.4. For Confidentiality and Authentication without Passwords
13.8.4. 无需密码即可进行保密和身份验证

For both confidentiality and authentication without passwords, servers MUST and clients SHOULD implement TLS with the TLS_RSA_WITH_AES_128_CBC_SHA ciphersuite plus the SASL EXTERNAL mechanism (see Appendix A of [SASL]) with PKIX certificates.

对于无密码的保密性和身份验证,服务器和客户端必须使用TLS_RSA___AES_128_CBC_SHA密码套件以及SASL外部机制(参见[SASL]的附录A)和PKIX证书来实现TLS。

13.9. Technology Reuse
13.9. 技术再利用
13.9.1. Use of Base 64 in SASL
13.9.1. 在SASL中使用Base 64

Both the client and the server MUST verify any base 64 data received during SASL negotiation (Section 6). An implementation MUST reject (not ignore) any characters that are not explicitly allowed by the base 64 alphabet; this helps to guard against creation of a covert channel that could be used to "leak" information.

客户端和服务器都必须验证SASL协商期间收到的任何base 64数据(第6节)。实现必须拒绝(而不是忽略)基本64字母表不明确允许的任何字符;这有助于防止创建可用于“泄漏”信息的隐蔽通道。

An implementation MUST NOT break on invalid input and MUST reject any sequence of base 64 characters containing the pad ('=') character if that character is included as something other than the last character of the data (e.g., "=AAA" or "BBBB=CCC"); this helps to guard against buffer overflow attacks and other attacks on the implementation.

实现不得在无效输入时中断,并且必须拒绝包含pad(“=”)字符的任何基64字符序列,如果该字符不是作为数据的最后一个字符(例如“=AAA”或“BBBB=CCC”)包含;这有助于防范缓冲区溢出攻击和对实现的其他攻击。

While base 64 encoding visually hides otherwise easily recognized information (such as passwords), it does not provide any computational confidentiality.

虽然Base64编码直观地隐藏了其他容易识别的信息(如密码),但它不提供任何计算机密性。

All uses of base 64 encoding MUST follow the definition in Section 4 of [BASE64] and padding bits MUST be set to zero.

BASE64编码的所有使用必须遵循[BASE64]第4节中的定义,并且填充位必须设置为零。

13.9.2. Use of DNS
13.9.2. DNS的使用

XMPP typically relies on the Domain Name System (specifically [DNS-SRV] records) to resolve a fully qualified domain name to an IP address before a client connects to a server or before a peer server connects to another server. Before attempting to negotiate an XML stream, the initiating entity MUST NOT proceed until it has resolved the DNS domain name of the receiving entity as specified under Section 3 (although it is not necessary to resolve the DNS domain name before each connection attempt, because DNS resolution results can be temporarily cached in accordance with time-to-live values). However, in the absence of a secure DNS option (e.g., as provided by [DNSSEC]), a malicious attacker with access to the DNS server data, or able to cause spoofed answers to be cached in a recursive resolver, can potentially cause the initiating entity to connect to any XMPP server chosen by the attacker. Deployment and validation of server certificates help to prevent such attacks.

XMPP通常依赖域名系统(特别是[DNS-SRV]记录)在客户端连接到服务器或对等服务器连接到另一服务器之前将完全限定的域名解析为IP地址。在尝试协商XML流之前,发起实体必须按照第3节的规定解析接收实体的DNS域名,才能继续(虽然在每次连接尝试之前不必解析DNS域名,因为DNS解析结果可以根据生存时间值临时缓存)。但是,在没有安全DNS选项的情况下(例如,由[DNSSEC]提供),具有DNS服务器数据访问权限的恶意攻击者,或能够在递归解析程序中缓存伪造答案的恶意攻击者,可能会导致发起实体连接到攻击者选择的任何XMPP服务器。服务器证书的部署和验证有助于防止此类攻击。

13.9.3. Use of Hash Functions
13.9.3. 哈希函数的使用

XMPP itself does not directly mandate the use of any particular cryptographic hash function. However, technologies on which XMPP depends (e.g., TLS and particular SASL mechanisms), as well as various XMPP extensions, might make use of cryptographic hash functions. Those who implement XMPP technologies or who develop XMPP extensions are advised to closely monitor the state of the art regarding attacks against cryptographic hash functions in Internet protocols as they relate to XMPP. For helpful guidance, refer to [HASHES].

XMPP本身并不直接强制使用任何特定的加密哈希函数。然而,XMPP所依赖的技术(例如TLS和特定SASL机制)以及各种XMPP扩展可能会使用加密哈希函数。建议那些实施XMPP技术或开发XMPP扩展的人密切关注针对互联网协议中加密哈希函数的攻击的最新技术,因为它们与XMPP有关。有关有用的指导,请参阅[哈希表]。

13.9.4. Use of SASL
13.9.4. SASL的使用

Because the initiating entity chooses an acceptable SASL mechanism from the list presented by the receiving entity, the initiating entity depends on the receiving entity's list for authentication. This dependency introduces the possibility of a downgrade attack if an attacker can gain control of the channel and therefore present a weak list of mechanisms. To mitigate this attack, the parties SHOULD protect the channel using TLS before attempting SASL negotiation and either perform full certificate validation as described under Section 13.7.2.1 or use a SASL mechanism that provides channel bindings, such as SCRAM-SHA-1-PLUS. (Protecting the channel via TLS with full certificate validation can help to ensure the confidentiality and integrity of the information exchanged during SASL negotiation.)

由于发起实体从接收实体提供的列表中选择可接受的SASL机制,发起实体依赖于接收实体的列表进行身份验证。如果攻击者能够获得通道控制权,因此提供的机制列表较弱,则此依赖性会引入降级攻击的可能性。为缓解此攻击,各方应在尝试SASL协商之前使用TLS保护通道,并按照第13.7.2.1节所述执行完整证书验证,或使用提供通道绑定的SASL机制,如SCRAM-SHA-1-PLUS。(通过TLS通过完整的证书验证保护通道有助于确保SASL协商期间交换的信息的机密性和完整性。)

The SASL framework itself does not provide a method for binding SASL authentication to a security layer providing confidentiality and integrity protection that was negotiated at a lower layer (e.g., TLS). Such a binding is known as a "channel binding" (see [CHANNEL]). Some SASL mechanisms provide channel bindings, which in the case of XMPP would typically be a binding to TLS (see [CHANNEL-TLS]). If a SASL mechanism provides a channel binding (e.g., this is true of [SCRAM]), then XMPP entities using that mechanism SHOULD prefer the channel binding variant (e.g., preferring "SCRAM-SHA-1-PLUS" over "SCRAM-SHA-1"). If a SASL mechanism does not provide a channel binding, then the mechanism cannot provide a way to verify that the source and destination end points to which the lower layer's security is bound are equivalent to the end points that SASL is authenticating; furthermore, if the end points are not identical, then the lower layer's security cannot be trusted to protect data transmitted between the SASL-authenticated entities. In such a situation, a SASL security layer SHOULD be negotiated that effectively ignores the presence of the lower-layer security.

SASL框架本身不提供将SASL身份验证绑定到安全层的方法,该安全层提供在较低层(例如TLS)协商的机密性和完整性保护。这种绑定称为“通道绑定”(参见[channel])。一些SASL机制提供通道绑定,在XMPP的情况下,通道绑定通常是与TLS的绑定(请参见[channel-TLS])。如果SASL机制提供通道绑定(例如[SCRAM]),则使用该机制的XMPP实体应首选通道绑定变体(例如,首选“SCRAM-SHA-1-PLUS”而非“SCRAM-SHA-1”)。如果SASL机制不提供通道绑定,则该机制无法提供验证低层安全性绑定到的源和目标端点是否等同于SASL正在验证的端点的方法;此外,如果端点不相同,则无法信任较低层的安全性来保护SASL认证实体之间传输的数据。在这种情况下,应协商SASL安全层,该层实际上忽略了较低安全层的存在。

Many deployed XMPP services authenticate client connections by means of passwords. It is well known that most human users choose relatively weak passwords. Although service provisioning is out of scope for this document, XMPP servers that allow password-based authentication SHOULD enforce minimal criteria for password strength to help prevent dictionary attacks. Because all password-based authentication mechanisms are susceptible to password guessing attacks, XMPP servers MUST limit the number of retries allowed during SASL authentication, as described under Section 6.4.5.

许多已部署的XMPP服务通过密码对客户端连接进行身份验证。众所周知,大多数人类用户选择相对较弱的密码。尽管服务配置不在本文档的范围内,但允许基于密码的身份验证的XMPP服务器应强制执行密码强度的最低标准,以帮助防止字典攻击。由于所有基于密码的身份验证机制都容易受到密码猜测攻击,因此XMPP服务器必须限制SASL身份验证期间允许的重试次数,如第6.4.5节所述。

Some SASL mechanisms (e.g., [ANONYMOUS]) do not provide strong peer entity authentication of the client to the server. Service administrators are advised to enable such mechanisms with caution. Best practices for the use of the SASL ANONYMOUS mechanism in XMPP are described in [XEP-0175].

某些SASL机制(例如,[ANONYMOUS])不向服务器提供客户端的强对等实体身份验证。建议服务管理员谨慎地启用此类机制。[XEP-0175]中描述了在XMPP中使用SASL匿名机制的最佳实践。

13.9.5. Use of TLS
13.9.5. TLS的使用

Implementations of TLS typically support multiple versions of the Transport Layer Security protocol as well as the older Secure Sockets Layer (SSL) protocol. Because of known security vulnerabilities, XMPP servers and clients MUST NOT request, offer, or use SSL 2.0. For further details, see Appendix E.2 of [TLS] along with [TLS-SSL2].

TLS的实现通常支持传输层安全协议的多个版本以及较旧的安全套接字层(SSL)协议。由于已知的安全漏洞,XMPP服务器和客户端不得请求、提供或使用SSL 2.0。有关更多详细信息,请参见[TLS]的附录E.2以及[TLS-SSL2]。

To prevent man-in-the-middle attacks, the TLS client (which might be an XMPP client or an XMPP server) MUST verify the certificate of the TLS server and MUST check its understanding of the server FQDN against the server's identity as presented in the TLS Certificate message as described under Section 13.7.2.1 (for further details, see [TLS-CERTS].

为了防止中间人攻击,TLS客户端(可能是XMPP客户端或XMPP服务器)必须验证TLS服务器的证书,并且必须根据第13.7.2.1节中描述的TLS证书消息中显示的服务器标识检查其对服务器FQDN的理解(有关更多详细信息,请参阅[TLS-CERTS])。

Support for TLS renegotiation is strictly OPTIONAL. However, implementations that support TLS renegotiation MUST implement and use the TLS Renegotiation Extension [TLS-NEG]. Further details are provided under Section 5.3.5.

对TLS重新协商的支持是严格可选的。但是,支持TLS重新协商的实现必须实现并使用TLS重新协商扩展[TLS-NEG]。更多详情见第5.3.5节。

13.9.6. Use of UTF-8
13.9.6. UTF-8的使用

The use of UTF-8 makes it possible to transport non-ASCII characters, and thus enables character "spoofing" scenarios, in which a displayed value appears to be something other than it is. Furthermore, there are known attack scenarios related to the decoding of UTF-8 data. On both of these points, refer to [UTF-8] for more information.

UTF-8的使用使传输非ASCII字符成为可能,从而支持字符“欺骗”场景,在这种场景中,显示的值似乎与实际值不同。此外,存在与UTF-8数据解码相关的已知攻击场景。关于这两点,请参阅[UTF-8]了解更多信息。

13.9.7. Use of XML
13.9.7. XML的使用

Because XMPP is an application profile of the Extensible Markup Language [XML], many of the security considerations described in [XML-MEDIA] and [XML-GUIDE] also apply to XMPP. Several aspects of XMPP mitigate the risks described there, such as the prohibitions specified under Section 11.1 and the lack of external references to style sheets or transformations, but these mitigating factors are by no means comprehensive.

由于XMPP是可扩展标记语言[XML]的应用程序配置文件,[XML-MEDIA]和[XML-GUIDE]中描述的许多安全注意事项也适用于XMPP。XMPP的几个方面缓解了此处所述的风险,如第11.1节中规定的禁止和缺少对样式表或转换的外部引用,但这些缓解因素绝不全面。

13.10. Information Leaks
13.10. 信息泄露
13.10.1. IP Addresses
13.10.1. IP地址

A client's IP address and method of access MUST NOT be made public by a server (e.g., as typically occurs in [IRC]).

服务器不得公开客户端的IP地址和访问方法(例如,[IRC]中通常出现的情况)。

13.10.2. Presence Information
13.10.2. 状态信息

One of the core aspects of XMPP is presence: information about the network availability of an XMPP entity (i.e., whether the entity is currently online or offline). A "presence leak" occurs when an entity's network availability is inadvertently and involuntarily revealed to a second entity that is not authorized to know the first entity's network availability.

XMPP的一个核心方面是存在性:有关XMPP实体的网络可用性的信息(即,该实体当前是在线还是离线)。当一个实体的网络可用性被无意地、非自愿地泄露给第二个实体,而该第二个实体无权知道第一个实体的网络可用性时,就会发生“存在泄漏”。

Although presence is discussed more fully in [XMPP-IM], it is important to note that an XMPP server MUST NOT leak presence. In particular at the core XMPP level, real-time addressing and network availability is associated with a specific connected resource; therefore, any disclosure of a connected resource's full JID comprises a presence leak. To help prevent such a presence leak, a server MUST NOT return different stanza errors depending on whether a potential attacker sends XML stanzas to the entity's bare JID (<localpart@domainpart>) or full JID (<localpart@domainpart/resourcepart>).

尽管在[XMPP-IM]中更全面地讨论了存在性,但需要注意的是,XMPP服务器不能泄漏存在性。特别是在核心XMPP级别,实时寻址和网络可用性与特定的连接资源相关联;因此,对连接资源的完整JID的任何披露都包括存在泄漏。为了帮助防止这种存在泄漏,根据潜在攻击者是否向实体的裸JID发送XML节,服务器不得返回不同的节错误(<localpart@domainpart>)还是完全的JID(<localpart@domainpart/资源部分>)。

13.11. Directory Harvesting
13.11. 目录获取

If a server generates an error stanza in response to receiving a stanza for a user account that does not exist, using the <service-unavailable/> stanza error condition (Section 8.3.3.19) can help protect against directory harvesting attacks, since this is the same error condition that is returned if, for instance, the namespace of an IQ child element is not understood, or if "offline message storage" ([XEP-0160]) or message forwarding is not enabled for a domain. However, subtle differences in the exact XML of error stanzas, as well as in the timing with which such errors are

如果服务器在接收到不存在的用户帐户的节时生成错误节,则使用<service unavailable/>节错误条件(第8.3.3.19节)可以帮助防止目录捕获攻击,因为这与返回的错误条件相同,例如,不理解IQ子元素的命名空间,或者如果未为域启用“脱机消息存储”([XEP-0160])或消息转发。然而,在错误节的确切XML中,以及在错误发生的时间上,存在细微的差异

returned, can enable an attacker to determine the network presence of a user when more advanced blocking technologies are not used (see for instance [XEP-0016] and [XEP-0191]). Therefore, a server that exercises a higher level of caution might not return any error at all in response to certain kinds of received stanzas, so that a non-existent user appears to behave like a user that has no interest in conversing with the sender.

返回,可使攻击者在未使用更高级的阻止技术时确定用户的网络存在(例如,请参见[XEP-0016]和[XEP-0191])。因此,对某些类型的接收节进行更高级别的警告的服务器可能根本不会返回任何错误,因此不存在的用户的行为看起来就像对与发送方对话不感兴趣的用户。

13.12. Denial of Service
13.12. 拒绝服务

[DOS] defines denial of service as follows:

[DOS]对拒绝服务的定义如下:

A denial-of-service (DoS) attack is an attack in which one or more machines target a victim and attempt to prevent the victim from doing useful work. The victim can be a network server, client or router, a network link or an entire network, an individual Internet user or a company doing business using the Internet, an Internet Service Provider (ISP), country, or any combination of or variant on these.

拒绝服务(DoS)攻击是一种攻击,其中一台或多台计算机以受害者为目标,试图阻止受害者进行有用的工作。受害者可以是网络服务器、客户端或路由器、网络链路或整个网络、个人互联网用户或使用互联网开展业务的公司、互联网服务提供商(ISP)、国家或其任何组合或变体。

Some considerations discussed in this document help to prevent denial-of-service attacks (e.g., the mandate that a server MUST NOT process XML stanzas from clients that have not yet provided appropriate authentication credentials and MUST NOT process XML stanzas from peer servers whose identity it has not either authenticated via SASL or weakly verified via Server Dialback).

本文档中讨论的一些注意事项有助于防止拒绝服务攻击(例如,要求服务器不得处理来自尚未提供适当身份验证凭据的客户端的XML节,也不得处理来自对等服务器的XML节,因为对等服务器的身份尚未通过SASL进行身份验证或通过服务器回拨进行弱验证)。

In addition, [XEP-0205] provides a detailed discussion of potential denial-of-service attacks against XMPP systems along with best practices for preventing such attacks. The recommendations include:

此外,[XEP-0205]详细讨论了针对XMPP系统的潜在拒绝服务攻击,以及防止此类攻击的最佳实践。建议包括:

1. A server implementation SHOULD enable a server administrator to limit the number of TCP connections that it will accept from a given IP address at any one time. If an entity attempts to connect but the maximum number of TCP connections has been reached, the receiving server MUST NOT allow the new connection to proceed.

1. 服务器实现应使服务器管理员能够限制在任何时候从给定IP地址接受的TCP连接数。如果实体尝试连接,但已达到最大TCP连接数,则接收服务器不得允许新连接继续。

2. A server implementation SHOULD enable a server administrator to limit the number of TCP connection attempts that it will accept from a given IP address in a given time period. If an entity attempts to connect but the maximum number of connection attempts has been reached, the receiving server MUST NOT allow the new connection to proceed.

2. 服务器实现应使服务器管理员能够限制在给定时间段内从给定IP地址接受的TCP连接尝试次数。如果实体尝试连接,但已达到最大连接尝试次数,则接收服务器不得允许新连接继续。

3. A server implementation SHOULD enable a server administrator to limit the number of connected resources it will allow an account to bind at any one time. If a client attempts to bind a resource

3. 服务器实现应使服务器管理员能够限制允许帐户在任何时候绑定的连接资源的数量。如果客户端试图绑定资源

but it has already reached the configured number of allowable resources, the receiving server MUST return a <resource-constraint/> stanza error (Section 8.3.3.18).

但已达到配置的允许资源数量,接收服务器必须返回<resource constraint/>节错误(第8.3.3.18节)。

4. A server implementation SHOULD enable a server administrator to limit the size of stanzas it will accept from a connected client or peer server (where "size" is inclusive of all XML markup as defined in Section 2.4 of [XML], from the opening "<" character of the stanza to the closing ">" character). A deployed server's maximum stanza size MUST NOT be smaller than 10000 bytes, which reflects a reasonable compromise between the benefits of expressiveness for originating entities and the costs of stanza processing for servers. A server implementation SHOULD NOT blindly set 10000 bytes as the value for all deployments but instead SHOULD enable server administrators to set their own limits. If a connected resource or peer server sends a stanza that violates the upper limit, the receiving server MUST either return a <policy-violation/> stanza error (Section 8.3.3.12), thus allowing the sender to recover, or close the stream with a <policy-violation/> stream error (Section 4.9.3.14).

4. 服务器实现应使服务器管理员能够限制从连接的客户端或对等服务器接收的节的大小(其中“大小”包括[XML]第2.4节中定义的所有XML标记,从节的开头“<”字符到结尾“>”字符)。已部署服务器的最大节大小不得小于10000字节,这反映了原始实体的表达性优势与服务器节处理成本之间的合理折衷。服务器实现不应盲目地将10000字节设置为所有部署的值,而应使服务器管理员能够设置自己的限制。如果连接的资源或对等服务器发送了一个违反上限的节,则接收服务器必须返回<policy invalition/>节错误(第8.3.3.12节),从而允许发送方恢复,或者使用<policy invalition/>流错误关闭流(第4.9.3.14节)。

5. A server implementation SHOULD enable a server administrator to limit the number of XML stanzas that a connected client is allowed to send to distinct recipients within a given time period. If a connected client sends too many stanzas to distinct recipients in a given time period, the receiving server SHOULD NOT process the stanza and instead SHOULD return a <policy-violation/> stanza error (Section 8.3.3.12).

5. 服务器实现应使服务器管理员能够限制连接的客户端在给定时间段内允许发送给不同收件人的XML节数。如果连接的客户端在给定的时间段内向不同的收件人发送过多的节,则接收服务器不应处理该节,而是应返回<policy invalition/>节错误(第8.3.3.12节)。

6. A server implementation SHOULD enable a server administrator to limit the amount of bandwidth it will allow a connected client or peer server to use in a given time period.

6. 服务器实现应使服务器管理员能够限制其允许连接的客户端或对等服务器在给定时间段内使用的带宽量。

7. A server implementation MAY enable a server administrator to limit the types of stanzas (based on the extended content "payload") that it will allow a connected resource or peer server send over an active connection. Such limits and restrictions are a matter of deployment policy.

7. 服务器实现可以使服务器管理员限制允许连接的资源或对等服务器通过活动连接发送的节类型(基于扩展内容“有效负载”)。这些限制和限制是部署政策的问题。

8. A server implementation MAY refuse to route or deliver any stanza that it considers to be abusive, with or without returning an error to the sender.

8. 服务器实现可以拒绝路由或传递它认为是滥用的任何节,无论是否向发送方返回错误。

For more detailed recommendations regarding denial-of-service attacks in XMPP systems, refer to [XEP-0205].

有关XMPP系统中拒绝服务攻击的更多详细建议,请参阅[XEP-0205]。

13.13. Firewalls
13.13. 防火墙

Although DNS SRV records can instruct connecting entities to use TCP ports other than 5222 (client-to-server) and 5269 (server-to-server), communication using XMPP typically occurs over those ports, which are registered with the IANA (see Section 14). Use of these well-known ports allows administrators to easily enable or disable XMPP activity through existing and commonly deployed firewalls.

尽管DNS SRV记录可以指示连接实体使用除5222(客户端到服务器)和5269(服务器到服务器)之外的TCP端口,但使用XMPP的通信通常发生在这些端口上,这些端口在IANA中注册(参见第14节)。使用这些众所周知的端口,管理员可以通过现有的和通常部署的防火墙轻松启用或禁用XMPP活动。

13.14. Interdomain Federation
13.14. 域间联合

The term "federation" is commonly used to describe communication between two servers.

术语“联合”通常用于描述两台服务器之间的通信。

Because service provisioning is a matter of policy, it is OPTIONAL for any given server to support federation. If a particular server enables federation, it SHOULD enable strong security as previously described to ensure both authentication and confidentiality; compliant implementations SHOULD support TLS and SASL for this purpose.

因为服务提供是一个策略问题,所以任何给定的服务器都可以选择支持联合。如果某个特定的服务器启用了联合,它应该像前面描述的那样启用强安全性,以确保身份验证和机密性;为此,兼容实现应支持TLS和SASL。

Before RFC 3920 defined TLS plus SASL EXTERNAL with certificates for encryption and authentication of server-to-server streams, the only method for weak identity verification of a peer server was Server Dialback as defined in [XEP-0220]. Even when [DNSSEC] is used, Server Dialback provides only weak identity verification and provides no confidentiality or integrity. At the time of writing, Server Dialback is still the most widely used technique for some level of assurance over server-to-server streams. This reality introduces the possibility of a downgrade attack from TLS + SASL EXTERNAL to Server Dialback if an attacker can gain control of the channel and therefore convince the initiating server that the receiving server does not support TLS or does not have an appropriate certificate. To help prevent this attack, the parties SHOULD protect the channel using TLS before proceeding, even if the presented certificates are self-signed or otherwise untrusted.

在RFC 3920定义TLS plus SASL EXTERNAL以及服务器到服务器流的加密和身份验证证书之前,对等服务器弱身份验证的唯一方法是[XEP-0220]中定义的服务器回拨。即使使用[DNSSEC],服务器回拨也只提供弱身份验证,不提供机密性或完整性。在撰写本文时,对于服务器到服务器流的某种程度的保证,服务器回拨仍然是使用最广泛的技术。如果攻击者能够获得通道控制权,从而使发起服务器确信接收服务器不支持TLS或没有适当的证书,则这种情况会引入从服务器回拨外部的TLS+SASL发起降级攻击的可能性。为帮助防止此攻击,各方应在继续之前使用TLS保护通道,即使提交的证书是自签名的或不受信任的。

13.15. Non-Repudiation
13.15. 不可抵赖

Systems that provide both peer entity authentication and data integrity have the potential to enable an entity to prove to a third party that another entity intended to send particular data. Although XMPP systems can provide both peer entity authentication and data integrity, XMPP was never designed to provide non-repudiation.

同时提供对等实体身份验证和数据完整性的系统有可能使实体能够向第三方证明另一实体打算发送特定数据。尽管XMPP系统可以同时提供对等实体身份验证和数据完整性,但XMPP从未被设计为提供不可否认性。

14. IANA Considerations
14. IANA考虑

The following subsections update the registrations provided in [RFC3920]. This section is to be interpreted according to [IANA-GUIDE].

以下小节更新了[RFC3920]中提供的注册。本节将根据[IANA-GUIDE]进行解释。

14.1. XML Namespace Name for TLS Data
14.1. TLS数据的XML命名空间名称

A URN sub-namespace for STARTTLS negotiation data in the Extensible Messaging and Presence Protocol (XMPP) is defined as follows. (This namespace name adheres to the format defined in [XML-REG].)

可扩展消息和状态协议(XMPP)中STARTTLS协商数据的URN子命名空间定义如下。(此命名空间名称遵循[XML-REG]中定义的格式。)

   URI:  urn:ietf:params:xml:ns:xmpp-tls
   Specification:  RFC 6120
   Description:  This is the XML namespace name for STARTTLS negotiation
      data in the Extensible Messaging and Presence Protocol (XMPP) as
      defined by RFC 6120.
   Registrant Contact:  IESG <iesg@ietf.org>
        
   URI:  urn:ietf:params:xml:ns:xmpp-tls
   Specification:  RFC 6120
   Description:  This is the XML namespace name for STARTTLS negotiation
      data in the Extensible Messaging and Presence Protocol (XMPP) as
      defined by RFC 6120.
   Registrant Contact:  IESG <iesg@ietf.org>
        
14.2. XML Namespace Name for SASL Data
14.2. SASL数据的XML命名空间名称

A URN sub-namespace for SASL negotiation data in the Extensible Messaging and Presence Protocol (XMPP) is defined as follows. (This namespace name adheres to the format defined in [XML-REG].)

可扩展消息和状态协议(XMPP)中SASL协商数据的URN子命名空间定义如下。(此命名空间名称遵循[XML-REG]中定义的格式。)

   URI:  urn:ietf:params:xml:ns:xmpp-sasl
   Specification:  RFC 6120
   Description:  This is the XML namespace name for SASL negotiation
      data in the Extensible Messaging and Presence Protocol (XMPP) as
      defined by RFC 6120.
   Registrant Contact:  IESG <iesg@ietf.org>
        
   URI:  urn:ietf:params:xml:ns:xmpp-sasl
   Specification:  RFC 6120
   Description:  This is the XML namespace name for SASL negotiation
      data in the Extensible Messaging and Presence Protocol (XMPP) as
      defined by RFC 6120.
   Registrant Contact:  IESG <iesg@ietf.org>
        
14.3. XML Namespace Name for Stream Errors
14.3. 流错误的XML命名空间名称

A URN sub-namespace for stream error data in the Extensible Messaging and Presence Protocol (XMPP) is defined as follows. (This namespace name adheres to the format defined in [XML-REG].)

可扩展消息和状态协议(XMPP)中流错误数据的URN子命名空间定义如下。(此命名空间名称遵循[XML-REG]中定义的格式。)

   URI:  urn:ietf:params:xml:ns:xmpp-streams
   Specification:  RFC 6120
   Description:  This is the XML namespace name for stream error data in
      the Extensible Messaging and Presence Protocol (XMPP) as defined
      by RFC 6120.
   Registrant Contact:  IESG <iesg@ietf.org>
        
   URI:  urn:ietf:params:xml:ns:xmpp-streams
   Specification:  RFC 6120
   Description:  This is the XML namespace name for stream error data in
      the Extensible Messaging and Presence Protocol (XMPP) as defined
      by RFC 6120.
   Registrant Contact:  IESG <iesg@ietf.org>
        
14.4. XML Namespace Name for Resource Binding
14.4. 资源绑定的XML命名空间名称

A URN sub-namespace for resource binding in the Extensible Messaging and Presence Protocol (XMPP) is defined as follows. (This namespace name adheres to the format defined in [XML-REG].)

可扩展消息和状态协议(XMPP)中用于资源绑定的URN子命名空间定义如下。(此命名空间名称遵循[XML-REG]中定义的格式。)

   URI:  urn:ietf:params:xml:ns:xmpp-bind
   Specification:  RFC 6120
   Description:  This is the XML namespace name for resource binding in
      the Extensible Messaging and Presence Protocol (XMPP) as defined
      by RFC 6120.
   Registrant Contact:  IESG <iesg@ietf.org>
        
   URI:  urn:ietf:params:xml:ns:xmpp-bind
   Specification:  RFC 6120
   Description:  This is the XML namespace name for resource binding in
      the Extensible Messaging and Presence Protocol (XMPP) as defined
      by RFC 6120.
   Registrant Contact:  IESG <iesg@ietf.org>
        
14.5. XML Namespace Name for Stanza Errors
14.5. 节错误的XML命名空间名称

A URN sub-namespace for stanza error data in the Extensible Messaging and Presence Protocol (XMPP) is defined as follows. (This namespace name adheres to the format defined in [XML-REG].)

可扩展消息和状态协议(XMPP)中节错误数据的URN子命名空间定义如下。(此命名空间名称遵循[XML-REG]中定义的格式。)

   URI:  urn:ietf:params:xml:ns:xmpp-stanzas
   Specification:  RFC 6120
   Description:  This is the XML namespace name for stanza error data in
      the Extensible Messaging and Presence Protocol (XMPP) as defined
      by RFC 6120.
   Registrant Contact:  IESG <iesg@ietf.org>
        
   URI:  urn:ietf:params:xml:ns:xmpp-stanzas
   Specification:  RFC 6120
   Description:  This is the XML namespace name for stanza error data in
      the Extensible Messaging and Presence Protocol (XMPP) as defined
      by RFC 6120.
   Registrant Contact:  IESG <iesg@ietf.org>
        
14.6. GSSAPI Service Name
14.6. GSSAPI服务名称

The IANA has registered "xmpp" as a [GSS-API] service name, as defined under Section 6.6.

IANA已将“xmpp”注册为第6.6节定义的[GSS-API]服务名称。

14.7. Port Numbers and Service Names
14.7. 端口号和服务名称

The IANA has registered "xmpp-client" and "xmpp-server" as keywords for [TCP] ports 5222 and 5269, respectively. In accordance with [IANA-PORTS], this document updates the existing registration, as follows.

IANA已将“xmpp客户端”和“xmpp服务器”分别注册为[TCP]端口5222和5269的关键字。根据[IANA-PORTS],本文件更新了现有注册,如下所示。

   Service Name:  xmpp-client
   Transport Protocol:  TCP
   Description:  A service offering support for connections by XMPP
      client applications
   Registrant:  IETF XMPP Working Group
   Contact:  IESG <iesg@ietf.org>
   Reference:  RFC 6120
   Port Number:  5222
        
   Service Name:  xmpp-client
   Transport Protocol:  TCP
   Description:  A service offering support for connections by XMPP
      client applications
   Registrant:  IETF XMPP Working Group
   Contact:  IESG <iesg@ietf.org>
   Reference:  RFC 6120
   Port Number:  5222
        
   Service Name:  xmpp-server
   Transport Protocol:  TCP
   Description:  A service offering support for connections by XMPP
      server applications
   Registrant:  IETF XMPP Working Group
   Contact:  IESG <iesg@ietf.org>
   Reference:  RFC 6120
   Port Number:  5269
        
   Service Name:  xmpp-server
   Transport Protocol:  TCP
   Description:  A service offering support for connections by XMPP
      server applications
   Registrant:  IETF XMPP Working Group
   Contact:  IESG <iesg@ietf.org>
   Reference:  RFC 6120
   Port Number:  5269
        
15. Conformance Requirements
15. 一致性要求

This section describes a protocol feature set that summarizes the conformance requirements of this specification. This feature set is appropriate for use in software certification, interoperability testing, and implementation reports. For each feature, this section provides the following information:

本节描述了协议功能集,该功能集总结了本规范的一致性要求。此功能集适用于软件认证、互操作性测试和实施报告。对于每个功能,本节提供以下信息:

o A human-readable name

o 人名

o An informational description

o 信息性描述

o A reference to the particular section of this document that normatively defines the feature

o 对本文件中规范性定义特征的特定章节的参考

o Whether the feature applies to the Client role, the Server role, or both (where "N/A" signifies that the feature is not applicable to the specified role)

o 该功能是否适用于客户端角色、服务器角色或两者(其中“N/A”表示该功能不适用于指定角色)

o Whether the feature MUST or SHOULD be implemented, where the capitalized terms are to be understood as described in [KEYWORDS]

o 是否必须或应该实施该功能,其中大写术语应按照[关键字]中所述理解

The feature set specified here attempts to adhere to the concepts and formats proposed by Larry Masinter within the IETF's NEWTRK Working Group in 2005, as captured in [INTEROP]. Although this feature set is more detailed than called for by [REPORTS], it provides a suitable basis for the generation of implementation reports to be submitted in support of advancing this specification from Proposed Standard to Draft Standard in accordance with [PROCESS].

此处指定的功能集试图遵循Larry Masinter于2005年在IETF的NEWTRK工作组中提出的概念和格式,如[INTEROP]中所述。尽管该功能集比[报告]要求的更详细,但它为生成提交的实施报告提供了合适的基础,以支持根据[过程]将本规范从拟定标准推进到标准草案。

Feature: bind-gen Description: Generate a random resource on demand. Section: Section 7.6 Roles: Client N/A, Server MUST.

功能:绑定生成器说明:根据需要生成随机资源。第7.6节角色:客户端不适用,服务器必须。

Feature: bind-mtn Description: Consider resource binding as mandatory-to-negotiate. Section: Section 7.3.1 Roles: Client MUST, Server MUST.

特性:绑定MTN描述:将资源绑定视为强制协商。第7.3.1节角色:客户端必须,服务器必须。

Feature: bind-restart Description: Do not restart the stream after negotiation of resource binding. Section: Section 7.3.2 Roles: Client MUST, Server MUST.

功能:绑定重启说明:在协商资源绑定后不要重启流。第7.3.2节角色:客户端必须,服务器必须。

Feature: bind-support Description: Support binding of client resources to an authenticated stream. Section: Section 7 Roles: Client MUST, Server MUST.

特性:绑定支持描述:支持将客户端资源绑定到经过身份验证的流。第7部分角色:客户端必须,服务器必须。

Feature: sasl-correlate Description: When authenticating a stream peer using SASL, correlate the authentication identifier resulting from SASL negotiation with the 'from' address (if any) of the stream header it received from the peer. Section: Section 6.4.6 Roles: Client SHOULD, Server SHOULD.

功能:sasl关联描述:使用sasl对流对等方进行身份验证时,将sasl协商产生的身份验证标识符与从对等方接收的流标头的“发件人”地址(如果有)关联。第6.4.6节角色:客户端应该,服务器应该。

Feature: sasl-errors Description: Support SASL errors during the negotiation process. Section: Section 6.5 Roles: Client MUST, Server MUST.

功能:sasl错误描述:支持协商过程中的sasl错误。第6.5节角色:客户端必须,服务器必须。

Feature: sasl-mtn Description: Consider SASL as mandatory-to-negotiate. Section: Section 6.3.1 Roles: Client MUST, Server MUST.

特点:SASL MTN描述:认为SASL是强制性的谈判。第6.3.1节角色:客户端必须,服务器必须。

Feature: sasl-restart Description: Initiate or handle a stream restart after SASL negotiation. Section: Section 6.3.2 Roles: Client MUST, Server MUST.

特性:sasl重启描述:在sasl协商后启动或处理流重启。第6.3.2节角色:客户端必须,服务器必须。

Feature: sasl-support Description: Support the Simple Authentication and Security Layer for stream authentication. Section: Section 6 Roles: Client MUST, Server MUST.

特性:sasl支持说明:支持流认证的简单认证和安全层。第6部分角色:客户端必须,服务器必须。

Feature: security-mti-auth-scram Description: Support the SASL SCRAM mechanism for authentication only (this implies support for both the SCRAM-SHA-1 and SCRAM-SHA-1-PLUS variants). Section: Section 13.8 Roles: Client MUST, Server MUST.

功能:安全mti认证紧急停堆描述:仅支持用于认证的SASL紧急停堆机制(这意味着支持scram-SHA-1和scram-SHA-1-PLUS变体)。第13.8节角色:客户端必须,服务器必须。

Feature: security-mti-both-external Description: Support TLS with SASL EXTERNAL for confidentiality and authentication. Section: Section 13.8 Roles: Client SHOULD, Server MUST.

功能:安全mti和外部描述:支持TLS和SASL外部,以实现机密性和身份验证。第13.8节角色:客户端应该,服务器必须。

Feature: security-mti-both-plain Description: Support TLS using the TLS_RSA_WITH_AES_128_CBC_SHA ciphersuite plus the SASL PLAIN mechanism for confidentiality and authentication. Section: Section 13.8 Roles: Client SHOULD, Server MAY.

功能:安全mti两种普通描述:支持TLS,使用TLS_RSA_和_AES_128_CBC_SHA密码套件以及SASL普通保密和身份验证机制。第13.8节角色:客户端应该,服务器可以。

Feature: security-mti-both-scram Description: Support TLS using the TLS_RSA_WITH_AES_128_CBC_SHA ciphersuite plus the SCRAM-SHA-1 and SCRAM-SHA-1-PLUS variants of the SASL SCRAM mechanism for confidentiality and authentication. Section: Section 13.8 Roles: Client MUST, Server MUST.

功能:安全mti两种紧急停堆描述:支持TLS,使用TLS_RSA_和_AES_128_CBC_SHA密码套件以及用于保密和身份验证的SASL紧急停堆机制的scram-SHA-1和scram-SHA-1-plus变体。第13.8节角色:客户端必须,服务器必须。

Feature: security-mti-confidentiality Description: Support TLS using the TLS_RSA_WITH_AES_128_CBC_SHA ciphersuite for confidentiality only. Section: Section 13.8 Roles: Client N/A, Server SHOULD.

功能:安全mti机密性说明:支持TLS使用TLS_RSA_和_AES_128_CBC_SHA密码套件,仅用于保密。第13.8节角色:客户端不适用,服务器应。

Feature: stanza-attribute-from Description: Support the common 'from' attribute for all stanza kinds. Section: Section 8.1.2 Roles: Client MUST, Server MUST.

特性:节属性from Description:支持所有节类型的通用“from”属性。第8.1.2节角色:客户端必须,服务器必须。

Feature: stanza-attribute-from-stamp Description: Stamp or rewrite the 'from' address of all stanzas received from connected clients. Section: Section 8.1.2.1 Roles: Client N/A, Server MUST.

功能:stamp Description中的节属性:标记或重写从连接的客户端接收的所有节的“发件人”地址。第8.1.2.1节角色:客户端不适用,服务器必须。

Feature: stanza-attribute-from-validate Description: Validate the 'from' address of all stanzas received from peer servers. Section: Section 8.1.2.2 Roles: Client N/A, Server MUST.

功能:验证描述中的节属性:验证从对等服务器接收的所有节的“发件人”地址。第8.1.2.2节角色:客户端不适用,服务器必须。

Feature: stanza-attribute-id Description: Support the common 'id' attribute for all stanza kinds. Section: Section 8.1.3 Roles: Client MUST, Server MUST.

特性:节属性id描述:支持所有节类型的通用“id”属性。第8.1.3节角色:客户端必须,服务器必须。

Feature: stanza-attribute-to Description: Support the common 'to' attribute for all stanza kinds. Section: Section 8.1.1 Roles: Client MUST, Server MUST.

功能:节属性到描述:支持所有节类型的通用“到”属性。第8.1.1节角色:客户端必须,服务器必须。

Feature: stanza-attribute-to-validate Description: Ensure that all stanzas received from peer servers include a 'to' address. Section: Section 8.1.1 Roles: Client N/A, Server MUST.

功能:用于验证说明的节属性:确保从对等服务器接收的所有节都包含“到”地址。第8.1.1节角色:客户端不适用,服务器必须。

Feature: stanza-attribute-type Description: Support the common 'type' attribute for all stanza kinds. Section: Section 8.1.4 Roles: Client MUST, Server MUST.

特性:节属性类型描述:支持所有节类型的通用“类型”属性。第8.1.4节角色:客户端必须,服务器必须。

Feature: stanza-attribute-xmllang Description: Support the common 'xml:lang' attribute for all stanza kinds. Section: Section 8.1.5 Roles: Client MUST, Server MUST.

功能:节属性xmllang描述:支持所有节类型的通用“xml:lang”属性。第8.1.5节角色:客户端必须,服务器必须。

Feature: stanza-error Description: Generate and handle stanzas of type "error" for all stanza kinds. Section: Section 8.3 Roles: Client MUST, Server MUST.

特性:节错误描述:为所有节类型生成和处理“错误”类型的节。第8.3节角色:客户端必须,服务器必须。

Feature: stanza-error-child Description: Ensure that stanzas of type "error" include an <error/> child element. Section: Section 8.3 Roles: Client MUST, Server MUST.

功能:节错误子描述:确保“error”类型的节包含<error/>子元素。第8.3节角色:客户端必须,服务器必须。

Feature: stanza-error-id Description: Ensure that stanzas of type "error" preserve the 'id' provided in the triggering stanza. Section: Section 8.3 Roles: Client MUST, Server MUST.

功能:节错误id描述:确保类型为“error”的节保留触发节中提供的“id”。第8.3节角色:客户端必须,服务器必须。

Feature: stanza-error-reply Description: Do not reply to a stanza of type "error" with another stanza of type "error". Section: Section 8.3 Roles: Client MUST, Server MUST.

特性:节错误回复说明:不要用另一节“错误”回复“错误”类型的节。第8.3节角色:客户端必须,服务器必须。

Feature: stanza-extension Description: Correctly process XML data qualified by an unsupported XML namespace, where "correctly process" means to ignore that portion of the stanza in the case of a message or presence stanza and return an error in the case of an IQ stanza (for the intended recipient), and to route or deliver the stanza (for a routing entity such as a server). Section: Section 8.4 Roles: Client MUST, Server MUST.

功能:节扩展描述:正确处理由不受支持的XML命名空间限定的XML数据,其中“正确处理”表示在消息或状态节中忽略节的该部分,在IQ节(针对预期收件人)中返回错误,并路由或传递节(对于路由实体,如服务器)。部分:第8.4节角色:客户端必须,服务器必须。

Feature: stanza-iq-child Description: Include exactly one child element in an <iq/> stanza of type "get" or "set", zero or one child elements in an <iq/> stanza of type "result", and one or two child elements in an <iq/> stanza of type "error". Section: Section 8.2.3 Roles: Client MUST, Server MUST.

特征:节iq子元素描述:在类型为“get”或“set”的<iq/>节中仅包含一个子元素,在类型为“result”的<iq/>节中包含零或一个子元素,在类型为“error”的<iq/>节中包含一个或两个子元素。第8.2.3节角色:客户端必须,服务器必须。

Feature: stanza-iq-id Description: Ensure that all <iq/> stanzas include an 'id' attribute. Section: Section 8.2.3 Roles: Client MUST, Server MUST.

功能:节iq id描述:确保所有<iq/>节都包含“id”属性。第8.2.3节角色:客户端必须,服务器必须。

Feature: stanza-iq-reply Description: Reply to an <iq/> stanza of type "get" or "set" with an <iq/> stanza of type "result" or "error". Section: Section 8.2.3 Roles: Client MUST, Server MUST.

功能:节iq回复说明:用类型为“结果”或“错误”的节回复类型为“获取”或“设置”的<iq/>节。第8.2.3节角色:客户端必须,服务器必须。

Feature: stanza-iq-type Description: Ensure that all <iq/> stanzas include a 'type' attribute whose value is "get", "set", "result", or "error". Section: Section 8.2.3 Roles: Client MUST, Server MUST.

功能:节iq类型描述:确保所有<iq/>节都包含一个“type”属性,其值为“get”、“set”、“result”或“error”。第8.2.3节角色:客户端必须,服务器必须。

Feature: stanza-kind-iq Description: Support the <iq/> stanza. Section: Section 8.2.3 Roles: Client MUST, Server MUST.

特性:节类iq描述:支持<iq/>节。第8.2.3节角色:客户端必须,服务器必须。

Feature: stanza-kind-message Description: Support the <message/> stanza. Section: Section 8.2.1 Roles: Client MUST, Server MUST.

功能:节类消息描述:支持<message/>节。第8.2.1节角色:客户端必须,服务器必须。

Feature: stanza-kind-presence Description: Support the <presence/> stanza. Section: Section 8.2.2 Roles: Client MUST, Server MUST.

特性:节类状态描述:支持<presence/>节。第8.2.2节角色:客户端必须,服务器必须。

Feature: stream-attribute-initial-from Description: Include a 'from' attribute in the initial stream header. Section: Section 4.7.1 Roles: Client SHOULD, Server MUST.

功能:流属性初始自描述:在初始流标题中包含“自”属性。第4.7.1节角色:客户端应该,服务器必须。

Feature: stream-attribute-initial-lang Description: Include an 'xml:lang' attribute in the initial stream header. Section: Section 4.7.4 Roles: Client SHOULD, Server SHOULD.

功能:流属性初始语言描述:在初始流标头中包含“xml:lang”属性。第4.7.4节角色:客户端应该,服务器应该。

Feature: stream-attribute-initial-to Description: Include a 'to' attribute in the initial stream header. Section: Section 4.7.2 Roles: Client MUST, Server MUST.

功能:流属性初始到描述:在初始流标题中包含“到”属性。第4.7.2节角色:客户端必须,服务器必须。

Feature: stream-attribute-response-from Description: Include a 'from' attribute in the response stream header. Section: Section 4.7.1 Roles: Client N/A, Server MUST.

功能:流属性响应自描述:在响应流标头中包含“from”属性。第4.7.1节角色:客户端不适用,服务器必须。

Feature: stream-attribute-response-id Description: Include an 'id' attribute in the response stream header. Section: Section 4.7.3 Roles: Client N/A, Server MUST.

功能:流属性响应id描述:在响应流标头中包含“id”属性。第4.7.3节角色:客户端不适用,服务器必须。

Feature: stream-attribute-response-id-unique Description: Ensure that the 'id' attribute in the response stream header is unique within the context of the receiving entity. Section: Section 4.7.3 Roles: Client N/A, Server MUST.

功能:流属性响应id唯一描述:确保响应流标头中的“id”属性在接收实体的上下文中是唯一的。第4.7.3节角色:客户端不适用,服务器必须。

Feature: stream-attribute-response-to Description: Include a 'to' attribute in the response stream header. Section: Section 4.7.2 Roles: Client N/A, Server SHOULD.

特性:流属性响应描述:在响应流标头中包含“to”属性。第4.7.2节角色:客户端不适用,服务器应。

Feature: stream-error-generate Description: Generate a stream error (followed by a closing stream tag and termination of the TCP connection) upon detecting a stream-related error condition. Section: Section 4.9 Roles: Client MUST, Server MUST.

特性:流错误生成描述:在检测到流相关错误条件时生成流错误(随后是关闭流标记和终止TCP连接)。第4.9节角色:客户端必须,服务器必须。

Feature: stream-fqdn-resolution Description: Resolve FQDNs before opening a TCP connection to the receiving entity. Section: Section 3.2 Roles: Client MUST, Server MUST.

功能:流fqdn解析说明:在打开与接收实体的TCP连接之前解析fqdn。第3.2节角色:客户端必须,服务器必须。

Feature: stream-negotiation-complete Description: Do not consider the stream negotiation process to be complete until the receiving entity sends a stream features advertisement that is empty or that contains only voluntary-to-negotiate features. Section: Section 4.3.5 Roles: Client MUST, Server MUST.

特性:流协商完整描述:在接收实体发送空的流特征广告或仅包含自愿协商特征的流特征广告时,不要考虑流协商过程完成。第4.3.5节角色:客户端必须,服务器必须。

Feature: stream-negotiation-features Description: Send stream features after sending a response stream header. Section: Section 4.3.2 Roles: Client N/A, Server MUST.

功能:流协商功能描述:发送响应流标头后发送流功能。第4.3.2节角色:客户端不适用,服务器必须。

Feature: stream-negotiation-restart Description: Consider the previous stream to be replaced upon negotiation of a stream feature that necessitates a stream restart, and send or receive a new initial stream header after negotiation of such a stream feature. Section: Section 4.3.3 Roles: Client MUST, Server MUST.

特征:流协商重启描述:考虑在需要流重新启动的流特征的协商时要替换的先前流,并在协商这样的流特征之后发送或接收新的初始流头。第4.3.3节角色:客户端必须,服务器必须。

Feature: stream-reconnect Description: Reconnect with exponential backoff if a TCP connection is terminated unexpectedly. Section: Section 3.3 Roles: Client MUST, Server MUST.

功能:流重新连接描述:如果TCP连接意外终止,则使用指数退避重新连接。第3.3节角色:客户端必须,服务器必须。

Feature: stream-tcp-binding Description: Bind an XML stream to a TCP connection. Section: Section 3 Roles: Client MUST, Server MUST.

功能:流tcp绑定描述:将XML流绑定到tcp连接。第三部分角色:客户端必须,服务器必须。

Feature: tls-certs Description: Check the identity specified in a certificate that is presented during TLS negotiation. Section: Section 13.7.2 Roles: Client MUST, Server MUST.

功能:tls证书说明:检查tls协商期间提供的证书中指定的身份。第13.7.2节角色:客户端必须,服务器必须。

Feature: tls-mtn Description: Consider TLS as mandatory-to-negotiate if STARTTLS is the only feature advertised or if the STARTTLS feature advertisement includes an empty <required/> element. Section: Section 5.3.1 Roles: Client MUST, Server MUST.

特点:TLS MTN描述:认为TLS是强制协商的,如果StuttLs是唯一的广告特性,或者StuttLs特性广告包含一个空的<必需/>元素。第5.3.1节角色:客户端必须,服务器必须。

Feature: tls-restart Description: Initiate or handle a stream restart after TLS negotiation. Section: Section 5.3.2 Roles: Client MUST, Server MUST.

功能:tls重启描述:在tls协商后启动或处理流重启。第5.3.2节角色:客户端必须,服务器必须。

Feature: tls-support Description: Support Transport Layer Security for stream encryption. Section: Section 5 Roles: Client MUST, Server MUST.

特性:tls支持说明:支持流加密的传输层安全性。第5部分角色:客户端必须,服务器必须。

Feature: tls-correlate Description: When validating a certificate presented by a stream peer during TLS negotiation, correlate the validated identity with the 'from' address (if any) of the stream header it received from the peer. Section: Section 13.7.2 Roles: Client SHOULD, Server SHOULD.

功能:tls关联描述:在tls协商期间验证流对等方提供的证书时,将验证的标识与从对等方接收的流标头的“发件人”地址(如果有)关联。第13.7.2节角色:客户端应该,服务器应该。

Feature: xml-namespace-content-client Description: Support 'jabber:client' as a content namespace. Section: Section 4.8.2 Roles: Client MUST, Server MUST.

功能:xml命名空间内容客户端描述:支持“jabber:client”作为内容命名空间。第4.8.2节角色:客户端必须,服务器必须。

Feature: xml-namespace-content-server Description: Support 'jabber:server' as a content namespace. Section: Section 4.8.2 Roles: Client N/A, Server MUST.

功能:xml命名空间content server描述:支持将“jabber:server”作为内容命名空间。第4.8.2节角色:客户端不适用,服务器必须。

Feature: xml-namespace-streams-declaration Description: Ensure that there is a namespace declaration for the 'http://etherx.jabber.org/streams' namespace. Section: Section 4.8.1 Roles: Client MUST, Server MUST.

功能:xml命名空间流声明说明:确保为http://etherx.jabber.org/streams'名称空间。第4.8.1节角色:客户端必须,服务器必须。

Feature: xml-namespace-streams-prefix Description: Ensure that all elements qualified by the 'http://etherx.jabber.org/streams' namespace are prefixed by the prefix (if any) defined in the namespace declaration. Section: Section 4.8.1 Roles: Client MUST, Server MUST.

功能:xml名称空间流前缀描述:确保所有元素都符合http://etherx.jabber.org/streams'命名空间由命名空间声明中定义的前缀(如果有)作为前缀。第4.8.1节角色:客户端必须,服务器必须。

Feature: xml-restriction-comment Description: Do not generate or accept XML comments. Section: Section 11.1 Roles: Client MUST, Server MUST.

功能:xml限制注释说明:不生成或接受xml注释。第11.1节角色:客户端必须,服务器必须。

Feature: xml-restriction-dtd Description: Do not generate or accept internal or external DTD subsets. Section: Section 11.1 Roles: Client MUST, Server MUST.

特性:xml限制dtd描述:不生成或接受内部或外部dtd子集。第11.1节角色:客户端必须,服务器必须。

Feature: xml-restriction-pi Description: Do not generate or accept XML processing instructions. Section: Section 11.1 Roles: Client MUST, Server MUST.

特性:xml限制pi说明:不生成或接受xml处理指令。第11.1节角色:客户端必须,服务器必须。

Feature: xml-restriction-ref Description: Do not generate or accept internal or external entity references with the exception of the predefined entities. Section: Section 11.1 Roles: Client MUST, Server MUST.

功能:xml限制引用说明:除了预定义的实体外,不要生成或接受内部或外部实体引用。第11.1节角色:客户端必须,服务器必须。

Feature: xml-wellformed-xml Description: Do not generate or accept data that is not XML-well-formed. Section: Section 11.3 Roles: Client MUST, Server MUST.

功能:xml格式良好的xml描述:不生成或接受非xml格式良好的数据。第11.3节角色:客户端必须,服务器必须。

Feature: xml-wellformed-ns Description: Do not generate or accept data that is not namespace-well-formed. Section: Section 11.3 Roles: Client MUST, Server MUST.

功能:xml格式良好的ns说明:不要生成或接受命名空间格式不正确的数据。第11.3节角色:客户端必须,服务器必须。

16. References
16. 工具书类
16.1. Normative References
16.1. 规范性引用文件

[BASE64] Josefsson, S., "The Base16, Base32, and Base64 Data Encodings", RFC 4648, October 2006.

[BASE64]Josefsson,S.,“Base16、Base32和BASE64数据编码”,RFC4648,2006年10月。

[CHANNEL] Williams, N., "On the Use of Channel Bindings to Secure Channels", RFC 5056, November 2007.

[频道]Williams,N.,“关于使用频道绑定保护频道”,RFC 5056,2007年11月。

[CHANNEL-TLS] Altman, J., Williams, N., and L. Zhu, "Channel Bindings for TLS", RFC 5929, July 2010.

[CHANNEL-TLS]Altman,J.,Williams,N.,和L.Zhu,“TLS的通道绑定”,RFC 59292010年7月。

[CHARSETS] Alvestrand, H., "IETF Policy on Character Sets and Languages", BCP 18, RFC 2277, January 1998.

[CHARSETS]Alvestrand,H.,“IETF字符集和语言政策”,BCP 18,RFC 2277,1998年1月。

[DNS-CONCEPTS] Mockapetris, P., "Domain names - concepts and facilities", STD 13, RFC 1034, November 1987.

[DNS-CONCEPTS]Mockapetris,P.,“域名-概念和设施”,STD 13,RFC 1034,1987年11月。

[DNS-SRV] Gulbrandsen, A., Vixie, P., and L. Esibov, "A DNS RR for specifying the location of services (DNS SRV)", RFC 2782, February 2000.

[DNS-SRV]Gulbrandsen,A.,Vixie,P.,和L.Esibov,“用于指定服务位置(DNS SRV)的DNS RR”,RFC 2782,2000年2月。

[IPv6-ADDR] Kawamura, S. and M. Kawashima, "A Recommendation for IPv6 Address Text Representation", RFC 5952, August 2010.

[IPv6地址]Kawamura,S.和M.Kawashima,“IPv6地址文本表示的建议”,RFC 59522010年8月。

[KEYWORDS] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.

[关键词]Bradner,S.,“RFC中用于表示需求水平的关键词”,BCP 14,RFC 2119,1997年3月。

[LANGMATCH] Phillips, A. and M. Davis, "Matching of Language Tags", BCP 47, RFC 4647, September 2006.

[LANGMATCH]Phillips,A.和M.Davis,“语言标记的匹配”,BCP 47,RFC 4647,2006年9月。

[LANGTAGS] Phillips, A. and M. Davis, "Tags for Identifying Languages", BCP 47, RFC 5646, September 2009.

[LANGTAGS]Phillips,A.和M.Davis,“识别语言的标记”,BCP 47,RFC 56462009年9月。

[OCSP] Myers, M., Ankney, R., Malpani, A., Galperin, S., and C. Adams, "X.509 Internet Public Key Infrastructure Online Certificate Status Protocol - OCSP", RFC 2560, June 1999.

[OCSP]Myers,M.,Ankney,R.,Malpani,A.,Galperin,S.,和C.Adams,“X.509互联网公钥基础设施在线证书状态协议-OCSP”,RFC 25601999年6月。

[PKIX] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., Housley, R., and W. Polk, "Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile", RFC 5280, May 2008.

[PKIX]Cooper,D.,Santesson,S.,Farrell,S.,Boeyen,S.,Housley,R.,和W.Polk,“Internet X.509公钥基础设施证书和证书撤销列表(CRL)配置文件”,RFC 52802008年5月。

[PKIX-ALGO] Jonsson, J. and B. Kaliski, "Public-Key Cryptography Standards (PKCS) #1: RSA Cryptography Specifications Version 2.1", RFC 3447, February 2003.

[PKIX-ALGO]Jonsson,J.和B.Kaliski,“公钥密码标准(PKCS)#1:RSA密码规范版本2.1”,RFC 3447,2003年2月。

[PKIX-SRV] Santesson, S., "Internet X.509 Public Key Infrastructure Subject Alternative Name for Expression of Service Name", RFC 4985, August 2007.

[PKIX-SRV]Santesson,S.,“互联网X.509公钥基础设施主体服务名称表达的备选名称”,RFC 4985,2007年8月。

[PLAIN] Zeilenga, K., "The PLAIN Simple Authentication and Security Layer (SASL) Mechanism", RFC 4616, August 2006.

[普通]Zeilenga,K.,“普通简单认证和安全层(SASL)机制”,RFC4616,2006年8月。

[RANDOM] Eastlake, D., Schiller, J., and S. Crocker, "Randomness Requirements for Security", BCP 106, RFC 4086, June 2005.

[随机]Eastlake,D.,Schiller,J.,和S.Crocker,“安全的随机性要求”,BCP 106,RFC 40862005年6月。

[SASL] Melnikov, A. and K. Zeilenga, "Simple Authentication and Security Layer (SASL)", RFC 4422, June 2006.

[SASL]Melnikov,A.和K.Zeilenga,“简单身份验证和安全层(SASL)”,RFC 4422,2006年6月。

[SCRAM] Newman, C., Menon-Sen, A., Melnikov, A., and N. Williams, "Salted Challenge Response Authentication Mechanism (SCRAM) SASL and GSS-API Mechanisms", RFC 5802, July 2010.

[SCRAM]Newman,C.,Menon Sen,A.,Melnikov,A.,和N.Williams,“盐渍挑战响应认证机制(SCRAM)SASL和GSS-API机制”,RFC 5802,2010年7月。

[STRONGSEC] Schiller, J., "Strong Security Requirements for Internet Engineering Task Force Standard Protocols", BCP 61, RFC 3365, August 2002.

[STRONGSEC]Schiller,J.“互联网工程任务组标准协议的强大安全要求”,BCP 61,RFC 3365,2002年8月。

[TCP] Postel, J., "Transmission Control Protocol", STD 7, RFC 793, September 1981.

[TCP]Postel,J.,“传输控制协议”,STD 7,RFC 793,1981年9月。

[TLS] Dierks, T. and E. Rescorla, "The Transport Layer Security (TLS) Protocol Version 1.2", RFC 5246, August 2008.

[TLS]Dierks,T.和E.Rescorla,“传输层安全(TLS)协议版本1.2”,RFC 5246,2008年8月。

[TLS-CERTS] Saint-Andre, P. and J. Hodges, "Representation and Verification of Domain-Based Application Service Identity within Internet Public Key Infrastructure Using X.509 (PKIX) Certificates in the Context of Transport Layer Security (TLS)", RFC 6125, March 2011.

[TLS-CERTS]Saint Andre,P.和J.Hodges,“在传输层安全(TLS)环境下使用X.509(PKIX)证书在互联网公钥基础设施中表示和验证基于域的应用程序服务身份”,RFC 61252011年3月。

[TLS-NEG] Rescorla, E., Ray, M., Dispensa, S., and N. Oskov, "Transport Layer Security (TLS) Renegotiation Indication Extension", RFC 5746, February 2010.

[TLS-NEG]Rescorla,E.,Ray,M.,Dispensa,S.,和N.Oskov,“传输层安全(TLS)重新协商指示扩展”,RFC 57462010年2月。

[TLS-SSL2] Turner, S. and T. Polk, "Prohibiting Secure Sockets Layer (SSL) Version 2.0", RFC 6176, March 2011.

[TLS-SSL2]Turner,S.和T.Polk,“禁止安全套接字层(SSL)2.0版”,RFC 61762011年3月。

[UCS2] International Organization for Standardization, "Information Technology - Universal Multiple-octet coded Character Set (UCS) - Amendment 2: UCS Transformation Format 8 (UTF-8)", ISO Standard 10646-1 Addendum 2, October 1996.

[UCS2]国际标准化组织,“信息技术-通用多八位编码字符集(UCS)-修改件2:UCS转换格式8(UTF-8)”,ISO标准10646-1附录2,1996年10月。

[UNICODE] The Unicode Consortium, "The Unicode Standard, Version 6.0", 2010, <http://www.unicode.org/versions/Unicode6.0.0/>.

[UNICODE]UNICODE联盟,“UNICODE标准,6.0版”,2010年<http://www.unicode.org/versions/Unicode6.0.0/>.

[UTF-8] Yergeau, F., "UTF-8, a transformation format of ISO 10646", STD 63, RFC 3629, November 2003.

[UTF-8]Yergeau,F.,“UTF-8,ISO 10646的转换格式”,STD 63,RFC 3629,2003年11月。

[URI] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform Resource Identifier (URI): Generic Syntax", STD 66, RFC 3986, January 2005.

[URI]Berners Lee,T.,Fielding,R.,和L.Masinter,“统一资源标识符(URI):通用语法”,STD 66,RFC 3986,2005年1月。

[X509] International Telecommunications Union, "Information technology - Open Systems Interconnection - The Directory: Public-key and attribute certificate frameworks", ITU-T Recommendation X.509, ISO Standard 9594-8, March 2000.

[X509]国际电信联盟,“信息技术-开放系统互连-目录:公钥和属性证书框架”,ITU-T建议X.509,ISO标准9594-8,2000年3月。

[XML] Maler, E., Yergeau, F., Sperberg-McQueen, C., Paoli, J., and T. Bray, "Extensible Markup Language (XML) 1.0 (Fifth Edition)", World Wide Web Consortium Recommendation REC-xml-20081126, November 2008, <http://www.w3.org/TR/2008/REC-xml-20081126>.

[XML]Maler,E.,Yergeau,F.,Sperberg McQueen,C.,Paoli,J.,和T.Bray,“可扩展标记语言(XML)1.0(第五版)”,万维网联盟建议REC-XML-20081126,2008年11月<http://www.w3.org/TR/2008/REC-xml-20081126>.

[XML-GUIDE] Hollenbeck, S., Rose, M., and L. Masinter, "Guidelines for the Use of Extensible Markup Language (XML) within IETF Protocols", BCP 70, RFC 3470, January 2003.

[XML-GUIDE]Hollenbeck,S.,Rose,M.,和L.Masinter,“IETF协议中可扩展标记语言(XML)的使用指南”,BCP 70,RFC 3470,2003年1月。

[XML-MEDIA] Murata, M., St. Laurent, S., and D. Kohn, "XML Media Types", RFC 3023, January 2001.

[XML-MEDIA]Murata,M.,St.Laurent,S.,和D.Kohn,“XML媒体类型”,RFC 3023,2001年1月。

[XML-NAMES] Thompson, H., Hollander, D., Layman, A., Bray, T., and R. Tobin, "Namespaces in XML 1.0 (Third Edition)", World Wide Web Consortium Recommendation REC-xml-names-20091208, December 2009, <http://www.w3.org/TR/2009/REC-xml-names-20091208>.

[XML-NAMES]Thompson,H.,Hollander,D.,Layman,A.,Bray,T.,和R.Tobin,“XML 1.0中的名称空间(第三版)”,万维网联盟建议REC-XML-NAMES-20091208,2009年12月<http://www.w3.org/TR/2009/REC-xml-names-20091208>.

[XMPP-ADDR] Saint-Andre, P., "Extensible Messaging and Presence Protocol (XMPP): Address Format", RFC 6122, March 2011.

[XMPP-ADDR]Saint Andre,P.,“可扩展消息和状态协议(XMPP):地址格式”,RFC 6122,2011年3月。

[XMPP-IM] Saint-Andre, P., "Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence", RFC 6121, March 2011.

[XMPP-IM]Saint Andre,P.,“可扩展消息和状态协议(XMPP):即时消息和状态”,RFC 61212011年3月。

16.2. Informative References
16.2. 资料性引用

[AAA] Housley, R. and B. Aboba, "Guidance for Authentication, Authorization, and Accounting (AAA) Key Management", BCP 132, RFC 4962, July 2007.

[AAA]Housley,R.和B.Aboba,“认证、授权和会计(AAA)密钥管理指南”,BCP 132,RFC 4962,2007年7月。

[ABNF] Crocker, D. and P. Overell, "Augmented BNF for Syntax Specifications: ABNF", STD 68, RFC 5234, January 2008.

[ABNF]Crocker,D.和P.Overell,“语法规范的扩充BNF:ABNF”,STD 68,RFC 5234,2008年1月。

[ACAP] Newman, C. and J. Myers, "ACAP -- Application Configuration Access Protocol", RFC 2244, November 1997.

[ACAP]Newman,C.和J.Myers,“ACAP——应用程序配置访问协议”,RFC22441997年11月。

[ANONYMOUS] Zeilenga, K., "Anonymous Simple Authentication and Security Layer (SASL) Mechanism", RFC 4505, June 2006.

[匿名]Zeilenga,K.,“匿名简单身份验证和安全层(SASL)机制”,RFC 45052006年6月。

[ASN.1] CCITT, "Recommendation X.208: Specification of Abstract Syntax Notation One (ASN.1)", 1988.

[ASN.1]CCITT,“建议X.208:抽象语法符号1规范(ASN.1)”,1988年。

[DIGEST-MD5] Leach, P. and C. Newman, "Using Digest Authentication as a SASL Mechanism", RFC 2831, May 2000.

[DIGEST-MD5]Leach,P.和C.Newman,“使用摘要认证作为SASL机制”,RFC 28312000年5月。

[DNSSEC] Arends, R., Austein, R., Larson, M., Massey, D., and S. Rose, "DNS Security Introduction and Requirements", RFC 4033, March 2005.

[DNSSEC]Arends,R.,Austein,R.,Larson,M.,Massey,D.,和S.Rose,“DNS安全介绍和要求”,RFC 4033,2005年3月。

[DNS-TXT] Rosenbaum, R., "Using the Domain Name System To Store Arbitrary String Attributes", RFC 1464, May 1993.

[DNS-TXT]Rosenbaum,R.,“使用域名系统存储任意字符串属性”,RFC 1464,1993年5月。

[DOS] Handley, M., Rescorla, E., and IAB, "Internet Denial-of-Service Considerations", RFC 4732, December 2006.

[DOS]Handley,M.,Rescorla,E.,和IAB,“互联网拒绝服务注意事项”,RFC 4732,2006年12月。

[E2E-REQS] Saint-Andre, P., "Requirements for End-to-End Encryption in the Extensible Messaging and Presence Protocol (XMPP)", Work in Progress, March 2010.

[E2E-REQS]Saint Andre,P.,“可扩展消息和状态协议(XMPP)中端到端加密的要求”,正在进行的工作,2010年3月。

[EMAIL-ARCH] Crocker, D., "Internet Mail Architecture", RFC 5598, July 2009.

[EMAIL-ARCH]Crocker,D.,“互联网邮件体系结构”,RFC 55982009年7月。

[ETHERNET] "Information technology - Telecommunications and information exchange between systems - Local and metropolitan area networks - Specific requirements - Part 3: Carrier sense multiple access with collision detection (CSMA/CD) access method and physical layer specifications", IEEE Standard 802.3, September 1998.

[以太网]“信息技术.系统间电信和信息交换.局域网和城域网.特殊要求.第3部分:带冲突检测的载波侦听多址接入(CSMA/CD)接入方法和物理层规范”,IEEE标准802.3,1998年9月。

[GSS-API] Linn, J., "Generic Security Service Application Program Interface Version 2, Update 1", RFC 2743, January 2000.

[GSS-API]Linn,J.,“通用安全服务应用程序接口版本2,更新1”,RFC 2743,2000年1月。

[HASHES] Hoffman, P. and B. Schneier, "Attacks on Cryptographic Hashes in Internet Protocols", RFC 4270, November 2005.

[散列]Hoffman,P.和B.Schneier,“对互联网协议中加密散列的攻击”,RFC 42702005年11月。

[HTTP] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999.

[HTTP]菲尔丁,R.,盖蒂斯,J.,莫卧儿,J.,弗莱斯蒂克,H.,马斯特,L.,利奇,P.,和T.伯纳斯李,“超文本传输协议——HTTP/1.1”,RFC2616,1999年6月。

[IANA-GUIDE] Narten, T. and H. Alvestrand, "Guidelines for Writing an IANA Considerations Section in RFCs", BCP 26, RFC 5226, May 2008.

[IANA-GUIDE]Narten,T.和H.Alvestrand,“在RFCs中编写IANA注意事项部分的指南”,BCP 26,RFC 5226,2008年5月。

[IANA-PORTS] Cotton, M., Eggert, L., Touch, J., Westerlund, M., and S. Cheshire, "Internet Assigned Numbers Authority (IANA) Procedures for the Management of the Transport Protocol Port Number and Service Name Registry", Work in Progress, February 2011.

[IANA-PORTS]Cotton,M.,Eggert,L.,Touch,J.,Westerlund,M.,和S.Cheshire,“互联网分配号码管理局(IANA)管理传输协议端口号和服务名称注册的程序”,正在进行的工作,2011年2月。

[IMAP] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4rev1", RFC 3501, March 2003.

[IMAP]Crispin,M.,“互联网消息访问协议-版本4rev1”,RFC 35012003年3月。

[IMP-REQS] Day, M., Aggarwal, S., and J. Vincent, "Instant Messaging / Presence Protocol Requirements", RFC 2779, February 2000.

[IMP-REQS]Day,M.,Aggarwal,S.,和J.Vincent,“即时消息/存在协议要求”,RFC 27792000年2月。

[INTEROP] Masinter, L., "Formalizing IETF Interoperability Reporting", Work in Progress, October 2005.

[INTEROP]Masinter,L.,“IETF互操作性报告的形式化”,正在进行的工作,2005年10月。

[IRC] Kalt, C., "Internet Relay Chat: Architecture", RFC 2810, April 2000.

[IRC]Kalt,C.,“互联网中继聊天:架构”,RFC 28102000年4月。

[IRI] Duerst, M. and M. Suignard, "Internationalized Resource Identifiers (IRIs)", RFC 3987, January 2005.

[IRI]Duerst,M.和M.Suignard,“国际化资源标识符(IRIs)”,RFC 3987,2005年1月。

[LDAP] Zeilenga, K., "Lightweight Directory Access Protocol (LDAP): Technical Specification Road Map", RFC 4510, June 2006.

[LDAP]Zeilenga,K.,“轻量级目录访问协议(LDAP):技术规范路线图”,RFC45102006年6月。

[LINKLOCAL] Cheshire, S., Aboba, B., and E. Guttman, "Dynamic Configuration of IPv4 Link-Local Addresses", RFC 3927, May 2005.

[LINKLOCAL]Cheshire,S.,Aboba,B.,和E.Guttman,“IPv4链路本地地址的动态配置”,RFC 3927,2005年5月。

[MAILBOXES] Crocker, D., "MAILBOX NAMES FOR COMMON SERVICES, ROLES AND FUNCTIONS", RFC 2142, May 1997.

[邮箱]Crocker,D.,“公共服务、角色和功能的邮箱名称”,RFC 2142,1997年5月。

[POP3] Myers, J. and M. Rose, "Post Office Protocol - Version 3", STD 53, RFC 1939, May 1996.

[POP3]迈尔斯,J.和M.罗斯,“邮局协议-第3版”,STD 53,RFC 1939,1996年5月。

[PROCESS] Bradner, S., "The Internet Standards Process -- Revision 3", BCP 9, RFC 2026, October 1996.

[过程]Bradner,S.,“互联网标准过程——第3版”,BCP 9,RFC 2026,1996年10月。

[REPORTS] Dusseault, L. and R. Sparks, "Guidance on Interoperation and Implementation Reports for Advancement to Draft Standard", BCP 9, RFC 5657, September 2009.

[报告]Dusseault,L.和R.Sparks,“推进标准草案的互操作和实施报告指南”,BCP 9,RFC 5657,2009年9月。

[REST] Fielding, R., "Architectural Styles and the Design of Network-based Software Architectures", 2000.

[REST]Fielding,R.,“架构风格和基于网络的软件架构的设计”,2000年。

[RFC3920] Saint-Andre, P., Ed., "Extensible Messaging and Presence Protocol (XMPP): Core", RFC 3920, October 2004.

[RFC3920]Saint Andre,P.,Ed.“可扩展消息和状态协议(XMPP):核心”,RFC 3920,2004年10月。

[RFC3921] Saint-Andre, P., Ed., "Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence", RFC 3921, October 2004.

[RFC3921]Saint Andre,P.,Ed.“可扩展消息传递和状态协议(XMPP):即时消息传递和状态”,RFC 39212004年10月。

[SASLPREP] Zeilenga, K., "SASLprep: Stringprep Profile for User Names and Passwords", RFC 4013, February 2005.

[SASLPREP]Zeilenga,K.,“SASLPREP:Stringprep用户名和密码配置文件”,RFC 4013,2005年2月。

[SEC-TERMS] Shirey, R., "Internet Security Glossary, Version 2", RFC 4949, August 2007.

[SEC-TERMS]Shirey,R.,“互联网安全术语表,第2版”,RFC 49492007年8月。

[SMTP] Klensin, J., "Simple Mail Transfer Protocol", RFC 5321, October 2008.

[SMTP]Klensin,J.,“简单邮件传输协议”,RFC 53212008年10月。

[SEC-GUIDE] Rescorla, E. and B. Korver, "Guidelines for Writing RFC Text on Security Considerations", BCP 72, RFC 3552, July 2003.

[SEC-GUIDE]Rescorla,E.和B.Korver,“关于安全注意事项的RFC文本编写指南”,BCP 72,RFC 3552,2003年7月。

[TLS-EXT] Eastlake 3rd, D., "Transport Layer Security (TLS) Extensions: Extension Definitions", RFC 6066, January 2011.

[TLS-EXT]Eastlake 3rd,D.,“传输层安全(TLS)扩展:扩展定义”,RFC 6066,2011年1月。

[TLS-RESUME] Salowey, J., Zhou, H., Eronen, P., and H. Tschofenig, "Transport Layer Security (TLS) Session Resumption without Server-Side State", RFC 5077, January 2008.

[TLS-RESUME]Salowey,J.,Zhou,H.,Eronen,P.,和H.Tschofenig,“无服务器端状态的传输层安全(TLS)会话恢复”,RFC 5077,2008年1月。

[URN-OID] Mealling, M., "A URN Namespace of Object Identifiers", RFC 3061, February 2001.

[URN-OID]Mealling,M.“对象标识符的URN名称空间”,RFC 3061,2001年2月。

[USINGTLS] Newman, C., "Using TLS with IMAP, POP3 and ACAP", RFC 2595, June 1999.

[USINGTLS]Newman,C.,“将TLS与IMAP、POP3和ACAP一起使用”,RFC 25951999年6月。

[UUID] Leach, P., Mealling, M., and R. Salz, "A Universally Unique IDentifier (UUID) URN Namespace", RFC 4122, July 2005.

[UUID]Leach,P.,Mealling,M.和R.Salz,“通用唯一标识符(UUID)URN名称空间”,RFC 4122,2005年7月。

[XEP-0001] Saint-Andre, P., "XMPP Extension Protocols", XSF XEP 0001, March 2010.

[XEP-0001]圣安德烈,P.,“XMPP扩展协议”,XSF XEP 0001,2010年3月。

[XEP-0016] Millard, P. and P. Saint-Andre, "Privacy Lists", XSF XEP 0016, February 2007.

[XEP-0016]Millard,P.和P.Saint Andre,“隐私列表”,XSF XEP 0016,2007年2月。

[XEP-0045] Saint-Andre, P., "Multi-User Chat", XSF XEP 0045, July 2007.

[XEP-0045]圣安德烈,P.,“多用户聊天”,XSF XEP 00452007年7月。

[XEP-0060] Millard, P., Saint-Andre, P., and R. Meijer, "Publish-Subscribe", XSF XEP 0060, July 2010.

[XEP-0060]Millard,P.,Saint Andre,P.,和R.Meijer,“发布-订阅”,XSF XEP 0060,2010年7月。

[XEP-0071] Saint-Andre, P., "XHTML-IM", XSF XEP 0071, September 2008.

[XEP-0071]圣安德烈,P.,“XHTML-IM”,XSF XEP 0071,2008年9月。

[XEP-0077] Saint-Andre, P., "In-Band Registration", XSF XEP 0077, September 2009.

[XEP-0077]圣安德烈,P.,“带内注册”,XSF XEP 0077,2009年9月。

[XEP-0086] Norris, R. and P. Saint-Andre, "Error Condition Mappings", XSF XEP 0086, February 2004.

[XEP-0086]Norris,R.和P.Saint Andre,“错误条件映射”,XSF XEP 0086,2004年2月。

[XEP-0100] Saint-Andre, P. and D. Smith, "Gateway Interaction", XSF XEP 0100, October 2005.

[XEP-0100]圣安德烈,P.和D.史密斯,“网关交互”,XSF XEP 0100,2005年10月。

[XEP-0114] Saint-Andre, P., "Jabber Component Protocol", XSF XEP 0114, March 2005.

[XEP-0114]圣安德烈,P.,“Jabber组件协议”,XSF XEP 0114,2005年3月。

[XEP-0124] Paterson, I., Smith, D., and P. Saint-Andre, "Bidirectional-streams Over Synchronous HTTP (BOSH)", XSF XEP 0124, July 2010.

[XEP-0124]Paterson,I.,Smith,D.,和P.Saint Andre,“同步HTTP(BOSH)上的双向流”,XSF XEP 01242010年7月。

[XEP-0138] Hildebrand, J. and P. Saint-Andre, "Stream Compression", XSF XEP 0138, May 2009.

[XEP-0138]Hildebrand,J.和P.Saint Andre,“流压缩”,XSF XEP 0138,2009年5月。

[XEP-0156] Hildebrand, J. and P. Saint-Andre, "Discovering Alternative XMPP Connection Methods", XSF XEP 0156, June 2007.

[XEP-0156]Hildebrand,J.和P.Saint Andre,“发现替代XMPP连接方法”,XSF XEP 0156,2007年6月。

[XEP-0160] Saint-Andre, P., "Best Practices for Handling Offline Messages", XSF XEP 0160, January 2006.

[XEP-0160]圣安德烈,P.,“处理离线消息的最佳实践”,XSF XEP 0160,2006年1月。

[XEP-0174] Saint-Andre, P., "Link-Local Messaging", XSF XEP 0174, November 2008.

[XEP-0174]圣安德烈,P.,“链接本地消息传递”,XSF XEP 0174,2008年11月。

[XEP-0175] Saint-Andre, P., "Best Practices for Use of SASL ANONYMOUS", XSF XEP 0175, September 2009.

[XEP-0175]圣安德烈,P.,“SASL匿名使用的最佳实践”,XSF XEP 0175,2009年9月。

[XEP-0178] Saint-Andre, P. and P. Millard, "Best Practices for Use of SASL EXTERNAL with Certificates", XSF XEP 0178, February 2007.

[XEP-0178]Saint Andre,P.和P.Millard,“使用SASL外部认证的最佳实践”,XSF XEP 0178,2007年2月。

[XEP-0191] Saint-Andre, P., "Simple Communications Blocking", XSF XEP 0191, February 2007.

[XEP-0191]圣安德烈,P.,“简单通信阻塞”,XSF XEP 0191,2007年2月。

[XEP-0198] Karneges, J., Hildebrand, J., Saint-Andre, P., Forno, F., Cridland, D., and M. Wild, "Stream Management", XSF XEP 0198, February 2011.

[XEP-0198]Karneges,J.,Hildebrand,J.,Saint Andre,P.,Forno,F.,Cridland,D.,和M.Wild,“河流管理”,XSF XEP 0198,2011年2月。

[XEP-0199] Saint-Andre, P., "XMPP Ping", XSF XEP 0199, June 2009.

[XEP-0199]圣安德烈,P.,“XMPP Ping”,XSF XEP 0199,2009年6月。

[XEP-0205] Saint-Andre, P., "Best Practices to Discourage Denial of Service Attacks", XSF XEP 0205, January 2009.

[XEP-0205]圣安德烈,P.,“阻止拒绝服务攻击的最佳实践”,XSF XEP 02052009年1月。

[XEP-0206] Paterson, I. and P. Saint-Andre, "XMPP Over BOSH", XSF XEP 0206, July 2010.

[XEP-0206]Paterson,I.和P.Saint Andre,“波什上方的XMPP”,XSF XEP 0206,2010年7月。

[XEP-0220] Miller, J., Saint-Andre, P., and P. Hancke, "Server Dialback", XSF XEP 0220, March 2010.

[XEP-0220]Miller,J.,Saint Andre,P.,和P.Hancke,“服务器拨号”,XSF XEP 0220,2010年3月。

[XEP-0225] Saint-Andre, P., "Component Connections", XSF XEP 0225, October 2008.

[XEP-0225]圣安德烈,P.,“部件连接”,XSF XEP 0225,2008年10月。

[XEP-0233] Miller, M., Saint-Andre, P., and J. Hildebrand, "Domain-Based Service Names in XMPP SASL Negotiation", XSF XEP 0233, June 2010.

[XEP-0233]Miller,M.,Saint Andre,P.,和J.Hildebrand,“XMPP SASL协商中基于域的服务名称”,XSF XEP 0233,2010年6月。

[XEP-0288] Hancke, P. and D. Cridland, "Bidirectional Server-to-Server Connections", XSF XEP 0288, October 2010.

[XEP-0288]Hancke,P.和D.Cridland,“双向服务器到服务器连接”,XSF XEP 0288,2010年10月。

[XML-FRAG] Grosso, P. and D. Veillard, "XML Fragment Interchange", World Wide Web Consortium CR CR-xml-fragment-20010212, February 2001, <http://www.w3.org/TR/2001/CR-xml-fragment-20010212>.

[XML-FRAG]Grosso,P.和D.Veillard,“XML片段交换”,万维网联盟CR-XML-Fragment-20010212,2001年2月<http://www.w3.org/TR/2001/CR-xml-fragment-20010212>.

[XML-REG] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688, January 2004.

[XML-REG]Mealling,M.“IETF XML注册表”,BCP 81,RFC 3688,2004年1月。

[XML-SCHEMA] Thompson, H., Maloney, M., Mendelsohn, N., and D. Beech, "XML Schema Part 1: Structures Second Edition", World Wide Web Consortium Recommendation REC-xmlschema-1-20041028, October 2004, <http://www.w3.org/TR/2004/REC-xmlschema-1-20041028>.

[XML-SCHEMA]Thompson,H.,Maloney,M.,Mendelsohn,N.,和D.Beech,“XML模式第1部分:结构第二版”,万维网联盟建议REC-xmlschema-1-20041028,2004年10月<http://www.w3.org/TR/2004/REC-xmlschema-1-20041028>.

[XMPP-URI] Saint-Andre, P., "Internationalized Resource Identifiers (IRIs) and Uniform Resource Identifiers (URIs) for the Extensible Messaging and Presence Protocol (XMPP)", RFC 5122, February 2008.

[XMPP-URI]Saint Andre,P.,“可扩展消息传递和存在协议(XMPP)的国际化资源标识符(IRI)和统一资源标识符(URI)”,RFC 5122,2008年2月。

Appendix A. XML Schemas
附录A.XML模式

The following schemas formally define various namespaces used in this document, in conformance with [XML-SCHEMA]. Because validation of XML streams and stanzas is optional, these schemas are not normative and are provided for descriptive purposes only.

以下模式正式定义了本文档中使用的各种名称空间,符合[XML-SCHEMA]。因为XML流和节的验证是可选的,所以这些模式不是规范性的,仅用于描述目的。

A.1. Stream Namespace
A.1. 流名称空间
   <?xml version='1.0' encoding='UTF-8'?>
        
   <?xml version='1.0' encoding='UTF-8'?>
        
   <xs:schema
       xmlns:xs='http://www.w3.org/2001/XMLSchema'
       targetNamespace='http://etherx.jabber.org/streams'
       xmlns='http://etherx.jabber.org/streams'
       elementFormDefault='unqualified'>
        
   <xs:schema
       xmlns:xs='http://www.w3.org/2001/XMLSchema'
       targetNamespace='http://etherx.jabber.org/streams'
       xmlns='http://etherx.jabber.org/streams'
       elementFormDefault='unqualified'>
        
     <xs:import namespace='jabber:client'/>
     <xs:import namespace='jabber:server'/>
     <xs:import namespace='urn:ietf:params:xml:ns:xmpp-sasl'/>
     <xs:import namespace='urn:ietf:params:xml:ns:xmpp-streams'/>
     <xs:import namespace='urn:ietf:params:xml:ns:xmpp-tls'/>
        
     <xs:import namespace='jabber:client'/>
     <xs:import namespace='jabber:server'/>
     <xs:import namespace='urn:ietf:params:xml:ns:xmpp-sasl'/>
     <xs:import namespace='urn:ietf:params:xml:ns:xmpp-streams'/>
     <xs:import namespace='urn:ietf:params:xml:ns:xmpp-tls'/>
        
     <xs:element name='stream'>
       <xs:complexType>
         <xs:sequence xmlns:client='jabber:client'
                      xmlns:server='jabber:server'>
           <xs:element ref='features'
                       minOccurs='0'
                       maxOccurs='1'/>
           <xs:any namespace='urn:ietf:params:xml:ns:xmpp-tls'
                   minOccurs='0'
                   maxOccurs='1'/>
           <xs:any namespace='urn:ietf:params:xml:ns:xmpp-sasl'
                   minOccurs='0'
                   maxOccurs='1'/>
           <xs:any namespace='##other'
                   minOccurs='0'
                   maxOccurs='unbounded'
                   processContents='lax'/>
           <xs:choice minOccurs='0' maxOccurs='1'>
             <xs:choice minOccurs='0' maxOccurs='unbounded'>
               <xs:element ref='client:message'/>
               <xs:element ref='client:presence'/>
               <xs:element ref='client:iq'/>
             </xs:choice>
        
     <xs:element name='stream'>
       <xs:complexType>
         <xs:sequence xmlns:client='jabber:client'
                      xmlns:server='jabber:server'>
           <xs:element ref='features'
                       minOccurs='0'
                       maxOccurs='1'/>
           <xs:any namespace='urn:ietf:params:xml:ns:xmpp-tls'
                   minOccurs='0'
                   maxOccurs='1'/>
           <xs:any namespace='urn:ietf:params:xml:ns:xmpp-sasl'
                   minOccurs='0'
                   maxOccurs='1'/>
           <xs:any namespace='##other'
                   minOccurs='0'
                   maxOccurs='unbounded'
                   processContents='lax'/>
           <xs:choice minOccurs='0' maxOccurs='1'>
             <xs:choice minOccurs='0' maxOccurs='unbounded'>
               <xs:element ref='client:message'/>
               <xs:element ref='client:presence'/>
               <xs:element ref='client:iq'/>
             </xs:choice>
        
             <xs:choice minOccurs='0' maxOccurs='unbounded'>
               <xs:element ref='server:message'/>
               <xs:element ref='server:presence'/>
               <xs:element ref='server:iq'/>
             </xs:choice>
           </xs:choice>
           <xs:element ref='error' minOccurs='0' maxOccurs='1'/>
         </xs:sequence>
         <xs:attribute name='from' type='xs:string' use='optional'/>
         <xs:attribute name='id' type='xs:string' use='optional'/>
         <xs:attribute name='to' type='xs:string' use='optional'/>
         <xs:attribute name='version' type='xs:decimal' use='optional'/>
         <xs:attribute ref='xml:lang' use='optional'/>
         <xs:anyAttribute namespace='##other' processContents='lax'/>
       </xs:complexType>
     </xs:element>
        
             <xs:choice minOccurs='0' maxOccurs='unbounded'>
               <xs:element ref='server:message'/>
               <xs:element ref='server:presence'/>
               <xs:element ref='server:iq'/>
             </xs:choice>
           </xs:choice>
           <xs:element ref='error' minOccurs='0' maxOccurs='1'/>
         </xs:sequence>
         <xs:attribute name='from' type='xs:string' use='optional'/>
         <xs:attribute name='id' type='xs:string' use='optional'/>
         <xs:attribute name='to' type='xs:string' use='optional'/>
         <xs:attribute name='version' type='xs:decimal' use='optional'/>
         <xs:attribute ref='xml:lang' use='optional'/>
         <xs:anyAttribute namespace='##other' processContents='lax'/>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='features'>
       <xs:complexType>
         <xs:sequence>
           <xs:any namespace='##other'
                   minOccurs='0'
                   maxOccurs='unbounded'
                   processContents='lax'/>
         </xs:sequence>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='features'>
       <xs:complexType>
         <xs:sequence>
           <xs:any namespace='##other'
                   minOccurs='0'
                   maxOccurs='unbounded'
                   processContents='lax'/>
         </xs:sequence>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='error'>
       <xs:complexType>
         <xs:sequence  xmlns:err='urn:ietf:params:xml:ns:xmpp-streams'>
           <xs:group   ref='err:streamErrorGroup'/>
           <xs:element ref='err:text'
                       minOccurs='0'
                       maxOccurs='1'/>
           <xs:any     namespace='##other'
                       minOccurs='0'
                       maxOccurs='1'
                       processContents='lax'/>
         </xs:sequence>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='error'>
       <xs:complexType>
         <xs:sequence  xmlns:err='urn:ietf:params:xml:ns:xmpp-streams'>
           <xs:group   ref='err:streamErrorGroup'/>
           <xs:element ref='err:text'
                       minOccurs='0'
                       maxOccurs='1'/>
           <xs:any     namespace='##other'
                       minOccurs='0'
                       maxOccurs='1'
                       processContents='lax'/>
         </xs:sequence>
       </xs:complexType>
     </xs:element>
        
   </xs:schema>
        
   </xs:schema>
        
A.2. Stream Error Namespace
A.2. 流错误命名空间
   <?xml version='1.0' encoding='UTF-8'?>
        
   <?xml version='1.0' encoding='UTF-8'?>
        
   <xs:schema
       xmlns:xs='http://www.w3.org/2001/XMLSchema'
       targetNamespace='urn:ietf:params:xml:ns:xmpp-streams'
       xmlns='urn:ietf:params:xml:ns:xmpp-streams'
       elementFormDefault='qualified'>
        
   <xs:schema
       xmlns:xs='http://www.w3.org/2001/XMLSchema'
       targetNamespace='urn:ietf:params:xml:ns:xmpp-streams'
       xmlns='urn:ietf:params:xml:ns:xmpp-streams'
       elementFormDefault='qualified'>
        
     <xs:element name='bad-format' type='empty'/>
     <xs:element name='bad-namespace-prefix' type='empty'/>
     <xs:element name='conflict' type='empty'/>
     <xs:element name='connection-timeout' type='empty'/>
     <xs:element name='host-gone' type='empty'/>
     <xs:element name='host-unknown' type='empty'/>
     <xs:element name='improper-addressing' type='empty'/>
     <xs:element name='internal-server-error' type='empty'/>
     <xs:element name='invalid-from' type='empty'/>
     <xs:element name='invalid-id' type='empty'/>
     <xs:element name='invalid-namespace' type='empty'/>
     <xs:element name='invalid-xml' type='empty'/>
     <xs:element name='not-authorized' type='empty'/>
     <xs:element name='not-well-formed' type='empty'/>
     <xs:element name='policy-violation' type='empty'/>
     <xs:element name='remote-connection-failed' type='empty'/>
     <xs:element name='reset' type='empty'/>
     <xs:element name='resource-constraint' type='empty'/>
     <xs:element name='restricted-xml' type='empty'/>
     <xs:element name='see-other-host' type='xs:string'/>
     <xs:element name='system-shutdown' type='empty'/>
     <xs:element name='undefined-condition' type='empty'/>
     <xs:element name='unsupported-encoding' type='empty'/>
     <xs:element name='unsupported-stanza-type' type='empty'/>
     <xs:element name='unsupported-version' type='empty'/>
        
     <xs:element name='bad-format' type='empty'/>
     <xs:element name='bad-namespace-prefix' type='empty'/>
     <xs:element name='conflict' type='empty'/>
     <xs:element name='connection-timeout' type='empty'/>
     <xs:element name='host-gone' type='empty'/>
     <xs:element name='host-unknown' type='empty'/>
     <xs:element name='improper-addressing' type='empty'/>
     <xs:element name='internal-server-error' type='empty'/>
     <xs:element name='invalid-from' type='empty'/>
     <xs:element name='invalid-id' type='empty'/>
     <xs:element name='invalid-namespace' type='empty'/>
     <xs:element name='invalid-xml' type='empty'/>
     <xs:element name='not-authorized' type='empty'/>
     <xs:element name='not-well-formed' type='empty'/>
     <xs:element name='policy-violation' type='empty'/>
     <xs:element name='remote-connection-failed' type='empty'/>
     <xs:element name='reset' type='empty'/>
     <xs:element name='resource-constraint' type='empty'/>
     <xs:element name='restricted-xml' type='empty'/>
     <xs:element name='see-other-host' type='xs:string'/>
     <xs:element name='system-shutdown' type='empty'/>
     <xs:element name='undefined-condition' type='empty'/>
     <xs:element name='unsupported-encoding' type='empty'/>
     <xs:element name='unsupported-stanza-type' type='empty'/>
     <xs:element name='unsupported-version' type='empty'/>
        
     <xs:group name='streamErrorGroup'>
       <xs:choice>
         <xs:element ref='bad-format'/>
         <xs:element ref='bad-namespace-prefix'/>
         <xs:element ref='conflict'/>
         <xs:element ref='connection-timeout'/>
         <xs:element ref='host-gone'/>
         <xs:element ref='host-unknown'/>
         <xs:element ref='improper-addressing'/>
         <xs:element ref='internal-server-error'/>
         <xs:element ref='invalid-from'/>
         <xs:element ref='invalid-id'/>
        
     <xs:group name='streamErrorGroup'>
       <xs:choice>
         <xs:element ref='bad-format'/>
         <xs:element ref='bad-namespace-prefix'/>
         <xs:element ref='conflict'/>
         <xs:element ref='connection-timeout'/>
         <xs:element ref='host-gone'/>
         <xs:element ref='host-unknown'/>
         <xs:element ref='improper-addressing'/>
         <xs:element ref='internal-server-error'/>
         <xs:element ref='invalid-from'/>
         <xs:element ref='invalid-id'/>
        
         <xs:element ref='invalid-namespace'/>
         <xs:element ref='invalid-xml'/>
         <xs:element ref='not-authorized'/>
         <xs:element ref='not-well-formed'/>
         <xs:element ref='policy-violation'/>
         <xs:element ref='remote-connection-failed'/>
         <xs:element ref='reset'/>
         <xs:element ref='resource-constraint'/>
         <xs:element ref='restricted-xml'/>
         <xs:element ref='see-other-host'/>
         <xs:element ref='system-shutdown'/>
         <xs:element ref='undefined-condition'/>
         <xs:element ref='unsupported-encoding'/>
         <xs:element ref='unsupported-stanza-type'/>
         <xs:element ref='unsupported-version'/>
       </xs:choice>
     </xs:group>
        
         <xs:element ref='invalid-namespace'/>
         <xs:element ref='invalid-xml'/>
         <xs:element ref='not-authorized'/>
         <xs:element ref='not-well-formed'/>
         <xs:element ref='policy-violation'/>
         <xs:element ref='remote-connection-failed'/>
         <xs:element ref='reset'/>
         <xs:element ref='resource-constraint'/>
         <xs:element ref='restricted-xml'/>
         <xs:element ref='see-other-host'/>
         <xs:element ref='system-shutdown'/>
         <xs:element ref='undefined-condition'/>
         <xs:element ref='unsupported-encoding'/>
         <xs:element ref='unsupported-stanza-type'/>
         <xs:element ref='unsupported-version'/>
       </xs:choice>
     </xs:group>
        
     <xs:element name='text'>
       <xs:complexType>
         <xs:simpleContent>
           <xs:extension base='xs:string'>
             <xs:attribute ref='xml:lang' use='optional'/>
           </xs:extension>
         </xs:simpleContent>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='text'>
       <xs:complexType>
         <xs:simpleContent>
           <xs:extension base='xs:string'>
             <xs:attribute ref='xml:lang' use='optional'/>
           </xs:extension>
         </xs:simpleContent>
       </xs:complexType>
     </xs:element>
        
     <xs:simpleType name='empty'>
       <xs:restriction base='xs:string'>
         <xs:enumeration value=''/>
       </xs:restriction>
     </xs:simpleType>
        
     <xs:simpleType name='empty'>
       <xs:restriction base='xs:string'>
         <xs:enumeration value=''/>
       </xs:restriction>
     </xs:simpleType>
        
   </xs:schema>
        
   </xs:schema>
        
A.3. STARTTLS Namespace
A.3. STARTTLS名称空间
   <?xml version='1.0' encoding='UTF-8'?>
        
   <?xml version='1.0' encoding='UTF-8'?>
        
   <xs:schema
       xmlns:xs='http://www.w3.org/2001/XMLSchema'
       targetNamespace='urn:ietf:params:xml:ns:xmpp-tls'
       xmlns='urn:ietf:params:xml:ns:xmpp-tls'
       elementFormDefault='qualified'>
        
   <xs:schema
       xmlns:xs='http://www.w3.org/2001/XMLSchema'
       targetNamespace='urn:ietf:params:xml:ns:xmpp-tls'
       xmlns='urn:ietf:params:xml:ns:xmpp-tls'
       elementFormDefault='qualified'>
        
     <xs:element name='starttls'>
       <xs:complexType>
         <xs:choice minOccurs='0' maxOccurs='1'>
           <xs:element name='required' type='empty'/>
         </xs:choice>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='starttls'>
       <xs:complexType>
         <xs:choice minOccurs='0' maxOccurs='1'>
           <xs:element name='required' type='empty'/>
         </xs:choice>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='proceed' type='empty'/>
        
     <xs:element name='proceed' type='empty'/>
        
     <xs:element name='failure' type='empty'/>
        
     <xs:element name='failure' type='empty'/>
        
     <xs:simpleType name='empty'>
       <xs:restriction base='xs:string'>
         <xs:enumeration value=''/>
       </xs:restriction>
     </xs:simpleType>
        
     <xs:simpleType name='empty'>
       <xs:restriction base='xs:string'>
         <xs:enumeration value=''/>
       </xs:restriction>
     </xs:simpleType>
        
   </xs:schema>
        
   </xs:schema>
        
A.4. SASL Namespace
A.4. SASL名称空间
   <?xml version='1.0' encoding='UTF-8'?>
        
   <?xml version='1.0' encoding='UTF-8'?>
        
   <xs:schema
       xmlns:xs='http://www.w3.org/2001/XMLSchema'
       targetNamespace='urn:ietf:params:xml:ns:xmpp-sasl'
       xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
       elementFormDefault='qualified'>
        
   <xs:schema
       xmlns:xs='http://www.w3.org/2001/XMLSchema'
       targetNamespace='urn:ietf:params:xml:ns:xmpp-sasl'
       xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
       elementFormDefault='qualified'>
        
     <xs:element name='mechanisms'>
       <xs:complexType>
         <xs:sequence>
           <xs:element name='mechanism'
                       minOccurs='1'
                       maxOccurs='unbounded'
                       type='xs:NMTOKEN'/>
           <xs:any namespace='##other'
                   minOccurs='0'
                   maxOccurs='unbounded'
                   processContents='lax'/>
         </xs:sequence>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='mechanisms'>
       <xs:complexType>
         <xs:sequence>
           <xs:element name='mechanism'
                       minOccurs='1'
                       maxOccurs='unbounded'
                       type='xs:NMTOKEN'/>
           <xs:any namespace='##other'
                   minOccurs='0'
                   maxOccurs='unbounded'
                   processContents='lax'/>
         </xs:sequence>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='abort' type='empty'/>
        
     <xs:element name='abort' type='empty'/>
        
     <xs:element name='auth'>
       <xs:complexType>
         <xs:simpleContent>
           <xs:extension base='xs:string'>
             <xs:attribute name='mechanism'
                           type='xs:NMTOKEN'
                           use='required'/>
           </xs:extension>
         </xs:simpleContent>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='auth'>
       <xs:complexType>
         <xs:simpleContent>
           <xs:extension base='xs:string'>
             <xs:attribute name='mechanism'
                           type='xs:NMTOKEN'
                           use='required'/>
           </xs:extension>
         </xs:simpleContent>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='challenge' type='xs:string'/>
        
     <xs:element name='challenge' type='xs:string'/>
        
     <xs:element name='response' type='xs:string'/>
        
     <xs:element name='response' type='xs:string'/>
        
     <xs:element name='success' type='xs:string'/>
        
     <xs:element name='success' type='xs:string'/>
        
     <xs:element name='failure'>
       <xs:complexType>
         <xs:sequence>
           <xs:choice minOccurs='0'>
             <xs:element name='aborted' type='empty'/>
             <xs:element name='account-disabled' type='empty'/>
             <xs:element name='credentials-expired' type='empty'/>
             <xs:element name='encryption-required' type='empty'/>
             <xs:element name='incorrect-encoding' type='empty'/>
             <xs:element name='invalid-authzid' type='empty'/>
             <xs:element name='invalid-mechanism' type='empty'/>
             <xs:element name='malformed-request' type='empty'/>
             <xs:element name='mechanism-too-weak' type='empty'/>
             <xs:element name='not-authorized' type='empty'/>
             <xs:element name='temporary-auth-failure' type='empty'/>
           </xs:choice>
           <xs:element ref='text' minOccurs='0' maxOccurs='1'/>
         </xs:sequence>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='failure'>
       <xs:complexType>
         <xs:sequence>
           <xs:choice minOccurs='0'>
             <xs:element name='aborted' type='empty'/>
             <xs:element name='account-disabled' type='empty'/>
             <xs:element name='credentials-expired' type='empty'/>
             <xs:element name='encryption-required' type='empty'/>
             <xs:element name='incorrect-encoding' type='empty'/>
             <xs:element name='invalid-authzid' type='empty'/>
             <xs:element name='invalid-mechanism' type='empty'/>
             <xs:element name='malformed-request' type='empty'/>
             <xs:element name='mechanism-too-weak' type='empty'/>
             <xs:element name='not-authorized' type='empty'/>
             <xs:element name='temporary-auth-failure' type='empty'/>
           </xs:choice>
           <xs:element ref='text' minOccurs='0' maxOccurs='1'/>
         </xs:sequence>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='text'>
       <xs:complexType>
         <xs:simpleContent>
           <xs:extension base='xs:string'>
             <xs:attribute ref='xml:lang' use='optional'/>
           </xs:extension>
         </xs:simpleContent>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='text'>
       <xs:complexType>
         <xs:simpleContent>
           <xs:extension base='xs:string'>
             <xs:attribute ref='xml:lang' use='optional'/>
           </xs:extension>
         </xs:simpleContent>
       </xs:complexType>
     </xs:element>
        
     <xs:simpleType name='empty'>
       <xs:restriction base='xs:string'>
         <xs:enumeration value=''/>
       </xs:restriction>
     </xs:simpleType>
        
     <xs:simpleType name='empty'>
       <xs:restriction base='xs:string'>
         <xs:enumeration value=''/>
       </xs:restriction>
     </xs:simpleType>
        
   </xs:schema>
        
   </xs:schema>
        
A.5. Client Namespace
A.5. 客户端名称空间
   <?xml version='1.0' encoding='UTF-8'?>
        
   <?xml version='1.0' encoding='UTF-8'?>
        
   <xs:schema
       xmlns:xs='http://www.w3.org/2001/XMLSchema'
       targetNamespace='jabber:client'
       xmlns='jabber:client'
       elementFormDefault='qualified'>
        
   <xs:schema
       xmlns:xs='http://www.w3.org/2001/XMLSchema'
       targetNamespace='jabber:client'
       xmlns='jabber:client'
       elementFormDefault='qualified'>
        
     <xs:import
         namespace='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        
     <xs:import
         namespace='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        
     <xs:element name='message'>
        <xs:complexType>
           <xs:sequence>
             <xs:choice minOccurs='0' maxOccurs='unbounded'>
               <xs:element ref='subject'/>
               <xs:element ref='body'/>
               <xs:element ref='thread'/>
             </xs:choice>
             <xs:any     namespace='##other'
                         minOccurs='0'
                         maxOccurs='unbounded'
                         processContents='lax'/>
             <xs:element ref='error'
                         minOccurs='0'/>
           </xs:sequence>
           <xs:attribute name='from'
                         type='xs:string'
                         use='optional'/>
           <xs:attribute name='id'
                         type='xs:NMTOKEN'
                         use='optional'/>
           <xs:attribute name='to'
                         type='xs:string'
                         use='optional'/>
           <xs:attribute name='type'
                         use='optional'
                         default='normal'>
        
     <xs:element name='message'>
        <xs:complexType>
           <xs:sequence>
             <xs:choice minOccurs='0' maxOccurs='unbounded'>
               <xs:element ref='subject'/>
               <xs:element ref='body'/>
               <xs:element ref='thread'/>
             </xs:choice>
             <xs:any     namespace='##other'
                         minOccurs='0'
                         maxOccurs='unbounded'
                         processContents='lax'/>
             <xs:element ref='error'
                         minOccurs='0'/>
           </xs:sequence>
           <xs:attribute name='from'
                         type='xs:string'
                         use='optional'/>
           <xs:attribute name='id'
                         type='xs:NMTOKEN'
                         use='optional'/>
           <xs:attribute name='to'
                         type='xs:string'
                         use='optional'/>
           <xs:attribute name='type'
                         use='optional'
                         default='normal'>
        
             <xs:simpleType>
               <xs:restriction base='xs:NMTOKEN'>
                 <xs:enumeration value='chat'/>
                 <xs:enumeration value='error'/>
                 <xs:enumeration value='groupchat'/>
                 <xs:enumeration value='headline'/>
                 <xs:enumeration value='normal'/>
               </xs:restriction>
             </xs:simpleType>
           </xs:attribute>
           <xs:attribute ref='xml:lang' use='optional'/>
        </xs:complexType>
     </xs:element>
        
             <xs:simpleType>
               <xs:restriction base='xs:NMTOKEN'>
                 <xs:enumeration value='chat'/>
                 <xs:enumeration value='error'/>
                 <xs:enumeration value='groupchat'/>
                 <xs:enumeration value='headline'/>
                 <xs:enumeration value='normal'/>
               </xs:restriction>
             </xs:simpleType>
           </xs:attribute>
           <xs:attribute ref='xml:lang' use='optional'/>
        </xs:complexType>
     </xs:element>
        
     <xs:element name='body'>
       <xs:complexType>
         <xs:simpleContent>
           <xs:extension base='xs:string'>
             <xs:attribute ref='xml:lang' use='optional'/>
           </xs:extension>
         </xs:simpleContent>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='body'>
       <xs:complexType>
         <xs:simpleContent>
           <xs:extension base='xs:string'>
             <xs:attribute ref='xml:lang' use='optional'/>
           </xs:extension>
         </xs:simpleContent>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='subject'>
       <xs:complexType>
         <xs:simpleContent>
           <xs:extension base='xs:string'>
             <xs:attribute ref='xml:lang' use='optional'/>
           </xs:extension>
         </xs:simpleContent>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='subject'>
       <xs:complexType>
         <xs:simpleContent>
           <xs:extension base='xs:string'>
             <xs:attribute ref='xml:lang' use='optional'/>
           </xs:extension>
         </xs:simpleContent>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='thread'>
       <xs:complexType>
         <xs:simpleContent>
           <xs:extension base='xs:NMTOKEN'>
             <xs:attribute name='parent'
                           type='xs:NMTOKEN'
                           use='optional'/>
           </xs:extension>
         </xs:simpleContent>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='thread'>
       <xs:complexType>
         <xs:simpleContent>
           <xs:extension base='xs:NMTOKEN'>
             <xs:attribute name='parent'
                           type='xs:NMTOKEN'
                           use='optional'/>
           </xs:extension>
         </xs:simpleContent>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='presence'>
       <xs:complexType>
         <xs:sequence>
           <xs:choice minOccurs='0' maxOccurs='unbounded'>
             <xs:element ref='show'/>
             <xs:element ref='status'/>
             <xs:element ref='priority'/>
           </xs:choice>
           <xs:any     namespace='##other'
                       minOccurs='0'
                       maxOccurs='unbounded'
                       processContents='lax'/>
           <xs:element ref='error'
                       minOccurs='0'/>
         </xs:sequence>
         <xs:attribute name='from'
                       type='xs:string'
                       use='optional'/>
         <xs:attribute name='id'
                       type='xs:NMTOKEN'
                       use='optional'/>
         <xs:attribute name='to'
                       type='xs:string'
                       use='optional'/>
         <xs:attribute name='type' use='optional'>
           <xs:simpleType>
             <xs:restriction base='xs:NMTOKEN'>
               <xs:enumeration value='error'/>
               <xs:enumeration value='probe'/>
               <xs:enumeration value='subscribe'/>
               <xs:enumeration value='subscribed'/>
               <xs:enumeration value='unavailable'/>
               <xs:enumeration value='unsubscribe'/>
               <xs:enumeration value='unsubscribed'/>
             </xs:restriction>
           </xs:simpleType>
         </xs:attribute>
         <xs:attribute ref='xml:lang' use='optional'/>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='presence'>
       <xs:complexType>
         <xs:sequence>
           <xs:choice minOccurs='0' maxOccurs='unbounded'>
             <xs:element ref='show'/>
             <xs:element ref='status'/>
             <xs:element ref='priority'/>
           </xs:choice>
           <xs:any     namespace='##other'
                       minOccurs='0'
                       maxOccurs='unbounded'
                       processContents='lax'/>
           <xs:element ref='error'
                       minOccurs='0'/>
         </xs:sequence>
         <xs:attribute name='from'
                       type='xs:string'
                       use='optional'/>
         <xs:attribute name='id'
                       type='xs:NMTOKEN'
                       use='optional'/>
         <xs:attribute name='to'
                       type='xs:string'
                       use='optional'/>
         <xs:attribute name='type' use='optional'>
           <xs:simpleType>
             <xs:restriction base='xs:NMTOKEN'>
               <xs:enumeration value='error'/>
               <xs:enumeration value='probe'/>
               <xs:enumeration value='subscribe'/>
               <xs:enumeration value='subscribed'/>
               <xs:enumeration value='unavailable'/>
               <xs:enumeration value='unsubscribe'/>
               <xs:enumeration value='unsubscribed'/>
             </xs:restriction>
           </xs:simpleType>
         </xs:attribute>
         <xs:attribute ref='xml:lang' use='optional'/>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='show'>
       <xs:simpleType>
         <xs:restriction base='xs:NMTOKEN'>
           <xs:enumeration value='away'/>
           <xs:enumeration value='chat'/>
           <xs:enumeration value='dnd'/>
           <xs:enumeration value='xa'/>
         </xs:restriction>
       </xs:simpleType>
     </xs:element>
        
     <xs:element name='show'>
       <xs:simpleType>
         <xs:restriction base='xs:NMTOKEN'>
           <xs:enumeration value='away'/>
           <xs:enumeration value='chat'/>
           <xs:enumeration value='dnd'/>
           <xs:enumeration value='xa'/>
         </xs:restriction>
       </xs:simpleType>
     </xs:element>
        
     <xs:element name='status'>
       <xs:complexType>
         <xs:simpleContent>
           <xs:extension base='string1024'>
             <xs:attribute ref='xml:lang' use='optional'/>
           </xs:extension>
         </xs:simpleContent>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='status'>
       <xs:complexType>
         <xs:simpleContent>
           <xs:extension base='string1024'>
             <xs:attribute ref='xml:lang' use='optional'/>
           </xs:extension>
         </xs:simpleContent>
       </xs:complexType>
     </xs:element>
        
     <xs:simpleType name='string1024'>
       <xs:restriction base='xs:string'>
         <xs:minLength value='1'/>
         <xs:maxLength value='1024'/>
       </xs:restriction>
     </xs:simpleType>
        
     <xs:simpleType name='string1024'>
       <xs:restriction base='xs:string'>
         <xs:minLength value='1'/>
         <xs:maxLength value='1024'/>
       </xs:restriction>
     </xs:simpleType>
        
     <xs:element name='priority' type='xs:byte'/>
        
     <xs:element name='priority' type='xs:byte'/>
        
     <xs:element name='iq'>
       <xs:complexType>
         <xs:sequence>
           <xs:any     namespace='##other'
                       minOccurs='0'
                       maxOccurs='1'
                       processContents='lax'/>
           <xs:element ref='error'
                       minOccurs='0'/>
         </xs:sequence>
         <xs:attribute name='from'
                       type='xs:string'
                       use='optional'/>
         <xs:attribute name='id'
                       type='xs:NMTOKEN'
                       use='required'/>
        
     <xs:element name='iq'>
       <xs:complexType>
         <xs:sequence>
           <xs:any     namespace='##other'
                       minOccurs='0'
                       maxOccurs='1'
                       processContents='lax'/>
           <xs:element ref='error'
                       minOccurs='0'/>
         </xs:sequence>
         <xs:attribute name='from'
                       type='xs:string'
                       use='optional'/>
         <xs:attribute name='id'
                       type='xs:NMTOKEN'
                       use='required'/>
        
         <xs:attribute name='to'
                       type='xs:string'
                       use='optional'/>
         <xs:attribute name='type' use='required'>
           <xs:simpleType>
             <xs:restriction base='xs:NMTOKEN'>
               <xs:enumeration value='error'/>
               <xs:enumeration value='get'/>
               <xs:enumeration value='result'/>
               <xs:enumeration value='set'/>
             </xs:restriction>
           </xs:simpleType>
         </xs:attribute>
         <xs:attribute ref='xml:lang' use='optional'/>
       </xs:complexType>
     </xs:element>
        
         <xs:attribute name='to'
                       type='xs:string'
                       use='optional'/>
         <xs:attribute name='type' use='required'>
           <xs:simpleType>
             <xs:restriction base='xs:NMTOKEN'>
               <xs:enumeration value='error'/>
               <xs:enumeration value='get'/>
               <xs:enumeration value='result'/>
               <xs:enumeration value='set'/>
             </xs:restriction>
           </xs:simpleType>
         </xs:attribute>
         <xs:attribute ref='xml:lang' use='optional'/>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='error'>
       <xs:complexType>
         <xs:sequence xmlns:err='urn:ietf:params:xml:ns:xmpp-stanzas'>
           <xs:group ref='err:stanzaErrorGroup'/>
           <xs:element ref='err:text'
                       minOccurs='0'/>
         </xs:sequence>
         <xs:attribute name='by'
                       type='xs:string'
                       use='optional'/>
         <xs:attribute name='type' use='required'>
           <xs:simpleType>
             <xs:restriction base='xs:NMTOKEN'>
               <xs:enumeration value='auth'/>
               <xs:enumeration value='cancel'/>
               <xs:enumeration value='continue'/>
               <xs:enumeration value='modify'/>
               <xs:enumeration value='wait'/>
             </xs:restriction>
           </xs:simpleType>
         </xs:attribute>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='error'>
       <xs:complexType>
         <xs:sequence xmlns:err='urn:ietf:params:xml:ns:xmpp-stanzas'>
           <xs:group ref='err:stanzaErrorGroup'/>
           <xs:element ref='err:text'
                       minOccurs='0'/>
         </xs:sequence>
         <xs:attribute name='by'
                       type='xs:string'
                       use='optional'/>
         <xs:attribute name='type' use='required'>
           <xs:simpleType>
             <xs:restriction base='xs:NMTOKEN'>
               <xs:enumeration value='auth'/>
               <xs:enumeration value='cancel'/>
               <xs:enumeration value='continue'/>
               <xs:enumeration value='modify'/>
               <xs:enumeration value='wait'/>
             </xs:restriction>
           </xs:simpleType>
         </xs:attribute>
       </xs:complexType>
     </xs:element>
        
   </xs:schema>
        
   </xs:schema>
        
A.6. Server Namespace
A.6. 服务器名称空间
   <?xml version='1.0' encoding='UTF-8'?>
        
   <?xml version='1.0' encoding='UTF-8'?>
        
   <xs:schema
       xmlns:xs='http://www.w3.org/2001/XMLSchema'
       targetNamespace='jabber:server'
       xmlns='jabber:server'
       elementFormDefault='qualified'>
        
   <xs:schema
       xmlns:xs='http://www.w3.org/2001/XMLSchema'
       targetNamespace='jabber:server'
       xmlns='jabber:server'
       elementFormDefault='qualified'>
        
     <xs:import
         namespace='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        
     <xs:import
         namespace='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        
     <xs:element name='message'>
        <xs:complexType>
           <xs:sequence>
             <xs:choice minOccurs='0' maxOccurs='unbounded'>
               <xs:element ref='subject'/>
               <xs:element ref='body'/>
               <xs:element ref='thread'/>
             </xs:choice>
             <xs:any namespace='##other'
                     minOccurs='0'
                     maxOccurs='unbounded'
                     processContents='lax'/>
             <xs:element ref='error'
                         minOccurs='0'/>
           </xs:sequence>
           <xs:attribute name='from'
                         type='xs:string'
                         use='required'/>
           <xs:attribute name='id'
                         type='xs:NMTOKEN'
                         use='optional'/>
           <xs:attribute name='to'
                         type='xs:string'
                         use='required'/>
           <xs:attribute name='type'
                         use='optional'
                         default='normal'>
             <xs:simpleType>
               <xs:restriction base='xs:NMTOKEN'>
                 <xs:enumeration value='chat'/>
                 <xs:enumeration value='error'/>
                 <xs:enumeration value='groupchat'/>
                 <xs:enumeration value='headline'/>
                 <xs:enumeration value='normal'/>
               </xs:restriction>
        
     <xs:element name='message'>
        <xs:complexType>
           <xs:sequence>
             <xs:choice minOccurs='0' maxOccurs='unbounded'>
               <xs:element ref='subject'/>
               <xs:element ref='body'/>
               <xs:element ref='thread'/>
             </xs:choice>
             <xs:any namespace='##other'
                     minOccurs='0'
                     maxOccurs='unbounded'
                     processContents='lax'/>
             <xs:element ref='error'
                         minOccurs='0'/>
           </xs:sequence>
           <xs:attribute name='from'
                         type='xs:string'
                         use='required'/>
           <xs:attribute name='id'
                         type='xs:NMTOKEN'
                         use='optional'/>
           <xs:attribute name='to'
                         type='xs:string'
                         use='required'/>
           <xs:attribute name='type'
                         use='optional'
                         default='normal'>
             <xs:simpleType>
               <xs:restriction base='xs:NMTOKEN'>
                 <xs:enumeration value='chat'/>
                 <xs:enumeration value='error'/>
                 <xs:enumeration value='groupchat'/>
                 <xs:enumeration value='headline'/>
                 <xs:enumeration value='normal'/>
               </xs:restriction>
        
             </xs:simpleType>
           </xs:attribute>
           <xs:attribute ref='xml:lang' use='optional'/>
        </xs:complexType>
     </xs:element>
        
             </xs:simpleType>
           </xs:attribute>
           <xs:attribute ref='xml:lang' use='optional'/>
        </xs:complexType>
     </xs:element>
        
     <xs:element name='body'>
       <xs:complexType>
         <xs:simpleContent>
           <xs:extension base='xs:string'>
             <xs:attribute ref='xml:lang' use='optional'/>
           </xs:extension>
         </xs:simpleContent>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='body'>
       <xs:complexType>
         <xs:simpleContent>
           <xs:extension base='xs:string'>
             <xs:attribute ref='xml:lang' use='optional'/>
           </xs:extension>
         </xs:simpleContent>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='subject'>
       <xs:complexType>
         <xs:simpleContent>
           <xs:extension base='xs:string'>
             <xs:attribute ref='xml:lang' use='optional'/>
           </xs:extension>
         </xs:simpleContent>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='subject'>
       <xs:complexType>
         <xs:simpleContent>
           <xs:extension base='xs:string'>
             <xs:attribute ref='xml:lang' use='optional'/>
           </xs:extension>
         </xs:simpleContent>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='thread'>
       <xs:complexType>
         <xs:simpleContent>
           <xs:extension base='xs:NMTOKEN'>
             <xs:attribute name='parent'
                           type='xs:NMTOKEN'
                           use='optional'/>
           </xs:extension>
         </xs:simpleContent>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='thread'>
       <xs:complexType>
         <xs:simpleContent>
           <xs:extension base='xs:NMTOKEN'>
             <xs:attribute name='parent'
                           type='xs:NMTOKEN'
                           use='optional'/>
           </xs:extension>
         </xs:simpleContent>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='subject'>
       <xs:complexType>
         <xs:simpleContent>
           <xs:extension base='xs:NMTOKEN'>
             <xs:attribute name='parent'
                           type='xs:NMTOKEN'
                           use='optional'/>
           </xs:extension>
         </xs:simpleContent>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='subject'>
       <xs:complexType>
         <xs:simpleContent>
           <xs:extension base='xs:NMTOKEN'>
             <xs:attribute name='parent'
                           type='xs:NMTOKEN'
                           use='optional'/>
           </xs:extension>
         </xs:simpleContent>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='presence'>
       <xs:complexType>
         <xs:sequence>
           <xs:choice minOccurs='0' maxOccurs='unbounded'>
             <xs:element ref='show'/>
             <xs:element ref='status'/>
             <xs:element ref='priority'/>
           </xs:choice>
           <xs:any     namespace='##other'
                       minOccurs='0'
                       maxOccurs='unbounded'
                       processContents='lax'/>
           <xs:element ref='error'
                       minOccurs='0'/>
         </xs:sequence>
         <xs:attribute name='from'
                       type='xs:string'
                       use='required'/>
         <xs:attribute name='id'
                       type='xs:NMTOKEN'
                       use='optional'/>
         <xs:attribute name='to'
                       type='xs:string'
                       use='required'/>
         <xs:attribute name='type' use='optional'>
           <xs:simpleType>
             <xs:restriction base='xs:NMTOKEN'>
               <xs:enumeration value='error'/>
               <xs:enumeration value='probe'/>
               <xs:enumeration value='subscribe'/>
               <xs:enumeration value='subscribed'/>
               <xs:enumeration value='unavailable'/>
               <xs:enumeration value='unsubscribe'/>
               <xs:enumeration value='unsubscribed'/>
             </xs:restriction>
           </xs:simpleType>
        
     <xs:element name='presence'>
       <xs:complexType>
         <xs:sequence>
           <xs:choice minOccurs='0' maxOccurs='unbounded'>
             <xs:element ref='show'/>
             <xs:element ref='status'/>
             <xs:element ref='priority'/>
           </xs:choice>
           <xs:any     namespace='##other'
                       minOccurs='0'
                       maxOccurs='unbounded'
                       processContents='lax'/>
           <xs:element ref='error'
                       minOccurs='0'/>
         </xs:sequence>
         <xs:attribute name='from'
                       type='xs:string'
                       use='required'/>
         <xs:attribute name='id'
                       type='xs:NMTOKEN'
                       use='optional'/>
         <xs:attribute name='to'
                       type='xs:string'
                       use='required'/>
         <xs:attribute name='type' use='optional'>
           <xs:simpleType>
             <xs:restriction base='xs:NMTOKEN'>
               <xs:enumeration value='error'/>
               <xs:enumeration value='probe'/>
               <xs:enumeration value='subscribe'/>
               <xs:enumeration value='subscribed'/>
               <xs:enumeration value='unavailable'/>
               <xs:enumeration value='unsubscribe'/>
               <xs:enumeration value='unsubscribed'/>
             </xs:restriction>
           </xs:simpleType>
        
         </xs:attribute>
         <xs:attribute ref='xml:lang' use='optional'/>
       </xs:complexType>
     </xs:element>
        
         </xs:attribute>
         <xs:attribute ref='xml:lang' use='optional'/>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='show'>
       <xs:simpleType>
         <xs:restriction base='xs:NMTOKEN'>
           <xs:enumeration value='away'/>
           <xs:enumeration value='chat'/>
           <xs:enumeration value='dnd'/>
           <xs:enumeration value='xa'/>
         </xs:restriction>
       </xs:simpleType>
     </xs:element>
        
     <xs:element name='show'>
       <xs:simpleType>
         <xs:restriction base='xs:NMTOKEN'>
           <xs:enumeration value='away'/>
           <xs:enumeration value='chat'/>
           <xs:enumeration value='dnd'/>
           <xs:enumeration value='xa'/>
         </xs:restriction>
       </xs:simpleType>
     </xs:element>
        
     <xs:element name='status'>
       <xs:complexType>
         <xs:simpleContent>
           <xs:extension base='string1024'>
             <xs:attribute ref='xml:lang' use='optional'/>
           </xs:extension>
         </xs:simpleContent>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='status'>
       <xs:complexType>
         <xs:simpleContent>
           <xs:extension base='string1024'>
             <xs:attribute ref='xml:lang' use='optional'/>
           </xs:extension>
         </xs:simpleContent>
       </xs:complexType>
     </xs:element>
        
     <xs:simpleType name='string1024'>
       <xs:restriction base='xs:string'>
         <xs:minLength value='1'/>
         <xs:maxLength value='1024'/>
       </xs:restriction>
     </xs:simpleType>
        
     <xs:simpleType name='string1024'>
       <xs:restriction base='xs:string'>
         <xs:minLength value='1'/>
         <xs:maxLength value='1024'/>
       </xs:restriction>
     </xs:simpleType>
        
     <xs:element name='priority' type='xs:byte' default='0'/>
        
     <xs:element name='priority' type='xs:byte' default='0'/>
        
     <xs:element name='iq'>
       <xs:complexType>
         <xs:sequence>
           <xs:any namespace='##other'
                   minOccurs='0'
                   maxOccurs='1'
                   processContents='lax'/>
           <xs:element ref='error'
                       minOccurs='0'/>
         </xs:sequence>
         <xs:attribute name='from'
                       type='xs:string'
                       use='required'/>
        
     <xs:element name='iq'>
       <xs:complexType>
         <xs:sequence>
           <xs:any namespace='##other'
                   minOccurs='0'
                   maxOccurs='1'
                   processContents='lax'/>
           <xs:element ref='error'
                       minOccurs='0'/>
         </xs:sequence>
         <xs:attribute name='from'
                       type='xs:string'
                       use='required'/>
        
         <xs:attribute name='id'
                       type='xs:NMTOKEN'
                       use='required'/>
         <xs:attribute name='to'
                       type='xs:string'
                       use='required'/>
         <xs:attribute name='type' use='required'>
           <xs:simpleType>
             <xs:restriction base='xs:NMTOKEN'>
               <xs:enumeration value='error'/>
               <xs:enumeration value='get'/>
               <xs:enumeration value='result'/>
               <xs:enumeration value='set'/>
             </xs:restriction>
           </xs:simpleType>
         </xs:attribute>
         <xs:attribute ref='xml:lang' use='optional'/>
       </xs:complexType>
     </xs:element>
        
         <xs:attribute name='id'
                       type='xs:NMTOKEN'
                       use='required'/>
         <xs:attribute name='to'
                       type='xs:string'
                       use='required'/>
         <xs:attribute name='type' use='required'>
           <xs:simpleType>
             <xs:restriction base='xs:NMTOKEN'>
               <xs:enumeration value='error'/>
               <xs:enumeration value='get'/>
               <xs:enumeration value='result'/>
               <xs:enumeration value='set'/>
             </xs:restriction>
           </xs:simpleType>
         </xs:attribute>
         <xs:attribute ref='xml:lang' use='optional'/>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='error'>
       <xs:complexType>
         <xs:sequence xmlns:err='urn:ietf:params:xml:ns:xmpp-stanzas'>
           <xs:group ref='err:stanzaErrorGroup'/>
           <xs:element ref='err:text'
                       minOccurs='0'/>
         </xs:sequence>
         <xs:attribute name='by'
                       type='xs:string'
                       use='optional'/>
         <xs:attribute name='type' use='required'>
           <xs:simpleType>
             <xs:restriction base='xs:NMTOKEN'>
               <xs:enumeration value='auth'/>
               <xs:enumeration value='cancel'/>
               <xs:enumeration value='continue'/>
               <xs:enumeration value='modify'/>
               <xs:enumeration value='wait'/>
             </xs:restriction>
           </xs:simpleType>
         </xs:attribute>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='error'>
       <xs:complexType>
         <xs:sequence xmlns:err='urn:ietf:params:xml:ns:xmpp-stanzas'>
           <xs:group ref='err:stanzaErrorGroup'/>
           <xs:element ref='err:text'
                       minOccurs='0'/>
         </xs:sequence>
         <xs:attribute name='by'
                       type='xs:string'
                       use='optional'/>
         <xs:attribute name='type' use='required'>
           <xs:simpleType>
             <xs:restriction base='xs:NMTOKEN'>
               <xs:enumeration value='auth'/>
               <xs:enumeration value='cancel'/>
               <xs:enumeration value='continue'/>
               <xs:enumeration value='modify'/>
               <xs:enumeration value='wait'/>
             </xs:restriction>
           </xs:simpleType>
         </xs:attribute>
       </xs:complexType>
     </xs:element>
        
   </xs:schema>
        
   </xs:schema>
        
A.7. Resource Binding Namespace
A.7. 资源绑定命名空间
   <?xml version='1.0' encoding='UTF-8'?>
        
   <?xml version='1.0' encoding='UTF-8'?>
        
   <xs:schema
       xmlns:xs='http://www.w3.org/2001/XMLSchema'
       targetNamespace='urn:ietf:params:xml:ns:xmpp-bind'
       xmlns='urn:ietf:params:xml:ns:xmpp-bind'
       elementFormDefault='qualified'>
        
   <xs:schema
       xmlns:xs='http://www.w3.org/2001/XMLSchema'
       targetNamespace='urn:ietf:params:xml:ns:xmpp-bind'
       xmlns='urn:ietf:params:xml:ns:xmpp-bind'
       elementFormDefault='qualified'>
        
     <xs:element name='bind'>
       <xs:complexType>
         <xs:choice>
           <xs:element name='resource' type='resourceType'/>
           <xs:element name='jid' type='fullJIDType'/>
         </xs:choice>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='bind'>
       <xs:complexType>
         <xs:choice>
           <xs:element name='resource' type='resourceType'/>
           <xs:element name='jid' type='fullJIDType'/>
         </xs:choice>
       </xs:complexType>
     </xs:element>
        
     <xs:simpleType name='fullJIDType'>
       <xs:restriction base='xs:string'>
         <xs:minLength value='8'/>
         <xs:maxLength value='3071'/>
       </xs:restriction>
     </xs:simpleType>
        
     <xs:simpleType name='fullJIDType'>
       <xs:restriction base='xs:string'>
         <xs:minLength value='8'/>
         <xs:maxLength value='3071'/>
       </xs:restriction>
     </xs:simpleType>
        
     <xs:simpleType name='resourceType'>
       <xs:restriction base='xs:string'>
         <xs:minLength value='1'/>
         <xs:maxLength value='1023'/>
       </xs:restriction>
     </xs:simpleType>
        
     <xs:simpleType name='resourceType'>
       <xs:restriction base='xs:string'>
         <xs:minLength value='1'/>
         <xs:maxLength value='1023'/>
       </xs:restriction>
     </xs:simpleType>
        
   </xs:schema>
        
   </xs:schema>
        
A.8. Stanza Error Namespace
A.8. 节错误命名空间
   <?xml version='1.0' encoding='UTF-8'?>
        
   <?xml version='1.0' encoding='UTF-8'?>
        
   <xs:schema
       xmlns:xs='http://www.w3.org/2001/XMLSchema'
       targetNamespace='urn:ietf:params:xml:ns:xmpp-stanzas'
       xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'
       elementFormDefault='qualified'>
        
   <xs:schema
       xmlns:xs='http://www.w3.org/2001/XMLSchema'
       targetNamespace='urn:ietf:params:xml:ns:xmpp-stanzas'
       xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'
       elementFormDefault='qualified'>
        
     <xs:element name='bad-request' type='empty'/>
     <xs:element name='conflict' type='empty'/>
     <xs:element name='feature-not-implemented' type='empty'/>
        
     <xs:element name='bad-request' type='empty'/>
     <xs:element name='conflict' type='empty'/>
     <xs:element name='feature-not-implemented' type='empty'/>
        
     <xs:element name='forbidden' type='empty'/>
     <xs:element name='gone' type='xs:string'/>
     <xs:element name='internal-server-error' type='empty'/>
     <xs:element name='item-not-found' type='empty'/>
     <xs:element name='jid-malformed' type='empty'/>
     <xs:element name='not-acceptable' type='empty'/>
     <xs:element name='not-allowed' type='empty'/>
     <xs:element name='not-authorized' type='empty'/>
     <xs:element name='policy-violation' type='empty'/>
     <xs:element name='recipient-unavailable' type='empty'/>
     <xs:element name='redirect' type='xs:string'/>
     <xs:element name='registration-required' type='empty'/>
     <xs:element name='remote-server-not-found' type='empty'/>
     <xs:element name='remote-server-timeout' type='empty'/>
     <xs:element name='resource-constraint' type='empty'/>
     <xs:element name='service-unavailable' type='empty'/>
     <xs:element name='subscription-required' type='empty'/>
     <xs:element name='undefined-condition' type='empty'/>
     <xs:element name='unexpected-request' type='empty'/>
        
     <xs:element name='forbidden' type='empty'/>
     <xs:element name='gone' type='xs:string'/>
     <xs:element name='internal-server-error' type='empty'/>
     <xs:element name='item-not-found' type='empty'/>
     <xs:element name='jid-malformed' type='empty'/>
     <xs:element name='not-acceptable' type='empty'/>
     <xs:element name='not-allowed' type='empty'/>
     <xs:element name='not-authorized' type='empty'/>
     <xs:element name='policy-violation' type='empty'/>
     <xs:element name='recipient-unavailable' type='empty'/>
     <xs:element name='redirect' type='xs:string'/>
     <xs:element name='registration-required' type='empty'/>
     <xs:element name='remote-server-not-found' type='empty'/>
     <xs:element name='remote-server-timeout' type='empty'/>
     <xs:element name='resource-constraint' type='empty'/>
     <xs:element name='service-unavailable' type='empty'/>
     <xs:element name='subscription-required' type='empty'/>
     <xs:element name='undefined-condition' type='empty'/>
     <xs:element name='unexpected-request' type='empty'/>
        
     <xs:group name='stanzaErrorGroup'>
       <xs:choice>
         <xs:element ref='bad-request'/>
         <xs:element ref='conflict'/>
         <xs:element ref='feature-not-implemented'/>
         <xs:element ref='forbidden'/>
         <xs:element ref='gone'/>
         <xs:element ref='internal-server-error'/>
         <xs:element ref='item-not-found'/>
         <xs:element ref='jid-malformed'/>
         <xs:element ref='not-acceptable'/>
         <xs:element ref='not-authorized'/>
         <xs:element ref='not-allowed'/>
         <xs:element ref='policy-violation'/>
         <xs:element ref='recipient-unavailable'/>
         <xs:element ref='redirect'/>
         <xs:element ref='registration-required'/>
         <xs:element ref='remote-server-not-found'/>
         <xs:element ref='remote-server-timeout'/>
         <xs:element ref='resource-constraint'/>
         <xs:element ref='service-unavailable'/>
         <xs:element ref='subscription-required'/>
         <xs:element ref='undefined-condition'/>
         <xs:element ref='unexpected-request'/>
       </xs:choice>
     </xs:group>
        
     <xs:group name='stanzaErrorGroup'>
       <xs:choice>
         <xs:element ref='bad-request'/>
         <xs:element ref='conflict'/>
         <xs:element ref='feature-not-implemented'/>
         <xs:element ref='forbidden'/>
         <xs:element ref='gone'/>
         <xs:element ref='internal-server-error'/>
         <xs:element ref='item-not-found'/>
         <xs:element ref='jid-malformed'/>
         <xs:element ref='not-acceptable'/>
         <xs:element ref='not-authorized'/>
         <xs:element ref='not-allowed'/>
         <xs:element ref='policy-violation'/>
         <xs:element ref='recipient-unavailable'/>
         <xs:element ref='redirect'/>
         <xs:element ref='registration-required'/>
         <xs:element ref='remote-server-not-found'/>
         <xs:element ref='remote-server-timeout'/>
         <xs:element ref='resource-constraint'/>
         <xs:element ref='service-unavailable'/>
         <xs:element ref='subscription-required'/>
         <xs:element ref='undefined-condition'/>
         <xs:element ref='unexpected-request'/>
       </xs:choice>
     </xs:group>
        
     <xs:element name='text'>
       <xs:complexType>
         <xs:simpleContent>
           <xs:extension base='xs:string'>
             <xs:attribute ref='xml:lang' use='optional'/>
           </xs:extension>
         </xs:simpleContent>
       </xs:complexType>
     </xs:element>
        
     <xs:element name='text'>
       <xs:complexType>
         <xs:simpleContent>
           <xs:extension base='xs:string'>
             <xs:attribute ref='xml:lang' use='optional'/>
           </xs:extension>
         </xs:simpleContent>
       </xs:complexType>
     </xs:element>
        
     <xs:simpleType name='empty'>
       <xs:restriction base='xs:string'>
         <xs:enumeration value=''/>
       </xs:restriction>
     </xs:simpleType>
        
     <xs:simpleType name='empty'>
       <xs:restriction base='xs:string'>
         <xs:enumeration value=''/>
       </xs:restriction>
     </xs:simpleType>
        
   </xs:schema>
        
   </xs:schema>
        
Appendix B. Contact Addresses
附录B.联系地址

Consistent with [MAILBOXES], organization that offer XMPP services are encouraged to provide an Internet mailbox of "XMPP" for inquiries related to that service, where the host portion of the resulting mailto URI is the organization's domain, not the domain of the XMPP service itself (e.g., the XMPP service might be offered at im.example.com but the Internet mailbox would be <xmpp@example.com>).

与[邮箱]一致,建议提供XMPP服务的组织为与该服务相关的查询提供一个“XMPP”的Internet邮箱,其中生成的mailto URI的主机部分是该组织的域,而不是XMPP服务本身的域(例如,可以在im.example.com上提供XMPP服务,但Internet邮箱将是<xmpp@example.com>).

Appendix C. Account Provisioning
附录C.账户准备金

Account provisioning is out of scope for this specification. Possible methods for account provisioning include account creation by a server administrator and in-band account registration using the 'jabber:iq:register' namespace as documented in [XEP-0077]. An XMPP server implementation or administrative function MUST ensure that any JID assigned during account provisioning (including localpart, domainpart, resourcepart, and separator characters) conforms to the canonical format for XMPP addresses defined in [XMPP-ADDR].

帐户设置超出此规范的范围。帐户设置的可能方法包括由服务器管理员创建帐户和使用[XEP-0077]中记录的“jabber:iq:register”命名空间进行带内帐户注册。XMPP服务器实现或管理功能必须确保在帐户设置期间分配的任何JID(包括localpart、domainpart、resourcepart和分隔符)符合[XMPP-ADDR]中定义的XMPP地址的规范格式。

Appendix D. Differences from RFC 3920
附录D.与RFC 3920的差异

Based on consensus derived from implementation and deployment experience as well as formal interoperability testing, the following substantive modifications were made from RFC 3920 (in addition to numerous changes of an editorial nature).

基于从实施和部署经验以及正式互操作性测试中得出的共识,RFC 3920进行了以下实质性修改(除了编辑性质的许多更改)。

o Moved specification of the XMPP address format to a separate document.

o 将XMPP地址格式的规范移动到单独的文档中。

o Recommended or mandated use of the 'from' and 'to' attributes on stream headers.

o 建议或强制在流标头上使用“from”和“to”属性。

o More fully specified the stream closing handshake.

o 更全面地指定了流结束握手。

o Specified the recommended stream reconnection algorithm.

o 指定了建议的流重新连接算法。

o Changed the name of the <xml-not-well-formed/> stream error condition to <not-well-formed/> for compliance with the XML specification.

o 将<xml格式不正确/>流错误条件的名称更改为<not well format/>,以符合xml规范。

o Removed the unnecessary and unused <invalid-id/> stream error (see RFC 3920 for historical documentation).

o 删除了不必要和未使用的<invalid id/>流错误(有关历史文档,请参阅RFC 3920)。

o Specified return of the <restricted-xml/> stream error in response to receipt of prohibited XML features.

o 指定返回<restricted xml/>流错误,以响应收到禁止的xml功能。

o More completely specified the format and handling of the <see-other-host/> stream error, including consistency with RFC 3986 and RFC 5952 with regard to IPv6 addresses (e.g., enclosing the IPv6 address in square brackets '[' and ']').

o 更完整地指定了<see other host/>流错误的格式和处理,包括与RFC 3986和RFC 5952在IPv6地址方面的一致性(例如,将IPv6地址括在方括号“[”和“]”中)。

o Specified that the SASL SCRAM mechanism is a mandatory-to-implement technology for client-to-server streams.

o 指定必须使用SASL紧急停堆机制来实现客户端到服务器流的技术。

o Specified that TLS plus the SASL PLAIN mechanism is a mandatory-to-implement technology for client-to-server streams.

o 指定TLS和SASL普通机制是实现客户机到服务器流技术的必需机制。

o Specified that support for the SASL EXTERNAL mechanism is required for servers but only recommended for clients (since end-user X.509 certificates are difficult to obtain and not yet widely deployed).

o 指定服务器需要支持SASL外部机制,但仅建议客户端支持(因为最终用户X.509证书很难获得,而且尚未广泛部署)。

o Removed the hard two-connection rule for server-to-server streams.

o 删除了服务器到服务器流的硬连接规则。

o More clearly specified the certificate profile for both public key certificates and issuer certificates.

o 更明确地指定公钥证书和颁发者证书的证书配置文件。

o Added the <reset/> stream error (Section 4.9.3.16) condition to handle expired/revoked certificates or the addition of security-critical features to an existing stream.

o 添加了<reset/>流错误(第4.9.3.16节)条件,以处理过期/吊销的证书,或向现有流添加安全关键功能。

o Added the <account-disabled/>, <credentials-expired/>, <encryption-required/>, and <malformed-request/> SASL error conditions to handle error flows mistakenly left out of RFC 3920 or discussed in RFC 4422 but not in RFC 2222.

o 添加了<account disabled/>、<credentials expired/>、<encryption required/>和<malformed request/>SASL错误条件,以处理RFC 3920中错误遗漏或RFC 4422中讨论但RFC 2222中未讨论的错误流。

o Removed the unused <payment-required/> stanza error.

o 删除了未使用的<payment required/>节错误。

o Removed the unnecessary requirement for escaping of characters that map to certain predefined entities, since they do not need to be escaped in XML.

o 删除了对映射到某些预定义实体的字符进行转义的不必要要求,因为它们不需要在XML中转义。

o Clarified the process of DNS SRV lookups and fallbacks.

o 阐明了DNS SRV查找和回退的过程。

o Clarified the handling of SASL security layers.

o 阐明了SASL安全层的处理。

o Clarified that a SASL simple user name is the localpart, not the bare JID.

o 阐明了SASL简单用户名是localpart,而不是裸JID。

o Clarified the stream negotiation process and associated flow chart.

o 阐明了流程协商流程和相关流程图。

o Clarified the handling of stream features.

o 阐明了流特征的处理。

o Added a 'by' attribute to the <error/> element for stanza errors so that the entity that has detected the error can include its JID for diagnostic or tracking purposes.

o 在节错误的<error/>元素中添加了一个“by”属性,以便检测到错误的实体可以包含其JID以用于诊断或跟踪目的。

o Clarified the handling of data that violates the well-formedness definitions for XML 1.0 and XML namespaces.

o 阐明了对违反XML 1.0和XML名称空间良好格式定义的数据的处理。

o Specified the security considerations in more detail, especially with regard to presence leaks and denial-of-service attacks.

o 详细说明了安全注意事项,特别是存在漏洞和拒绝服务攻击。

o Moved documentation of the Server Dialback protocol from this specification to a separate specification maintained by the XMPP Standards Foundation.

o 将服务器拨号协议从本规范移动到XMPP标准基金会维护的单独规范。

Appendix E. Acknowledgements
附录E.确认书

This document is an update to, and derived from, RFC 3920. This document would have been impossible without the work of the contributors and commenters acknowledged there.

本文件是对RFC 3920的更新,源于RFC 3920。如果没有撰稿人和评论人的工作,这份文件是不可能的。

Hundreds of people have provided implementation feedback, bug reports, requests for clarification, and suggestions for improvement since publication of RFC 3920. Although the document editor has endeavored to address all such feedback, he is solely responsible for any remaining errors and ambiguities.

自RFC3920发布以来,已有数百人提供了实施反馈、错误报告、澄清请求和改进建议。尽管文档编辑已尽力处理所有此类反馈,但他对任何剩余的错误和含糊之处概不负责。

Special thanks are due to Kevin Smith, Matthew Wild, Dave Cridland, Philipp Hancke, Waqas Hussain, Florian Zeitz, Ben Campbell, Jehan Pages, Paul Aurich, Justin Karneges, Kurt Zeilenga, Simon Josefsson, Ralph Meijer, Curtis King, and others for their comments during Working Group Last Call.

特别感谢Kevin Smith、Matthew Wild、Dave Cridland、Philipp Hancke、Waqas Hussain、Florian Zeitz、Ben Campbell、Jehan Pages、Paul Aurich、Justin Karneges、Kurt Zeilenga、Simon Josefsson、Ralph Meijer、Curtis King和其他人在工作组最后一次通话中发表的评论。

Thanks also to Yaron Sheffer and Elwyn Davies for their reviews on behalf of the Security Directorate and the General Area Review Team, respectively.

还感谢Yaron Sheffer和Elwyn Davies分别代表安全理事会和一般区域审查小组进行审查。

The Working Group chairs were Ben Campbell and Joe Hildebrand. The responsible Area Director was Gonzalo Camarillo.

工作组主席是本·坎贝尔和乔·希尔德布兰德。负责区域的主管是冈萨洛·卡马里洛。

Author's Address

作者地址

Peter Saint-Andre Cisco 1899 Wyknoop Street, Suite 600 Denver, CO 80202 USA

美国科罗拉多州丹佛市怀诺普街1899号600室彼得·圣安德烈思科公司80202

   Phone: +1-303-308-3282
   EMail: psaintan@cisco.com
        
   Phone: +1-303-308-3282
   EMail: psaintan@cisco.com