Permalink
1213 lines (1079 sloc) 97.3 KB
<!DOCTYPE html><html lang="en" dir="ltr" typeof="bibo:Document" prefix="bibo: http://purl.org/ontology/bibo/ w3p: http://www.w3.org/2001/02pd/rec54#"><head><meta charset="utf-8"><meta name="generator" content="ReSpec 19.0.1"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><style>/* --- EXAMPLES --- */
div.example-title {
min-width: 7.5em;
color: #b9ab2d;
}
div.example-title span {
text-transform: uppercase;
}
aside.example, div.example, div.illegal-example {
padding: 0.5em;
margin: 1em 0;
position: relative;
clear: both;
}
div.illegal-example { color: red }
div.illegal-example p { color: black }
aside.example, div.example {
padding: .5em;
border-left-width: .5em;
border-left-style: solid;
border-color: #e0cb52;
background: #fcfaee;
}
aside.example div.example {
border-left-width: .1em;
border-color: #999;
background: #fff;
}
aside.example div.example div.example-title {
color: #999;
}
</style><style>/* --- ISSUES/NOTES --- */
div.issue-title, div.note-title , div.ednote-title, div.warning-title {
padding-right: 1em;
min-width: 7.5em;
color: #b9ab2d;
}
div.issue-title { color: #e05252; }
div.note-title, div.ednote-title { color: #2b2; }
div.warning-title { color: #f22; }
div.issue-title span, div.note-title span, div.ednote-title span, div.warning-title span {
text-transform: uppercase;
}
div.note, div.issue, div.ednote, div.warning {
margin-top: 1em;
margin-bottom: 1em;
}
.note > p:first-child, .ednote > p:first-child, .issue > p:first-child, .warning > p:first-child { margin-top: 0 }
.issue, .note, .ednote, .warning {
padding: .5em;
border-left-width: .5em;
border-left-style: solid;
}
div.issue, div.note , div.ednote, div.warning {
padding: 1em 1.2em 0.5em;
margin: 1em 0;
position: relative;
clear: both;
}
span.note, span.ednote, span.issue, span.warning { padding: .1em .5em .15em; }
.issue {
border-color: #e05252;
background: #fbe9e9;
}
.note, .ednote {
border-color: #52e052;
background: #e9fbe9;
}
.warning {
border-color: #f11;
border-width: .2em;
border-style: solid;
background: #fbe9e9;
}
.warning-title:before{
content: ""; /*U+26A0 WARNING SIGN*/
font-size: 3em;
float: left;
height: 100%;
padding-right: .3em;
vertical-align: top;
margin-top: -0.5em;
}
li.task-list-item {
list-style: none;
}
input.task-list-item-checkbox {
margin: 0 0.35em 0.25em -1.6em;
vertical-align: middle;
}
</style>
<meta lang="" property="dc:language" content="en">
<title>WebSub</title>
<link rel="stylesheet" href="https://www.w3.org/StyleSheets/TR/W3C-WD">
<link rel="pingback" href="https://webmention.io/w3c/xmlrpc">
<link rel="webmention" href="https://webmention.io/w3c/webmention">
<style id="respec-mainstyle">/*****************************************************************
* ReSpec 3 CSS
* Robin Berjon - http://berjon.com/
*****************************************************************/
/* Override code highlighter background */
.hljs {
background: transparent !important;
}
/* --- INLINES --- */
h1 abbr,
h2 abbr,
h3 abbr,
h4 abbr,
h5 abbr,
h6 abbr,
a abbr {
border: none;
}
dfn {
font-weight: bold;
}
a.internalDFN {
color: inherit;
border-bottom: 1px solid #99c;
text-decoration: none;
}
a.externalDFN {
color: inherit;
border-bottom: 1px dotted #ccc;
text-decoration: none;
}
a.bibref {
text-decoration: none;
}
cite .bibref {
font-style: normal;
}
code {
color: #c83500;
}
th code {
color: inherit;
}
/* --- TOC --- */
.toc a,
.tof a {
text-decoration: none;
}
a .secno,
a .figno {
color: #000;
}
ul.tof,
ol.tof {
list-style: none outside none;
}
.caption {
margin-top: 0.5em;
font-style: italic;
}
/* --- TABLE --- */
table.simple {
border-spacing: 0;
border-collapse: collapse;
border-bottom: 3px solid #005a9c;
}
.simple th {
background: #005a9c;
color: #fff;
padding: 3px 5px;
text-align: left;
}
.simple th[scope="row"] {
background: inherit;
color: inherit;
border-top: 1px solid #ddd;
}
.simple td {
padding: 3px 10px;
border-top: 1px solid #ddd;
}
.simple tr:nth-child(even) {
background: #f0f6ff;
}
/* --- DL --- */
.section dd > p:first-child {
margin-top: 0;
}
.section dd > p:last-child {
margin-bottom: 0;
}
.section dd {
margin-bottom: 1em;
}
.section dl.attrs dd,
.section dl.eldef dd {
margin-bottom: 0;
}
#issue-summary > ul,
.respec-dfn-list {
column-count: 2;
}
#issue-summary li,
.respec-dfn-list li {
list-style: none;
}
details.respec-tests-details {
margin-left: 1em;
display: inline-block;
vertical-align: top;
}
details.respec-tests-details > * {
padding-right: 2em;
}
details.respec-tests-details[open] {
z-index: 999999;
position: absolute;
border: thin solid #cad3e2;
border-radius: .3em;
background-color: white;
padding-bottom: .5em;
}
details.respec-tests-details[open] > summary {
border-bottom: thin solid #cad3e2;
padding-left: 1em;
margin-bottom: 1em;
line-height: 2em;
}
details.respec-tests-details > ul {
width: 100%;
margin-top: -0.3em;
}
details.respec-tests-details > li {
padding-left: 1em;
}
@media print {
.removeOnSave {
display: none;
}
}
</style><style>/*
github.com style (c) Vasily Polovnyov <vast@whiteants.net>
*/
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
color: #333;
background: #f8f8f8;
}
.hljs-comment,
.hljs-quote {
color: #998;
font-style: italic;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-subst {
color: #333;
font-weight: bold;
}
.hljs-number,
.hljs-literal,
.hljs-variable,
.hljs-template-variable,
.hljs-tag .hljs-attr {
color: #008080;
}
.hljs-string,
.hljs-doctag {
color: #d14;
}
.hljs-title,
.hljs-section,
.hljs-selector-id {
color: #900;
font-weight: bold;
}
.hljs-subst {
font-weight: normal;
}
.hljs-type,
.hljs-class .hljs-title {
color: #458;
font-weight: bold;
}
.hljs-tag,
.hljs-name,
.hljs-attribute {
color: #000080;
font-weight: normal;
}
.hljs-regexp,
.hljs-link {
color: #009926;
}
.hljs-symbol,
.hljs-bullet {
color: #990073;
}
.hljs-built_in,
.hljs-builtin-name {
color: #0086b3;
}
.hljs-meta {
color: #999;
font-weight: bold;
}
.hljs-deletion {
background: #fdd;
}
.hljs-addition {
background: #dfd;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}
</style><link rel="stylesheet" href="https://www.w3.org/StyleSheets/TR/2016/W3C-ED"><link rel="canonical" href="https://www.w3.org/TR/websub/"><script id="initialUserConfig" type="application/json">{
"specStatus": "ED",
"publishDate": "2017-12-19",
"shortName": "websub",
"editors": [
{
"name": "Julien Genestoux",
"company": "Invited Expert",
"url": "https://www.ouvre-boite.com/",
"w3cid": "49792"
},
{
"name": "Aaron Parecki",
"company": "Invited Expert",
"url": "https://aaronparecki.com/",
"w3cid": "59996"
}
],
"authors": [
{
"name": "Julien Genestoux"
}
],
"previousMaturity": "PR",
"previousPublishDate": "2017-10-03",
"edDraftURI": "https://websub.net/draft",
"testSuiteURI": "https://websub.rocks/",
"implementationReportURI": "https://websub.net/implementation-reports",
"errata": "https://websub.net/errata",
"wg": "Social Web Working Group",
"wgURI": "https://www.w3.org/Social/WG",
"wgPublicList": "public-socialweb",
"wgPatentURI": "https://www.w3.org/2004/01/pp-impl/72531/status",
"otherLinks": [
{
"key": "Past Authors",
"data": [
{
"value": "Brad Fitzpatrick",
"href": "https://bradfitz.com/"
},
{
"value": "Brett Slatkin",
"href": "http://www.onebigfluke.com/"
},
{
"value": "Martin Atkins",
"href": "http://martin.atkins.me.uk/"
}
]
},
{
"key": "Repository",
"data": [
{
"value": "Github",
"href": "https://github.com/w3c/websub"
},
{
"value": "Issues",
"href": "https://github.com/w3c/websub/issues"
},
{
"value": "Commits",
"href": "https://github.com/w3c/websub/commits/master"
}
]
}
],
"localBiblio": {
"PubSubHubbub-Core-0.3": {
"title": "PubSubHubbub Core 0.3 -- Working Draft",
"href": "https://pubsubhubbub.github.io/PubSubHubbub/pubsubhubbub-core-0.3.html",
"authors": [
"B. Fitzpatrick",
"B. Slatkin",
"M. Atkins"
]
},
"PubSubHubbub-Core-0.4": {
"title": "PubSubHubbub Core 0.4 -- Working Draft",
"href": "https://pubsubhubbub.github.io/PubSubHubbub/pubsubhubbub-core-0.4.html",
"authors": [
"B. Fitzpatrick",
"B. Slatkin",
"M. Atkins",
"J. Genestoux"
]
},
"XEP-0060": {
"title": "Publish-Subscribe",
"href": "http://www.xmpp.org/extensions/xep-0060.html",
"authors": [
"Peter Millard",
"Peter Saint-Andre",
"Ralph Meijer"
],
"status": "Draft",
"publisher": "XMPP Standards Foundation"
},
"RSS-2.0": {
"title": "RSS 2.0",
"href": "http://www.rssboard.org/rss-specification",
"authors": [
"Dave Winer"
],
"status": "Stable",
"publisher": "RSS Board"
},
"FIPS-PUB-180-4": {
"title": "Secure Hash Standard (SHS)",
"href": "http://dx.doi.org/10.6028/NIST.FIPS.180-4",
"authors": [
"National Institute of Standards and Technology"
],
"publisher": "U.S. Department of Commerce"
},
"URL": {
"title": "URL Standard",
"href": "https://url.spec.whatwg.org/",
"authors": [
"Anne van Kesteren"
],
"status": "Living Standard",
"publisher": "WHATWG"
}
},
"publishISODate": "2017-12-19T00:00:00.000Z",
"generatedSubtitle": "Editor's Draft 19 December 2017"
}</script><meta name="description" content="WebSub provides a common mechanism for communication between publishers of any kind of Web content and their subscribers, based on HTTP web hooks. Subscription requests are relayed through hubs, which validate and verify the request. Hubs then distribute new and updated content to subscribers when it becomes available. WebSub was previously known as PubSubHubbub."></head>
<body aria-busy="false" class="h-entry"><div class="head">
<p>
<a class="logo" href="https://www.w3.org/"><img width="72" height="48" src="https://www.w3.org/StyleSheets/TR/2016/logos/W3C" alt="W3C"></a>
</p>
<p><!--_hyper: 167453307;--></p>
<h1 class="title p-name" id="title">WebSub</h1>
<h2 id="w3c-editor-s-draft-19-december-2017"><abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft <time class="dt-published" datetime="2017-12-19">19 December 2017</time></h2>
<dl>
<dt>This version:</dt>
<dd><a class="u-url" href="https://websub.net/draft">https://websub.net/draft</a></dd>
<dt>Latest published version:</dt>
<dd><a href="https://www.w3.org/TR/websub/">https://www.w3.org/TR/websub/</a></dd>
<dt>Latest editor's draft:</dt>
<dd><a href="https://websub.net/draft">https://websub.net/draft</a></dd>
<dt>Test suite:</dt>
<dd><a href="https://websub.rocks/">https://websub.rocks/</a></dd>
<dt>Implementation report:</dt>
<dd><a href="https://websub.net/implementation-reports">https://websub.net/implementation-reports</a></dd>
<dt>Editors:</dt>
<dd class="p-author h-card vcard" data-editor-id="49792"><a class="u-url url p-name fn" href="https://www.ouvre-boite.com/">Julien Genestoux</a>, Invited Expert</dd>
<dd class="p-author h-card vcard" data-editor-id="59996"><a class="u-url url p-name fn" href="https://aaronparecki.com/">Aaron Parecki</a>, Invited Expert</dd>
<dt>Author:</dt>
<dd class="p-author h-card vcard"><span class="p-name fn">Julien Genestoux</span></dd>
<dt>Past Authors:</dt>
<dd>
<a href="https://bradfitz.com/">
Brad Fitzpatrick
</a>
</dd>
<dd>
<a href="http://www.onebigfluke.com/">
Brett Slatkin
</a>
</dd>
<dd>
<a href="http://martin.atkins.me.uk/">
Martin Atkins
</a>
</dd>
<dt>Repository:</dt>
<dd>
<a href="https://github.com/w3c/websub">
Github
</a>
</dd>
<dd>
<a href="https://github.com/w3c/websub/issues">
Issues
</a>
</dd>
<dd>
<a href="https://github.com/w3c/websub/commits/master">
Commits
</a>
</dd>
</dl>
<p>
Please check the <a href="https://websub.net/errata"><strong>errata</strong></a> for any errors or issues
reported since publication.
</p>
<p class="copyright">
<a href="https://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> ©
2017
<a href="https://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup>
(<a href="https://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>,
<a href="https://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>,
<a href="https://www.keio.ac.jp/">Keio</a>, <a href="http://ev.buaa.edu.cn/">Beihang</a>).
<abbr title="World Wide Web Consortium">W3C</abbr> <a href="https://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
<a href="https://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and
<a rel="license" href="https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document">permissive document license</a>
rules apply.
</p>
<hr title="Separator for header">
</div>
<section id="abstract" class="introductory"><h2 id="abstract-0">Abstract</h2>
<p>WebSub provides a common mechanism for communication between publishers of any kind of Web content and their subscribers, based on HTTP web hooks. Subscription requests are relayed through hubs, which validate and verify the request. Hubs then distribute new and updated content to subscribers when it becomes available. WebSub was previously known as PubSubHubbub.</p>
</section>
<section id="sotd" class="introductory"><h2 id="status-of-this-document">Status of This Document</h2>
<p>
<em>This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current <abbr title="World Wide Web Consortium">W3C</abbr> publications and the latest revision of this technical report can be found in the <a href="https://www.w3.org/TR/"><abbr title="World Wide Web Consortium">W3C</abbr> technical reports index</a> at https://www.w3.org/TR/.</em>
</p>
<p>
This document was published by the <a href="https://www.w3.org/Social/WG">Social Web Working Group</a> as an Editor's Draft.
Comments regarding this document are welcome. Please send them to
<a href="mailto:public-socialweb@w3.org">public-socialweb@w3.org</a>
(<a href="mailto:public-socialweb-request@w3.org?subject=subscribe">subscribe</a>,
<a href="https://lists.w3.org/Archives/Public/public-socialweb/">archives</a>).
</p>
<p>
Please see the Working Group's <a href="https://websub.net/implementation-reports">implementation
report</a>.
</p>
<p>
Publication as an Editor's Draft does not imply endorsement by the <abbr title="World Wide Web Consortium">W3C</abbr>
Membership. This is a draft document and may be updated, replaced or obsoleted by other
documents at any time. It is inappropriate to cite this document as other than work in
progress.
</p>
<p>
This document was produced by
a group
operating under the
<a href="https://www.w3.org/Consortium/Patent-Policy/"><abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>.
<abbr title="World Wide Web Consortium">W3C</abbr> maintains a <a href="https://www.w3.org/2004/01/pp-impl/72531/status" rel="disclosure">public list of any patent
disclosures</a>
made in connection with the deliverables of
the group; that page also includes
instructions for disclosing a patent. An individual who has actual knowledge of a patent
which the individual believes contains
<a href="https://www.w3.org/Consortium/Patent-Policy/#def-essential">Essential
Claim(s)</a> must disclose the information in accordance with
<a href="https://www.w3.org/Consortium/Patent-Policy/#sec-Disclosure">section
6 of the <abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>.
</p>
<p>This document is governed by the <a id="w3c_process_revision" href="https://www.w3.org/2017/Process-20170301/">1 March 2017 <abbr title="World Wide Web Consortium">W3C</abbr> Process Document</a>.
</p>
</section><nav id="toc"><h2 class="introductory" id="table-of-contents">Table of Contents</h2><ol class="toc"><li class="tocline"><a href="#definitions" class="tocxref"><span class="secno">1. </span>Definitions</a></li><li class="tocline"><a href="#high-level-protocol-flow" class="tocxref"><span class="secno">2. </span>High-level protocol flow</a></li><li class="tocline"><a href="#conformance" class="tocxref"><span class="secno">3. </span>Conformance</a><ol class="toc"><li class="tocline"><a href="#conformance-classes" class="tocxref"><span class="secno">3.1 </span>Conformance Classes</a></li><li class="tocline"><a href="#candidate-recommendation-exit-criteria" class="tocxref"><span class="secno">3.2 </span>Candidate Recommendation Exit Criteria</a><ol class="toc"><li class="tocline"><a href="#publisher" class="tocxref"><span class="secno">3.2.1 </span>Publisher</a></li><li class="tocline"><a href="#subscriber" class="tocxref"><span class="secno">3.2.2 </span>Subscriber</a></li><li class="tocline"><a href="#hub" class="tocxref"><span class="secno">3.2.3 </span>Hub</a></li><li class="tocline"><a href="#independent" class="tocxref"><span class="secno">3.2.4 </span>Independent</a></li><li class="tocline"><a href="#interoperable" class="tocxref"><span class="secno">3.2.5 </span>Interoperable</a></li><li class="tocline"><a href="#feature" class="tocxref"><span class="secno">3.2.6 </span>Feature</a></li></ol></li></ol></li><li class="tocline"><a href="#discovery" class="tocxref"><span class="secno">4. </span>Discovery</a><ol class="toc"><li class="tocline"><a href="#content-negotiation" class="tocxref"><span class="secno">4.1 </span>Content Negotiation</a></li></ol></li><li class="tocline"><a href="#subscribing-and-unsubscribing" class="tocxref"><span class="secno">5. </span>Subscribing and Unsubscribing</a><ol class="toc"><li class="tocline"><a href="#subscriber-sends-subscription-request" class="tocxref"><span class="secno">5.1 </span>Subscriber Sends Subscription Request</a><ol class="toc"><li class="tocline"><a href="#subscription-parameter-details" class="tocxref"><span class="secno">5.1.1 </span>Subscription Parameter Details</a></li><li class="tocline"><a href="#subscription-response-details" class="tocxref"><span class="secno">5.1.2 </span>Subscription Response Details</a></li></ol></li><li class="tocline"><a href="#subscription-validation" class="tocxref"><span class="secno">5.2 </span>Subscription Validation</a></li><li class="tocline"><a href="#hub-verifies-intent" class="tocxref"><span class="secno">5.3 </span>Hub Verifies Intent of the Subscriber</a><ol class="toc"><li class="tocline"><a href="#verification-details" class="tocxref"><span class="secno">5.3.1 </span>Verification Details</a></li></ol></li></ol></li><li class="tocline"><a href="#publishing" class="tocxref"><span class="secno">6. </span>Publishing</a><ol class="toc"><li class="tocline"><a href="#subscription-migration" class="tocxref"><span class="secno">6.1 </span>Subscription Migration</a></li></ol></li><li class="tocline"><a href="#content-distribution" class="tocxref"><span class="secno">7. </span>Content Distribution</a><ol class="toc"><li class="tocline"><a href="#signing-content" class="tocxref"><span class="secno">7.1 </span>Authenticated Content Distribution</a><ol class="toc"><li class="tocline"><a href="#recognized-algorithm-names" class="tocxref"><span class="secno">7.1.1 </span>Recognized algorithm names</a></li><li class="tocline"><a href="#signature-validation" class="tocxref"><span class="secno">7.1.2 </span>Signature validation</a></li></ol></li></ol></li><li class="tocline"><a href="#security-considerations" class="tocxref"><span class="secno">8. </span>Security Considerations</a><ol class="toc"><li class="tocline"><a href="#discovery-0" class="tocxref"><span class="secno">8.1 </span>Discovery</a></li><li class="tocline"><a href="#subscriptions" class="tocxref"><span class="secno">8.2 </span>Subscriptions</a></li><li class="tocline"><a href="#distribution" class="tocxref"><span class="secno">8.3 </span>Distribution</a></li><li class="tocline"><a href="#security-and-privacy-review" class="tocxref"><span class="secno">8.4 </span>Security and Privacy Review</a></li></ol></li><li class="tocline"><a href="#acknowledgements" class="tocxref"><span class="secno">A. </span>Acknowledgements</a></li><li class="tocline"><a href="#change-log" class="tocxref"><span class="secno">B. </span>Change Log</a><ol class="toc"><li class="tocline"><a href="#changes-from-03-october-2017-pr-to-this-version" class="tocxref"><span class="secno">B.1 </span>Changes from 03 October 2017 PR to this version</a></li><li class="tocline"><a href="#changes-from-11-april-2017-cr-to-03-october-2017-pr" class="tocxref"><span class="secno">B.2 </span>Changes from 11 April 2017 CR to 03 October 2017 PR</a></li><li class="tocline"><a href="#changes-from-24-november-wd-to-11-april-2017-cr" class="tocxref"><span class="secno">B.3 </span>Changes from 24 November WD to 11 April 2017 CR</a></li><li class="tocline"><a href="#changes-from-20-october-fpwd-to-24-november-2016" class="tocxref"><span class="secno">B.4 </span>Changes from 20 October FPWD to 24 November 2016</a></li></ol></li><li class="tocline"><a href="#references" class="tocxref"><span class="secno">C. </span>References</a><ol class="toc"><li class="tocline"><a href="#normative-references" class="tocxref"><span class="secno">C.1 </span>Normative references</a></li><li class="tocline"><a href="#informative-references" class="tocxref"><span class="secno">C.2 </span>Informative references</a></li></ol></li></ol></nav>
<section id="definitions">
<!--OddPage--><h2 id="x1-definitions"><span class="secno">1. </span>Definitions</h2>
<dl>
<dt><dfn data-dfn-type="dfn" id="dfn-topic">Topic</dfn></dt>
<dd>An HTTP [<cite><a class="bibref" href="#bib-RFC7230">RFC7230</a></cite>] (or HTTPS [<cite><a class="bibref" href="#bib-RFC2818">RFC2818</a></cite>]) resource URL. The unit to which one can subscribe to changes.</dd>
<dt><dfn data-dfn-type="dfn" id="dfn-hub-the-hub">Hub ("the hub")</dfn></dt>
<dd>The server (URL [<cite><a class="bibref" href="#bib-URL">URL</a></cite>]) which implements both sides of this protocol. Any hub <em class="rfc2119" title="MAY">MAY</em> implement its own policies on who can use it.</dd>
<dt><dfn data-dfn-type="dfn" id="dfn-publisher">Publisher</dfn></dt>
<dd>An owner of a topic. Notifies the hub when the topic feed has been updated. As in almost all pubsub systems, the publisher is unaware of the subscribers, if any. Other pubsub systems might call the publisher the "source".</dd>
<dt><dfn data-dfn-type="dfn" id="dfn-subscriber">Subscriber</dfn></dt>
<dd>An entity (person or program) that wants to be notified of changes on a topic. The subscriber must be directly network-accessible and is identified by its Subscriber Callback URL. </dd>
<dt><dfn data-dfn-type="dfn" id="dfn-subscription">Subscription</dfn></dt>
<dd>A unique relation to a topic by a subscriber that indicates it should receive updates for that topic. A subscription's unique key is the tuple (Topic URL, Subscriber Callback URL). Subscriptions may (at the hub's decision) have expiration times akin to DHCP leases which must be periodically renewed. </dd>
<dt><dfn data-dfn-type="dfn" id="dfn-subscriber-callback-url">Subscriber Callback URL</dfn></dt>
<dd>The URL [<cite><a class="bibref" href="#bib-URL">URL</a></cite>] at which a subscriber wishes to receive content distribution requests. </dd>
<dt><dfn data-dfn-type="dfn" id="dfn-event">Event</dfn></dt>
<dd>An event that causes updates to multiple topics. For each event that happens (e.g. "Brad posted to the Linux Community."), multiple topics could be affected (e.g. "Brad posted." and "Linux community has new post"). Publisher events cause topics to be updated and the hub looks up all subscriptions for affected topics, delivering the content to subscribers. </dd>
<dt><dfn data-dfn-type="dfn" id="dfn-content-distribution-notification">Content Distribution Notification</dfn> / <dfn data-dfn-type="dfn" id="dfn-content-distribution-request">(Content Distribution Request)</dfn></dt>
<dd>A payload describing how a topic's contents have changed, or the full updated content. Depending on the topic's content type, the difference (or "delta") may be computed by the hub and sent to all subscribers. </dd>
</dl>
</section>
<section id="high-level-protocol-flow">
<!--OddPage--><h2 id="x2-high-level-protocol-flow"><span class="secno">2. </span>High-level protocol flow</h2>
<p>(This section is non-normative.)</p>
<svg xmlns="http://www.w3.org/2000/svg" width="624" height="422"><style>.a{fill:white;}.b{fill:black;}.c{fill:none;stroke-dasharray:10;stroke:black;}.d{fill:none;}.e{fill:white;stroke-dasharray:;stroke-width:3;stroke:black;}.f{fill:black;font-weight:bold;}.g{fill:none;stroke-dasharray:;stroke:black;}</style><rect width="624" height="422" class="a"></rect><text font-family="sans-serif" font-size="16.5pt" text-decoration="normal" x="199.4" y="24.5" dominant-baseline="alphabetic" class="b"> WebSub Flow Diagram</text><path paint-order="fill stroke markers" d="M60.9 95.9L60.9 422.6" class="c"></path><path paint-order="fill stroke markers" d="M323.1 95.9L323.1 422.6" class="c"></path><path paint-order="fill stroke markers" d="M585.2 95.9L585.2 422.6" class="c"></path><path paint-order="fill stroke markers" d="M8.2 51.8L113.7 51.8 113.7 95.9 8.2 95.9 8.2 51.8Z" class="e"></path><text font-family="sans-serif" font-size="11pt" text-decoration="normal" x="25.9" y="79.6" dominant-baseline="alphabetic" class="b"> Subscriber</text><path paint-order="fill stroke markers" d="M274.8 51.8L371.4 51.8 371.4 95.9 274.8 95.9 274.8 51.8Z" class="e"></path><text font-family="sans-serif" font-size="11pt" text-decoration="normal" x="292.5" y="79.6" dominant-baseline="alphabetic" class="b"> Publisher</text><path paint-order="fill stroke markers" d="M554 51.8L616.4 51.8 616.4 95.9 554 95.9 554 51.8Z" class="e"></path><text font-family="sans-serif" font-size="11pt" text-decoration="normal" x="571.8" y="79.6" dominant-baseline="alphabetic" class="b"> Hub</text><rect x="89.6" y="128.6" width="196.4" height="21.2" class="a"></rect><rect x="89.6" y="144.9" width="204.9" height="21.2" class="a"></rect><text font-family="sans-serif" font-size="11pt" text-decoration="normal" x="92" y="143.3" dominant-baseline="alphabetic" class="b"> Subscriber discovers the </text><text font-family="sans-serif" font-size="11pt" text-decoration="normal" x="256.6" y="143.3" dominant-baseline="alphabetic" class="f"> hub</text><text font-family="sans-serif" font-size="11pt" text-decoration="normal" x="283.5" y="143.3" dominant-baseline="alphabetic" class="b"></text><text font-family="sans-serif" font-size="11pt" text-decoration="normal" x="92" y="159.6" dominant-baseline="alphabetic" class="b"> advertised by publisher's </text><text font-family="sans-serif" font-size="11pt" text-decoration="normal" x="257" y="159.6" dominant-baseline="alphabetic" class="f"> topic</text><text font-family="sans-serif" font-size="11pt" text-decoration="normal" x="292" y="159.6" dominant-baseline="alphabetic" class="b"></text><path paint-order="fill stroke markers" d="M60.9 166.1L323.1 166.1" class="g"></path><path paint-order="stroke fill markers" d="M309.5 159.3L323.1 166.1 309.5 172.9Z" class="b"></path><rect x="80.3" y="190.6" width="485.6" height="21.2" class="a"></rect><text font-family="sans-serif" font-size="11pt" text-decoration="normal" x="82.7" y="205.3" dominant-baseline="alphabetic" class="b"> Subscriber makes a POST to the </text><text font-family="sans-serif" font-size="11pt" text-decoration="normal" x="301.1" y="205.3" dominant-baseline="alphabetic" class="f">hub</text> <text font-family="sans-serif" font-size="11pt" text-decoration="normal" x="331" y="205.3" dominant-baseline="alphabetic" class="b">to subscribe to updates about </text><text font-family="sans-serif" font-size="11pt" text-decoration="normal" x="528.4" y="205.3" dominant-baseline="alphabetic" class="f">topic</text><text font-family="sans-serif" font-size="11pt" text-decoration="normal" x="563.4" y="205.3" dominant-baseline="alphabetic" class="b"></text><path paint-order="fill stroke markers" d="M60.9 211.9L585.2 211.9" class="g"></path><path paint-order="stroke fill markers" d="M571.6 205.1L585.2 211.9 571.6 218.7Z" class="b"></path><rect x="163.8" y="236.4" width="318.6" height="21.2" class="a"></rect><text font-family="sans-serif" font-size="11pt" text-decoration="normal" x="166.2" y="251.1" dominant-baseline="alphabetic" class="b"> Hub verifies the subscription attempt with a GET</text><path paint-order="fill stroke markers" d="M585.2 257.6L60.9 257.6" style="fill:none;stroke-dasharray:7;stroke:black"></path><path paint-order="stroke fill markers" d="M74.5 250.8L60.9 257.6 74.5 264.4Z" class="b"></path><rect x="368.2" y="282.1" width="171.9" height="21.2" class="a"></rect><rect x="368.2" y="298.4" width="100.3" height="21.2" class="a"></rect><text font-family="sans-serif" font-size="11pt" text-decoration="normal" x="370.6" y="296.8" dominant-baseline="alphabetic" class="b"> Publisher notifies the </text><text font-family="sans-serif" font-size="11pt" text-decoration="normal" x="510.8" y="296.8" dominant-baseline="alphabetic" class="f"> hub</text><text font-family="sans-serif" font-size="11pt" text-decoration="normal" x="537.7" y="296.8" dominant-baseline="alphabetic" class="b"></text><text font-family="sans-serif" font-size="11pt" text-decoration="normal" x="370.6" y="313.1" dominant-baseline="alphabetic" class="b"> of new content</text><path paint-order="fill stroke markers" d="M323.1 319.7L585.2 319.7" class="g"></path><path paint-order="stroke fill markers" d="M571.6 312.9L585.2 319.7 571.6 326.5Z" class="b"></path><rect x="105.1" y="344.2" width="435.9" height="21.2" class="a"></rect><text font-family="sans-serif" font-size="11pt" text-decoration="normal" x="107.6" y="358.9" dominant-baseline="alphabetic" class="b"> Hub delivers the contents of </text><text font-family="sans-serif" font-size="11pt" text-decoration="normal" x="293.4" y="358.9" dominant-baseline="alphabetic" class="f"> topic</text><text font-family="sans-serif" font-size="11pt" text-decoration="normal" x="330" y="358.9" dominant-baseline="alphabetic" class="b">to each subscriber with a POST</text><path paint-order="fill stroke markers" d="M585.2 365.4L60.9 365.4" class="g"></path><path paint-order="stroke fill markers" d="M74.5 358.6L60.9 365.4 74.5 372.2Z" class="b"></path></svg>
<!-- SVG generated at https://sequencediagram.org/index.html?initialData=C4S2BsFMAIHVIEYGUCuDoDFwHsDu0AREAQwHMAnYgWwCgaAFNcEAZwAtJyAeAWlQRYBjciAScAXPyEix5aABNWg7ADdOLaMA7QAVDrZo9AHQB2xeWvKgWkedAQBPaAAcmrDuQDkGvcGzOQQT0aKWFRTh4APgAJNEk0aXC5KmIAa0gNYmh6AHkkABVNbE1tPQMEPSLoFgSwsSqUZ3liYAzoYgRsFGBdHT8AoJ0Q2plOXh5YhHFoSehLEAAzEDatGBqBMOdQbBN24FaqLehcMDZ26ABxAFF8hjd2CJi4xgRmB7kTbFAlldL9Qx0pmwC2gJkg+GUJlaUJokyioVG5Gms3kkGYlg0q2gkOhwA0wN6-UClT80EgxEEZ3WiVkx1O51yBSAA -->
<ul>
<li>Subscribers discover the hub of a topic URL, and makes a POST to one or more of the advertised hubs in order to receive updates when the topic changes.</li>
<li>Publishers notify their hub(s) URLs when their topic(s) change.</li>
<li>When the hub identifies a change in the topic, it sends a content distribution notification to all registered subscribers.</li>
</ul>
<p>Earlier versions of this protocol were called PubSubHubbub:</p>
<ul>
<li>Working Draft 0.3 [<cite><a class="bibref" href="#bib-PubSubHubbub-Core-0.3">PubSubHubbub-Core-0.3</a></cite>]</li>
<li>Working Draft 0.4 [<cite><a class="bibref" href="#bib-PubSubHubbub-Core-0.4">PubSubHubbub-Core-0.4</a></cite>]</li>
</ul>
</section>
<section id="conformance">
<!--OddPage--><h2 id="x3-conformance"><span class="secno">3. </span>Conformance</h2>
<p>The key words "<em class="rfc2119" title="MUST">MUST</em>", "<em class="rfc2119" title="MUST NOT">MUST NOT</em>", "<em class="rfc2119" title="REQUIRED">REQUIRED</em>", "<em class="rfc2119" title="SHALL">SHALL</em>", "<em class="rfc2119" title="SHALL NOT">SHALL NOT</em>",
"<em class="rfc2119" title="SHOULD">SHOULD</em>", "<em class="rfc2119" title="SHOULD NOT">SHOULD NOT</em>", "<em class="rfc2119" title="RECOMMENDED">RECOMMENDED</em>", "<em class="rfc2119" title="MAY">MAY</em>", and "<em class="rfc2119" title="OPTIONAL">OPTIONAL</em>" in this
document are to be interpreted as described in [<cite><a class="bibref" href="#bib-RFC2119">RFC2119</a></cite>].</p>
<section id="conformance-classes">
<h3 id="x3-1-conformance-classes"><span class="secno">3.1 </span>Conformance Classes</h3>
<p>WebSub describes three roles: publishers, subscribers and hubs. This section describes the conformance criteria for each role.</p>
<h3 id="publishers">Publishers</h3>
<ul>
<li>A conforming publisher <em class="rfc2119" title="MUST">MUST</em> advertise topic and hub URLs for a given resource URL as described in <a href="#discovery">Discovery</a>.</li>
</ul>
<h3 id="subscribers">Subscribers</h3>
<p>A conforming subscriber:</p>
<ul>
<li><em class="rfc2119" title="MUST">MUST</em> support each discovery mechanism in the specified order to discover the topic and hub URLs as described in <a href="#discovery">Discovery</a>.</li>
<li><em class="rfc2119" title="MUST">MUST</em> send a subscription request as described in <a href="#subscriber-sends-subscription-request">Subscriber Sends Subscription Request</a>.</li>
<li><em class="rfc2119" title="MAY">MAY</em> request a specific lease duration</li>
<li><em class="rfc2119" title="MAY">MAY</em> include a secret in the subscription request, and if it does, then <em class="rfc2119" title="MUST">MUST</em> use the secret to verify the signature in the <a href="#authenticated-content-distribution">content distribution request</a>.</li>
<li><em class="rfc2119" title="MUST">MUST</em> acknowledge a content distribution request with an HTTP 2xx status code.</li>
<li><em class="rfc2119" title="MAY">MAY</em> request that a subscription is deactivated using the "unsubscribe" mechanism.</li>
</ul>
<h4 id="hubs">Hubs</h4>
<p>A conforming hub:</p>
<ul>
<li><em class="rfc2119" title="MUST">MUST</em> accept a subscription request with the parameters <code>hub.callback</code>, <code>hub.mode</code> and <code>hub.topic</code>.</li>
<li><em class="rfc2119" title="MUST">MUST</em> accept a subscription request with a <code>hub.secret</code> parameter.</li>
<li><em class="rfc2119" title="MAY">MAY</em> respect the requested lease duration in subscription requests.</li>
<li><em class="rfc2119" title="MUST">MUST</em> allow subscribers to re-request already active subscriptions.</li>
<li><em class="rfc2119" title="MUST">MUST</em> support unsubscription requests.</li>
<li><em class="rfc2119" title="MUST">MUST</em> send content distribution requests with a matching content type of the topic URL. (See <a href="#content-negotiation">Content Negotiation</a>)</li>
<li><em class="rfc2119" title="MAY">MAY</em> reduce the payload of the content distribution to a diff of the contents for supported formats as described in <a href="#content-distribution">Content Distribution</a>.</li>
<li><em class="rfc2119" title="MUST">MUST</em> send a <code>X-Hub-Signature</code> header if the subscription was made with a <code>hub.secret</code> as described in <a href="#authenticated-content-distribution">Authenticated Content Distribution</a>.</li>
</ul>
</section>
<section id="candidate-recommendation-exit-criteria">
<h3 id="x3-2-candidate-recommendation-exit-criteria"><span class="secno">3.2 </span>Candidate Recommendation Exit Criteria</h3>
<p>This specification exited the CR stage with at least two independent, interoperable implementations of each feature. Each feature may have been implemented by a different set of products. There was no requirement that all features be implemented by a single product. For the purposes of this criterion, we define the following terms:</p>
<section id="publisher">
<h4 id="x3-2-1-publisher"><span class="secno">3.2.1 </span>Publisher</h4>
<p>A WebSub Publisher is an implementation that advertises a topic and hub URL on one or more resource URLs. The conformance criteria are described in <a href="#conformance-classes">Conformance Classes</a> above.</p>
</section>
<section id="subscriber">
<h4 id="x3-2-2-subscriber"><span class="secno">3.2.2 </span>Subscriber</h4>
<p>A WebSub Subscriber is an implementation that discovers the hub and topic URL given a resource URL, subscribes to updates at the hub, and accepts content distribution requests from the hub. The subscriber <em class="rfc2119" title="MAY">MAY</em> support <a href="#authenticated-content-distribution">authenticated content distribution</a>. The conformance criteria are described in <a href="#conformance-classes">Conformance Classes</a> above.</p>
</section>
<section id="hub">
<h4 id="x3-2-3-hub"><span class="secno">3.2.3 </span>Hub</h4>
<p>A WebSub Hub is an implementation that handles subscription requests and distributes the content to subscribers when the corresponding topic URL has been updated. Hubs <em class="rfc2119" title="MUST">MUST</em> support subscription requests with a secret and deliver <a href="#authenticated-content-distribution">authenticated requests</a> when requested. Hubs <em class="rfc2119" title="MUST">MUST</em> deliver the full contents of the topic URL in the request, and <em class="rfc2119" title="MAY">MAY</em> reduce the payload to a diff if the content type supports it. The conformance criteria are described in <a href="#conformance-classes">Conformance Classes</a> above.</p>
</section>
<section id="independent">
<h4 id="x3-2-4-independent"><span class="secno">3.2.4 </span>Independent</h4>
<p>Each implementation must be developed by a different party and cannot share, reuse, or derive from code used by another qualifying implementation. Sections of code that have no bearing on the implementation of this specification are exempt from this requirement.</p>
</section>
<section id="interoperable">
<h4 id="x3-2-5-interoperable"><span class="secno">3.2.5 </span>Interoperable</h4>
<p>A Subscriber and Hub implementation are considered interoperable for a specific feature when the Hub takes the defined action that the Subscriber requests, the Subscriber gets the expected response from a Hub according to the feature, and the Hub sends the expected response to the Subscriber.</p>
</section>
<section id="feature">
<h4 id="x3-2-6-feature"><span class="secno">3.2.6 </span>Feature</h4>
<p>For the purposes of evaluating exit criteria, each of the following is considered a feature:</p>
<ul>
<li>Discovering the hub and topic URLs by looking at the HTTP headers of the resource URL.</li>
<li>Discovering the hub and topic URLs by looking at the contents of the resource URL as an XML document.</li>
<li>Discovering the hub and topic URLs by looking at the contents of the resource URL as an HTML document.</li>
<li>Subscribing to the hub with a callback URL.</li>
<li>Subscribing to the hub and requesting a specific lease duration.</li>
<li>Subscribing to the hub with a secret and handling authenticated content distribution.</li>
<li>Requesting that a subscription is deactivated by sending an unsubscribe request.</li>
<li>The Subscriber acknowledges a pending subscription on a validation request.</li>
<li>The Subscriber rejects a subscription validation request for an invalid topic URL.</li>
<li>The Subscriber returns an HTTP 2xx response when the payload is delivered.</li>
<li>The Subscriber verifies the signature for authenticated content distribution requests.</li>
<li>The Subscriber rejects the distribution request if the signature does not validate.</li>
<li>The Subscriber rejects the distribution request when no signature is present if the subscription was made with a secret.</li>
<li>The Hub respects the requested lease duration during a subscription request.</li>
<li>The Hub allows Subscribers to re-request already active subscriptions, extending the lease duration.</li>
<li>The Hub sends the full contents of the topic URL in the distribution request.</li>
<li>The Hub sends a diff of the topic URL for the formats that support it.</li>
<li>The Hub sends a valid signature for subscriptions that were made with a secret.</li>
</ul>
</section>
</section>
</section>
<section id="discovery">
<!--OddPage--><h2 id="x4-discovery"><span class="secno">4. </span>Discovery</h2>
<p>The discovery mechanism aims at identifying at least 2 URLs.</p>
<ul>
<li>The URL of one or more hubs designated by the publisher. If more than one hub URL is specified, it is expected that the publisher notifies each hub, so the subscriber may subscribe to one or more of them.</li>
<li>The canonical URL for the topic to which subscribers are expected to use for subscriptions.</li>
</ul>
<div class="note"><div role="heading" class="note-title marker" id="h-note" aria-level="3"><span>Note</span></div><p class="">Publishers may wish to advertise and publish to more than one hub for fault tolerance and redundancy. If one hub fails to propagate an update to the document, then using multiple independent hub is a way to increase the liklihood of delivery to subscribers. As such, subscribers may subscribe to one or more of the advertised hubs.</p></div>
<p>The protocol currently supports the following discovery mechanisms. Publishers <em class="rfc2119" title="MUST">MUST</em> implement at least one of them:</p>
<ul>
<li>Link Headers [<cite><a class="bibref" href="#bib-RFC5988">RFC5988</a></cite>]: the publisher <em class="rfc2119" title="SHOULD">SHOULD</em> include at least one Link Header [<cite><a class="bibref" href="#bib-RFC5988">RFC5988</a></cite>] with <samp>rel=hub</samp> (a hub link header) as well as exactly one Link Header [<cite><a class="bibref" href="#bib-RFC5988">RFC5988</a></cite>] with <samp>rel=self</samp> (the self link header)</li>
<li>If the topic is an XML based feed, publishers <em class="rfc2119" title="SHOULD">SHOULD</em> use embedded link elements as described in Appendix B of Web Linking [<cite><a class="bibref" href="#bib-RFC5988">RFC5988</a></cite>]. Similarly, for HTML pages, publishers <em class="rfc2119" title="SHOULD">SHOULD</em> use embedded link elements as described in Appendix A of Web Linking [<cite><a class="bibref" href="#bib-RFC5988">RFC5988</a></cite>].</li>
</ul>
<div class="note"><div role="heading" class="note-title marker" id="h-note-0" aria-level="3"><span>Note</span></div><p class="">Since <samp>&lt;link&gt;</samp> has been limited to being placed in the <samp>&lt;head&gt;</samp> for many years, some consuming code might only check the <samp>&lt;head&gt;</samp>. Therefore it is more robust to place the <samp>&lt;link&gt;</samp> tags only in the HTML <samp>&lt;head&gt;</samp> rather than in the <samp>&lt;body&gt;</samp>.</p></div>
<div class="example"><div class="example-title marker"><span>Example 1</span></div><pre class="hljs http" aria-busy="false" aria-live="polite"><span class="hljs-keyword">GET</span> <span class="hljs-string">/feed</span> HTTP/1.1
<span class="hljs-attribute">Host</span>: example.com
<span class="http">HTTP/1.1 <span class="hljs-number">200</span> Ok
<span class="hljs-attribute">Content-type</span>: text/html
<span class="hljs-attribute">Link</span>: &lt;https://hub.example.com/&gt;; rel="hub"
<span class="hljs-attribute">Link</span>: &lt;http://example.com/feed&gt;; rel="self"
<span class="xml"><span class="hljs-meta">&lt;!doctype html&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">html</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">head</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">link</span> <span class="hljs-attr">rel</span>=<span class="hljs-string">"hub"</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"https://hub.example.com/"</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">link</span> <span class="hljs-attr">rel</span>=<span class="hljs-string">"self"</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"http://example.com/feed"</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">head</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>
...
<span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">html</span>&gt;</span></span></span></pre></div>
<p>When perfoming discovery, subscribers <em class="rfc2119" title="MUST">MUST</em> implement all three discovery mechanisms in the following order, stopping at the first match:</p>
<ol>
<li>Issue a GET or HEAD request to retrieve the topic URL. Subscribers <em class="rfc2119" title="MUST">MUST</em> check for HTTP Link headers first.</li>
<li>In the absence of HTTP Link headers, and if the topic is an XML based feed or an HTML page, subscribers <em class="rfc2119" title="MUST">MUST</em> check for embedded link elements.</li>
</ol>
<section id="content-negotiation">
<h3 id="x4-1-content-negotiation"><span class="secno">4.1 </span>Content Negotiation</h3>
<p>
For practical purposes, it is important that the <samp>rel=self</samp> URL only offers a single representation. As the hub has no way of knowing what Media Type ([<cite><a class="bibref" href="#bib-RFC6838">RFC6838</a></cite>]) or language may have been requested by the subscriber upon discovery, it would not be able to deliver the content using the appropriate representation of the document.
</p>
<p>
It is, however, possible to perform content negotiation by returning an appropriate <samp>rel=self</samp> URL according to the HTTP headers used in the initial discovery request. For example, a request to <samp>/feed</samp> with an <samp>Accept</samp> header containing <samp>application/json</samp> could return a <samp>rel=self</samp> value of <samp>/feed.json</samp>.
</p>
<p>The example below illustrates how a topic URL can return different <samp>Link</samp> headers depending on the <samp>Accept</samp> header that was sent.</p>
<div class="example"><div class="example-title marker"><span>Example 2</span></div><pre class="hljs http" aria-busy="false" aria-live="polite"><span class="hljs-keyword">GET</span> <span class="hljs-string">/feed</span> HTTP/1.1
<span class="hljs-attribute">Host</span>: example.com
<span class="hljs-attribute">Accept</span>: application/json
<span class="http">HTTP/1.1 <span class="hljs-number">200</span> Ok
<span class="hljs-attribute">Content-type</span>: application/json
<span class="hljs-attribute">Link</span>: &lt;/feed.json&gt;; rel="self"
<span class="hljs-attribute">Link</span>: &lt;https://hub.example.com/&gt;; rel="hub"
<span class="json">{
<span class="hljs-attr">"items"</span>: [...]
}</span></span></pre></div>
<div class="example"><div class="example-title marker"><span>Example 3</span></div><pre class="hljs http" aria-busy="false" aria-live="polite"><span class="hljs-keyword">GET</span> <span class="hljs-string">/feed</span> HTTP/1.1
<span class="hljs-attribute">Host</span>: example.com
<span class="hljs-attribute">Accept</span>: text/html
<span class="http">HTTP/1.1 <span class="hljs-number">200</span> Ok
<span class="hljs-attribute">Content-type</span>: text/html
<span class="hljs-attribute">Link</span>: &lt;/feed.html&gt;; rel="self"
<span class="hljs-attribute">Link</span>: &lt;https://hub.example.com/&gt;; rel="hub"
<span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">html</span>&gt;</span>
...</span></span></pre></div>
<p>Similarly, the technique can also be used to return a different <samp>rel=self</samp> URL depending on the language requested by the <samp>Accept-Language</samp> header.</p>
<div class="example"><div class="example-title marker"><span>Example 4</span></div><pre class="hljs http" aria-busy="false" aria-live="polite"><span class="hljs-keyword">GET</span> <span class="hljs-string">/feed</span> HTTP/1.1
<span class="hljs-attribute">Host</span>: example.com
<span class="hljs-attribute">Accept-Language</span>: de-DE
<span class="http">HTTP/1.1 <span class="hljs-number">200</span> Ok
<span class="hljs-attribute">Content-type</span>: text/html
<span class="http"><span class="hljs-attribute">Link</span>: &lt;/feed-de.json&gt;; rel="self"
<span class="hljs-attribute">Link</span>: &lt;https://hub.example.com/&gt;; rel="hub"
<span class="json">{
<span class="hljs-attr">"items"</span>: [...]
}</span></span></span></pre></div>
</section>
</section>
<section id="subscribing-and-unsubscribing">
<!--OddPage--><h2 id="x5-subscribing-and-unsubscribing"><span class="secno">5. </span>Subscribing and Unsubscribing</h2>
<p>Subscribing to a topic URL consists of four parts that may occur immediately in sequence or have a delay.</p>
<ul>
<li>Subscriber requests a subscription at the hub</li>
<li>The hub validates the subscription with the publisher (<em class="rfc2119" title="OPTIONAL">OPTIONAL</em>)</li>
<li>The hub confirms the subscription was actually requested by the subscriber</li>
<li>The hub periodically reconfirms the subscription is still active (<em class="rfc2119" title="OPTIONAL">OPTIONAL</em>)</li>
</ul>
<p>Unsubscribing works in the same way, except with a single parameter changed to indicate the desire to unsubscribe. Also, the Hub will not validate unsubscription requests with the publisher.</p>
<section id="subscriber-sends-subscription-request">
<h3 id="x5-1-subscriber-sends-subscription-request"><span class="secno">5.1 </span>Subscriber Sends Subscription Request</h3>
<p>Subscription is initiated by the subscriber making an HTTPS or HTTP POST [<cite><a class="bibref" href="#bib-RFC7231">RFC7231</a></cite>] request to the hub URL. This request <em class="rfc2119" title="MUST">MUST</em> have a Content-Type header of <samp>application/x-www-form-urlencoded</samp> (described in Section 4.10.22.6 [<cite><a class="bibref" href="#bib-HTML5">HTML5</a></cite>]), <em class="rfc2119" title="MUST">MUST</em> use UTF-8 [<cite><a class="bibref" href="#bib-Encoding">Encoding</a></cite>] as the document character encoding, and <em class="rfc2119" title="MUST">MUST</em> use the following parameters in its body, formatted accordingly:</p>
<dl>
<dt>hub.callback</dt>
<dd><em class="rfc2119" title="REQUIRED">REQUIRED</em>. The subscriber's callback URL where content distribution notifications should be delivered. The callback URL <em class="rfc2119" title="SHOULD">SHOULD</em> be an unguessable URL that is unique per subscription. ([<cite><a class="bibref" href="#bib-capability-urls">capability-urls</a></cite>])</dd>
<dt>hub.mode</dt>
<dd><em class="rfc2119" title="REQUIRED">REQUIRED</em>. The literal string "subscribe" or "unsubscribe", depending on the goal of the request.</dd>
<dt>hub.topic</dt>
<dd><em class="rfc2119" title="REQUIRED">REQUIRED</em>. The topic URL that the subscriber wishes to subscribe to or unsubscribe from. Note that this <em class="rfc2119" title="MUST">MUST</em> be the "self" URL found during the discovery step, which may be different from the URL that was used to make the discovery request.</dd>
<dt>hub.lease_seconds</dt>
<dd><em class="rfc2119" title="OPTIONAL">OPTIONAL</em>. Number of seconds for which the subscriber would like to have the subscription active, given as a positive decimal integer. Hubs <em class="rfc2119" title="MAY">MAY</em> choose to respect this value or not, depending on their own policies, and <em class="rfc2119" title="MAY">MAY</em> set a default value if the subscriber omits the parameter. This parameter <em class="rfc2119" title="MAY">MAY</em> be present for unsubscription requests and <em class="rfc2119" title="MUST">MUST</em> be ignored by the hub in that case.</dd>
<dt>hub.secret</dt>
<dd><em class="rfc2119" title="OPTIONAL">OPTIONAL</em>. A subscriber-provided cryptographically random unique secret string that will be used to compute an HMAC digest for <a href="#authenticated-content-distribution">authorized content distribution</a>. If not supplied, the HMAC digest will not be present for content distribution requests. This parameter <em class="rfc2119" title="SHOULD">SHOULD</em> only be specified when the request was made over HTTPS [<cite><a class="bibref" href="#bib-RFC2818">RFC2818</a></cite>]. This parameter <em class="rfc2119" title="MUST">MUST</em> be less than 200 bytes in length.</dd>
</dl>
<p>Subscribers <em class="rfc2119" title="MAY">MAY</em> also include additional HTTP [<cite><a class="bibref" href="#bib-RFC7230">RFC7230</a></cite>] request parameters, as well as HTTP [<cite><a class="bibref" href="#bib-RFC7230">RFC7230</a></cite>] Headers if they are required by the hub.</p>
<p>Hubs <em class="rfc2119" title="MUST">MUST</em> ignore additional request parameters they do not understand.</p>
<p>Hubs <em class="rfc2119" title="MUST">MUST</em> allow subscribers to re-request subscriptions that are already activated. Each subsequent request to a hub to subscribe or unsubscribe <em class="rfc2119" title="MUST">MUST</em> override the previous subscription state for a specific topic URL and callback URL combination, but only once the action is verified (<a href="#hub-verifies-intent">Section 4.3</a>). If verification fails, the subscription state <em class="rfc2119" title="MUST">MUST</em> be left unchanged. This is required so subscribers can renew their subscriptions before the lease seconds period is over without any interruption. The subscriber <em class="rfc2119" title="MAY">MAY</em> use a new hub.secret value in a future subscription, and <em class="rfc2119" title="MAY">MAY</em> make a new subscription without a hub.secret.</p>
<section id="subscription-parameter-details">
<h4 id="x5-1-1-subscription-parameter-details"><span class="secno">5.1.1 </span>Subscription Parameter Details</h4>
<p>The topic and callback URLs <em class="rfc2119" title="MAY">MAY</em> use HTTP [<cite><a class="bibref" href="#bib-RFC7230">RFC7230</a></cite>] or HTTPS [<cite><a class="bibref" href="#bib-RFC2818">RFC2818</a></cite>] schemes. The topic URL <em class="rfc2119" title="MUST">MUST</em> be the one advertised by the publisher in a Self Link Header during the discovery phase. (See <a href="#discovery">Section 3 </a>). Hubs <em class="rfc2119" title="MAY">MAY</em> refuse subscriptions if the topic URL does not correspond to the one advertised by the publisher. The topic URL can otherwise be free-form following the URL spec [<cite><a class="bibref" href="#bib-URL">URL</a></cite>]. Hubs <em class="rfc2119" title="MUST">MUST</em> always decode non-reserved characters for these URL parameters; see section 1.2 on <em>"Percent-encoded bytes"</em> in [<cite><a class="bibref" href="#bib-URL">URL</a></cite>].</p>
<p>The callback URL <em class="rfc2119" title="SHOULD">SHOULD</em> be an unguessable unique URL ([<cite><a class="bibref" href="#bib-capability-urls">capability-urls</a></cite>]) and <em class="rfc2119" title="SHOULD">SHOULD</em> use HTTPS [<cite><a class="bibref" href="#bib-RFC7230">RFC7230</a></cite>]. The callback URL acts as authentication from the hub to the subscriber when confirming subscriptions and delivering the content. Additionally, the callback <em class="rfc2119" title="SHOULD">SHOULD</em> be unique (not re-used for multiple hubs) and changed when subscriptions are renewed.</p>
<p>The callback URL <em class="rfc2119" title="MAY">MAY</em> contain arbitrary query string parameters (e.g., <samp>?foo=bar&amp;red=fish</samp>). Hubs <em class="rfc2119" title="MUST">MUST</em> preserve the query string during subscription verification by appending new parameters to the end of the list using the <samp>&amp;</samp> (ampersand) character to join. Existing parameters with names that overlap with those used by verification requests will not be overwritten. When sending the content distribution request, the hub will make a POST request to the callback URL including any query string parameters in the URL portion of the request, not as POST body parameters.</p>
</section>
<section id="subscription-response-details">
<h4 id="x5-1-2-subscription-response-details"><span class="secno">5.1.2 </span>Subscription Response Details</h4>
<p>If the hub URL supports WebSub and is able to handle the subscription or unsubscription request, it <em class="rfc2119" title="MUST">MUST</em> respond to a subscription request with an HTTP [<cite><a class="bibref" href="#bib-RFC7231">RFC7231</a></cite>] 202 "Accepted" response to indicate that the request was received and will now be verified (<a href="#hub-verifies-intent">Section 4.3 </a>) and validated (<a href="#subscription-validation">Section 4.2 </a>) by the hub. The hub <em class="rfc2119" title="SHOULD">SHOULD</em> perform the verification and validation of intent as soon as possible.</p>
<p>If a hub finds any errors in the subscription request, an appropriate HTTP [<cite><a class="bibref" href="#bib-RFC7231">RFC7231</a></cite>] error response code (4xx or 5xx) <em class="rfc2119" title="MUST">MUST</em> be returned. In the event of an error, hubs <em class="rfc2119" title="SHOULD">SHOULD</em> return a description of the error in the response body as plain text, used to assist the client developer in understanding the error. This is not meant to be shown to the end user. Hubs <em class="rfc2119" title="MAY">MAY</em> decide to reject some callback URLs or topic URLs based on their own policies (e.g., domain authorization, topic URL port numbers). However, since verification and validation of intent are asynchronous steps that logically begin after the HTTP response has been returned, the HTTP response <em class="rfc2119" title="MUST NOT">MUST NOT</em> depend on the process or outcome of verification or validation.</p>
<p>If the hub URL is not able to handle subscription or unsubscription requests, it <em class="rfc2119" title="MAY">MAY</em> redirect to another hub which supports WebSub. It does so by yielding an HTTP [<cite><a class="bibref" href="#bib-RFC7231">RFC7231</a></cite>] 307 (temporary redirect) or 308 (permanent redirect) response. It <em class="rfc2119" title="MUST">MUST</em> also include at least a HTTP [<cite><a class="bibref" href="#bib-RFC7230">RFC7230</a></cite>] Location Header containing a preferred URL reference for the hub to use by the subscriber. The subscriber is expected to retry the subscription or unsubscription at the new hub URL.</p>
</section>
</section>
<section id="subscription-validation">
<h3 id="x5-2-subscription-validation"><span class="secno">5.2 </span>Subscription Validation</h3>
<p>Subscriptions <em class="rfc2119" title="MAY">MAY</em> be validated by the Hubs who may require more details to accept or refuse a subscription. The Hub <em class="rfc2119" title="MAY">MAY</em> also check with the publisher whether the subscription should be accepted.</p>
<p>If (and when) the subscription is accepted, the hub <em class="rfc2119" title="MUST">MUST</em> perform the <a href="#hub-verifies-intent">verification of intent </a> of the subscriber.</p>
<p>If (and when) the subscription is denied, the hub <em class="rfc2119" title="MUST">MUST</em> inform the subscriber by sending an HTTP [<cite><a class="bibref" href="#bib-RFC7231">RFC7231</a></cite>] (or HTTPS [<cite><a class="bibref" href="#bib-RFC2818">RFC2818</a></cite>]) GET request to the subscriber's callback URL as given in the subscription request. This request has the following query string arguments appended (format described in Section 4 of [<cite><a class="bibref" href="#bib-URL">URL</a></cite>]):</p>
<dl>
<dt>hub.mode</dt>
<dd><em class="rfc2119" title="REQUIRED">REQUIRED</em>. The literal string "denied".</dd>
<dt>hub.topic</dt>
<dd><em class="rfc2119" title="REQUIRED">REQUIRED</em>. The topic URL given in the corresponding subscription request.</dd>
<dt>hub.reason</dt>
<dd><em class="rfc2119" title="OPTIONAL">OPTIONAL</em>. The hub may include a reason for which the subscription has been denied.</dd>
</dl>
<p>The subscription <em class="rfc2119" title="MAY">MAY</em> be denied by the hub at any point (even if it was previously accepted). The Subscriber <em class="rfc2119" title="SHOULD">SHOULD</em> then consider that the subscription is not possible anymore.</p>
</section>
<section id="hub-verifies-intent">
<h3 id="x5-3-hub-verifies-intent-of-the-subscriber"><span class="secno">5.3 </span>Hub Verifies Intent of the Subscriber</h3>
<p>In order to prevent an attacker from creating unwanted subscriptions on behalf of a subscriber (or unsubscribing desired ones), a hub must ensure that the subscriber did indeed send the subscription request.</p>
<p>The hub verifies a subscription request by sending an HTTP [<cite><a class="bibref" href="#bib-RFC7231">RFC7231</a></cite>] (or HTTPS [<cite><a class="bibref" href="#bib-RFC2818">RFC2818</a></cite>]) GET request to the subscriber's callback URL as given in the subscription request. This request has the following query string arguments appended (format described in Section 4 of [<cite><a class="bibref" href="#bib-URL">URL</a></cite>]):</p>
<dl>
<dt><samp>hub.mode</samp></dt>
<dd><em class="rfc2119" title="REQUIRED">REQUIRED</em>. The literal string "<samp>subscribe</samp>" or "<samp>unsubscribe</samp>", which matches the original request to the hub from the subscriber.</dd>
<dt><samp>hub.topic</samp></dt>
<dd><em class="rfc2119" title="REQUIRED">REQUIRED</em>. The topic URL given in the corresponding subscription request.</dd>
<dt><samp>hub.challenge</samp></dt>
<dd><em class="rfc2119" title="REQUIRED">REQUIRED</em>. A hub-generated, random string that <em class="rfc2119" title="MUST">MUST</em> be echoed by the subscriber to verify the subscription.</dd>
<dt><samp>hub.lease_seconds</samp></dt>
<dd><em class="rfc2119" title="REQUIRED">REQUIRED</em>/<em class="rfc2119" title="OPTIONAL">OPTIONAL</em>. The hub-determined number of seconds that the subscription will stay active before expiring, measured from the time the verification request was made from the hub to the subscriber. Hubs <em class="rfc2119" title="MUST">MUST</em> supply this parameter when <samp>hub.mode</samp> is set to "subscribe". This parameter <em class="rfc2119" title="MAY">MAY</em> be present when <samp>hub.mode</samp> is "unsubscribe" and <em class="rfc2119" title="MUST">MUST</em> be ignored by subscribers in that case.</dd>
</dl>
<section id="verification-details">
<h4 id="x5-3-1-verification-details"><span class="secno">5.3.1 </span>Verification Details</h4>
<p>The subscriber <em class="rfc2119" title="MUST">MUST</em> confirm that the <samp>hub.topic</samp> corresponds to a pending subscription or unsubscription that it wishes to carry out. If so, the subscriber <em class="rfc2119" title="MUST">MUST</em> respond with an HTTP success (2xx) code with a response body equal to the <samp>hub.challenge</samp> parameter. If the subscriber does not agree with the action, the subscriber <em class="rfc2119" title="MUST">MUST</em> respond with a 404 "Not Found" response.</p>
<p>The hub <em class="rfc2119" title="MUST">MUST</em> consider other server response codes (3xx, 4xx, 5xx) to mean that the verification request has failed. If the subscriber returns an HTTP [<cite><a class="bibref" href="#bib-RFC7231">RFC7231</a></cite>] success (2xx) but the content body does not match the <samp>hub.challenge</samp> parameter, the hub <em class="rfc2119" title="MUST">MUST</em> also consider verification to have failed.</p>
<p>Hubs <em class="rfc2119" title="MAY">MAY</em> make the <samp>hub.lease_seconds</samp> equal to the value the subscriber passed in their subscription request but <em class="rfc2119" title="MAY">MAY</em> change the value depending on the hub's policies. To sustain a subscription, the subscriber <em class="rfc2119" title="MUST">MUST</em> re-request the subscription on the hub before <samp>hub.lease_seconds</samp> seconds has elapsed.</p>
<p>Hubs <em class="rfc2119" title="MUST">MUST</em> enforce lease expirations, and <em class="rfc2119" title="MUST NOT">MUST NOT</em> issue perpetual lease durations.</p>
</section>
</section>
<div class="note"><div role="heading" class="note-title marker" id="h-note-1" aria-level="3"><span>Note</span></div><p class="">The spec uses GET vs POST to differentiate between the confirmation/denial of the subscription request and delivering the content. While this is not considered "best practice" from a web architecture perspective, it does make implementation of the callback URL simpler. Since the POST body of the content distribution request may be any arbitrary content type and only includes the actual content of the document, using the GET vs POST distinction to switch between handling these two modes makes implementations simpler.</p></div>
</section>
<section id="publishing">
<!--OddPage--><h2 id="x6-publishing"><span class="secno">6. </span>Publishing</h2>
<p>The publisher <em class="rfc2119" title="MUST">MUST</em> inform the hubs it previously designated when a topic has been updated. The hub and the publisher can agree on any mechanism, as long as the hub is eventually able send the updated payload to the subscribers.</p>
<div class="note"><div role="heading" class="note-title marker" id="h-note-2" aria-level="3"><span>Note</span></div><p class="">The specific mechanism for the publisher to inform the hub is left unspecified. For example, some existing public hubs <a href="https://documentation.superfeedr.com/publishers.html#ping">[1]</a> <a href="https://pubsubhubbub.appspot.com/">[2]</a> <a href="https://switchboard.p3k.io/docs">[3]</a> ask publishers to send a POST request with the keys <span style="white-space: nowrap">hub.mode="publish"</span> and <span style="white-space: nowrap">hub.url=(the URL of the resource that was updated)</span>.</p></div>
<section id="subscription-migration">
<h3 id="x6-1-subscription-migration"><span class="secno">6.1 </span>Subscription Migration</h3>
<p>If the publisher wishes to migrate existing subscriptions to a new topic URL, it can do so using HTTP redirects.</p>
<ul>
<li>The previous topic URL should send a redirect to the new topic URL. This will provide a seamless transition for any HTTP client that did not use WebSub but instead was polling the topic URL.</li>
<li>When existing WebSub subscriptions expire, subscribers will attempt to renew the subscription. The first step of renewing a subscription is to fetch the topic URL, which means the subscriber will encounter the redirect and end up at the new topic URL.</li>
<li>At the new topic URL, the subscriber will see the new <code>rel=self</code> URL and the new hub, and will subscribe to the new topic URL at the new hub.</li>
</ul>
<p>This does not require any participation on the part of the previous hub, and works whether or not the publisher changes hubs as well.</p>
</section>
</section>
<section id="content-distribution">
<!--OddPage--><h2 id="x7-content-distribution"><span class="secno">7. </span>Content Distribution</h2>
<p>A content distribution request is sent from the Hub to the Subscriber when new content is available for a topic URL. The request is an HTTP [<cite><a class="bibref" href="#bib-RFC7231">RFC7231</a></cite>] (or HTTPS [<cite><a class="bibref" href="#bib-RFC2818">RFC2818</a></cite>]) POST request from the hub to the subscriber's callback URL. The HTTP body of the POST request <em class="rfc2119" title="MUST">MUST</em> include the payload of the content distribution notification. The content distribution request <em class="rfc2119" title="MUST">MUST</em> have a <samp>Content-Type</samp> Header corresponding to the <samp>Content-Type</samp> of the topic, and <em class="rfc2119" title="MUST">MUST</em> contain the full contents of the topic URL, with an exception allowed as described below.
</p>
<p>For Atom ([<cite><a class="bibref" href="#bib-RFC4287">RFC4287</a></cite>]) and RSS ([<cite><a class="bibref" href="#bib-RSS-2.0">RSS-2.0</a></cite>]) feeds, the hub <em class="rfc2119" title="MAY">MAY</em> remove already-delivered <code>atom:entry</code> or <code>rss:item</code> elements from the feed.
</p>
<p>The request <em class="rfc2119" title="MUST">MUST</em> include at least one Link Header [<cite><a class="bibref" href="#bib-RFC5988">RFC5988</a></cite>] with <samp>rel=hub</samp> pointing to a Hub associated with the topic being updated. It <em class="rfc2119" title="MUST">MUST</em> also include one Link Header [<cite><a class="bibref" href="#bib-RFC5988">RFC5988</a></cite>] with <samp>rel=self</samp> set to the canonical URL of the topic being updated. The Hub <em class="rfc2119" title="SHOULD">SHOULD</em> combine these headers into a single Link Header [<cite><a class="bibref" href="#bib-RFC5988">RFC5988</a></cite>]. All these URLs are those resulting from the discovery process (<a href="#discovery">Section 3</a>). The subscriber <em class="rfc2119" title="MUST NOT">MUST NOT</em> use these Link headers to identify the subscription corresponding to the content distribution request, because the Link headers are metadata associated with the topic content, not with any particular subscription. For example, the topic URL in the content distribution request may be different from the topic URL that was originally subscribed to.
</p>
<p>The subscriber's callback URL <em class="rfc2119" title="MUST">MUST</em> return an HTTP [<cite><a class="bibref" href="#bib-RFC7231">RFC7231</a></cite>] 2xx response code to indicate a success. The subscriber's callback URL <em class="rfc2119" title="MAY">MAY</em> return an HTTP 410 code to indicate that the subscription has been deleted, and the hub <em class="rfc2119" title="MAY">MAY</em> terminate the subscription if it receives that code as a response. The hub <em class="rfc2119" title="MUST">MUST</em> consider all other subscriber response codes as failures; that means subscribers <em class="rfc2119" title="MUST NOT">MUST NOT</em> use HTTP redirects for moving subscriptions. Subscribers <em class="rfc2119" title="SHOULD">SHOULD</em> respond to content distribution requests as quickly as possible; their success response code <em class="rfc2119" title="SHOULD">SHOULD</em> only indicate receipt of the message, not acknowledgment that it was successfully processed by the subscriber. The response body from the subscriber <em class="rfc2119" title="MUST">MUST</em> be ignored by the hub. Hubs <em class="rfc2119" title="SHOULD">SHOULD</em> retry content distribution requests up to self-imposed limits on the number of times and the overall time period to retry. When the failing delivery exceeds the hub's limits, the hub stops attempting to deliver that nofication. The hub <em class="rfc2119" title="MUST">MUST</em> keep the subscription active until the end of the lease duration, and if a new update is published to the topic, <em class="rfc2119" title="MUST">MUST</em> continue to retry delivery to the previously-failing subscriber.
</p>
<section id="authenticated-content-distribution">
<h3 id="signing-content"><span class="secno">7.1 </span>Authenticated Content Distribution</h3>
<p>If the subscriber supplied a value for <samp>hub.secret</samp> in their subscription request, the hub <em class="rfc2119" title="MUST">MUST</em> generate an HMAC signature of the payload and include that signature in the request headers of the content distribution request. The <samp>X-Hub-Signature</samp> header's value <em class="rfc2119" title="MUST">MUST</em> be in the form <samp>method=signature</samp> where <samp>method</samp> is one of the recognized algorithm names and <samp>signature</samp> is the hexadecimal representation of the signature. The signature <em class="rfc2119" title="MUST">MUST</em> be computed using the HMAC algorithm [<cite><a class="bibref" href="#bib-RFC6151">RFC6151</a></cite>] with the request body as the data and the <samp>hub.secret</samp> as the key.</p>
<section id="recognized-algorithm-names">
<h4 id="x7-1-1-recognized-algorithm-names"><span class="secno">7.1.1 </span>Recognized algorithm names</h4>
<p>The following algorithms are the initially registered algorithm names, based on the contents of the [<cite><a class="bibref" href="#bib-FIPS-PUB-180-4">FIPS-PUB-180-4</a></cite>] registry at the time of publishing.</p>
<dl>
<dt>sha1</dt>
<dd>The SHA-1 algorithm as specified in Section 6.1 of [<cite><a class="bibref" href="#bib-FIPS-PUB-180-4">FIPS-PUB-180-4</a></cite>]</dd>
<dt>sha256</dt>
<dd>The SHA-256 algorithm as specified in Section 6.2 of [<cite><a class="bibref" href="#bib-FIPS-PUB-180-4">FIPS-PUB-180-4</a></cite>]</dd>
<dt>sha384</dt>
<dd>The SHA-384 algorithm as specified in Section 6.5 of [<cite><a class="bibref" href="#bib-FIPS-PUB-180-4">FIPS-PUB-180-4</a></cite>]</dd>
<dt>sha512</dt>
<dd>The SHA-512 algorithm as specified in Section 6.4 of [<cite><a class="bibref" href="#bib-FIPS-PUB-180-4">FIPS-PUB-180-4</a></cite>]</dd>
</dl>
<p>In the future, an extension may be specified allowing subscribers to indicate which algorithms they can use for validation. As of this writing, most hubs sign with SHA-1, despite its known cryptographic weakness, in order to be interoperable with older subscribers.</p>
</section>
<section id="signature-validation">
<h4 id="x7-1-2-signature-validation"><span class="secno">7.1.2 </span>Signature validation</h4>
<p>When subscribers receive a content distribution request with the <samp>X-Hub-Signature</samp> header specified, they <em class="rfc2119" title="SHOULD">SHOULD</em> recompute the signature with the shared secret using the same method (provided in the <samp>X-Hub-Signature</samp> header) as the hub. If the signature does not match, subscribers <em class="rfc2119" title="MUST">MUST</em> locally ignore the message as invalid. Subscribers <em class="rfc2119" title="MAY">MAY</em> still acknowledge this request with a 2xx response code in order to be able to process the message asynchronously and/or prevent brute-force attempts of the signature. Using this technique along with HTTPS [<cite><a class="bibref" href="#bib-RFC2818">RFC2818</a></cite>] for subscription requests enables simple subscribers to receive authenticated content distribution requests from hubs without the need for subscribers to run an HTTPS [<cite><a class="bibref" href="#bib-RFC2818">RFC2818</a></cite>] server.</p>
<p>Please note however that this signature only ensures that the payload was not forged. Since the request also includes headers, these should not be considered as safe by the subscriber, unless of course the subscriber uses HTTPS [<cite><a class="bibref" href="#bib-RFC2818">RFC2818</a></cite>] callbacks.</p>
</section>
</section>
</section>
<section id="security-considerations">
<!--OddPage--><h2 id="x8-security-considerations"><span class="secno">8. </span>Security Considerations</h2>
<p>Here is a summary of security considerations. It is important to note that WebSub is a server-to-server protocol which relies only on HTTP. It is strongly recommended to use HTTPS for all requests.</p>
<section id="discovery-0">
<h3 id="x8-1-discovery"><span class="secno">8.1 </span>Discovery</h3>
<p>The decision about whether a subscriber should look for <samp>&lt;link&gt;</samp> elements inside a page's <samp>&lt;body&gt;</samp> (as well as the <samp>&lt;head&gt;</samp>) is not straightforward, and there is currently no clear consensus. One reason to ignore the <samp>&lt;body&gt;</samp> during discovery is that some web sites might (perhaps accidentally) allow users to post content containing <samp>&lt;link&gt;</samp> elements, though the working group does not know of any specific examples of such sites. If WebSub discovery uses such <samp>&lt;link&gt;</samp> elements, a user contributing to such sites could potentially maliciously cause all subscribers to use an alternate hub which later delivers malicious content. Given this potential attack, it may be prudent to do discovery only in the <samp>&lt;head&gt;</samp> of HTML documents.</p>
</section>
<section id="subscriptions">
<h3 id="x8-2-subscriptions"><span class="secno">8.2 </span>Subscriptions</h3>
<p>First, subscribers <em class="rfc2119" title="SHOULD">SHOULD</em> always favor the HTTPS URL for hubs (even if the URL is advertised as HTTP). Second, subscribers <em class="rfc2119" title="SHOULD">SHOULD</em> use unique unguessable capability URLs for the callbacks, as well as make them available via HTTPS. Finally, subscribers <em class="rfc2119" title="SHOULD">SHOULD</em> use a <samp>hub.secret</samp> when subscribing to allow signature of the content distribution.</p>
<p>Hubs <em class="rfc2119" title="SHOULD">SHOULD</em> enforce short lived <samp>hub.lease_seconds</samp> (10 days is a good default). When performing intent verification, the hub <em class="rfc2119" title="SHOULD">SHOULD</em> use a random, single-use <samp>hub.challenge</samp>.</p>
</section>
<section id="distribution">
<h3 id="x8-3-distribution"><span class="secno">8.3 </span>Distribution</h3>
<p>The Hub <em class="rfc2119" title="MUST">MUST</em> use the exact callback used by the subscriber (including the use of HTTPS). Hubs <em class="rfc2119" title="MUST">MUST</em> sign their requests using the <samp>hub.secret</samp> supplied by subscribers if requested.</p>
<p>If the subscriber included a hub.secret in the subscription request, the subscriber <em class="rfc2119" title="SHOULD">SHOULD</em> validate the hub's provided signature, and if they do so, they <em class="rfc2119" title="MUST">MUST</em> use the server's stated signature mechanism, and discard requests which fail the test.</p>
<p>If a subscriber does not use a secure callback URL (HTTPS), or if it is suspected that the TLS transport between the hub and subscriber may be compromised, then the integrity of the content delivery notification is only protected by the <samp>hub.secret</samp> and the hashing algorithm used. In this case, an appropriate hashing algorithm should be used based on the security requirements of the application. As SHA-1 has been demonstrated to be compromised as of the date of this publication, a minimum of SHA-256 should be used.</p>
</section>
<section id="security-and-privacy-review">
<h3 id="x8-4-security-and-privacy-review"><span class="secno">8.4 </span>Security and Privacy Review</h3>
<p>These questions provide an overview of security and privacy considerations for this specification as guided by Self-Review Questionnaire: Security and Privacy ([<cite><a class="bibref" href="#bib-security-privacy-questionnaire">security-privacy-questionnaire</a></cite>]).</p>
<dl>
<dt>Does this specification deal with personally-identifiable information?</dt>
<dd>The only potentially personally-identifiable information involved are topic and callback URLs.</dd>
<dt>Does this specification deal with high-value data?</dt>
<dd>No, there is no authentication or other credentials involved.</dd>
<dt>Does this specification introduce new state for an origin that persists across browsing sessions?</dt>
<dd>No.</dd>
<dt>Does this specification expose persistent, cross-origin state to the web?</dt>
<dd>The WebSub subscriber should create a resource with information about the topic to which it subscribes.</dd>
<dt>Does this specification expose any other data to an origin that it doesn't currently have access to?</dt>
<dd>No.</dd>
<dt>Does this specification enable new script execution/loading mechanisms?</dt>
<dd>No.</dd>
<dt>Does this specification allow an origin access to a user's location?</dt>
<dd>No.</dd>
<dt>Does this specification allow an origin access to sensors on a user's device?</dt>
<dd>No.</dd>
<dt>Does this specification allow an origin access to aspects of a user's local computing environment?</dt>
<dd>No.</dd>
<dt>Does this specification allow an origin access to other devices?</dt>
<dd>No.</dd>
<dt>Does this specification allow an origin some measure of control over a user agent's native UI?</dt>
<dd>No.</dd>
<dt>Does this specification expose temporary identifiers to the web?</dt>
<dd>No.</dd>
<dt>Does this specification distinguish between behavior in first-party and third-party contexts?</dt>
<dd>No.</dd>
<dt>How should this specification work in the context of a user agent's "incognito" mode?</dt>
<dd>WebSub is a server to server protocol, in which "incognito" mode does not have a meaning.</dd>
<dt>Does this specification persist data to a user's local device?</dt>
<dd>No.</dd>
<dt>Does this specification allow downgrading default security characteristics?</dt>
<dd>No.</dd>
</dl>
</section>
</section>
<section class="appendix informative" id="acknowledgements">
<!--OddPage--><h2 id="a-acknowledgements"><span class="secno">A. </span>Acknowledgements</h2><p><em>This section is non-normative.</em></p>
<p>The editors wish to thank the authors of PubSubHubbub, the IndieWeb community, and other implementers for their support, encouragement and enthusiasm. In particular, the editors wish to thank
<a href="https://bradfitz.com/">Brad Fitzpatrick</a>,
<a href="http://www.onebigfluke.com/">Brett Slatkin</a>,
<a href="http://martin.atkins.me.uk/">Martin Atkins</a>,
<a href="http://rhiaro.co.uk/">Amy Guy</a>,
<a href="https://barryfrost.com/">Barry Frost</a>,
<a href="https://ben.thatmustbe.me/">Benjamin Roberts</a>,
<a href="https://zeonfederated.com/">Eugen Rochko</a>,
<a href="https://github.com/twitch-jordanpotter">Jordan Potter</a>,
<a href="https://notiz.blog/">Matthias Pfefferle</a>,
<a href="https://unicyclic.com/mal/">Malcolm Blaney</a>,
<a href="https://ma.rtendevri.es/">Marten de Vries</a>,
<a href="http://hawke.org/sandro/">Sandro Hawke</a>,
<a href="http://tantek.com/">Tantek Çelik</a>,
and
<a href="https://eighty-twenty.org/">Tony Garnock-Jones</a>.
</p></section>
<section class="appendix informative" id="change-log">
<!--OddPage--><h2 id="b-change-log"><span class="secno">B. </span>Change Log</h2><p><em>This section is non-normative.</em></p>
<section id="changes-from-03-october-2017-pr-to-this-version">
<h3 id="b-1-changes-from-03-october-2017-pr-to-this-version"><span class="secno">B.1 </span>Changes from 03 October 2017 PR to this version</h3>
<ul>
<li>Added link to content negotiation section from corresponding item in conformance criteria</li>
<li>Updated reference name from "WHATWG-URL" to "[<cite><a class="bibref" href="#bib-URL">URL</a></cite>]", but does not change the actual reference.</li>
<li>Rephrase sentence on hub URL discovery to better clarify which URLs are being talked about, and use "notify" instead of "ping"</li>
<li>Correct "mime-type" to "Media Type" and add informative reference to RFC.</li>
<li>Rephrase summary of "subscribing and unsubscribing" to explicitly mention the actor of each step</li>
<li>Clarify sending the POST request to the subscriber's callback URL</li>
<li>Add reference to HTTPS when previously only HTTP was mentioned in cases where an HTTPS URL may be used</li>
<li>Clarify when hub.lease_seconds parameter is required or optional</li>
<li>Reword section on subscription migration to make it more clear</li>
<li>Move note about publisher-&gt;hub notification outside of the subscription migration section</li>
<li>Remove references to "notification" as a standalone term, replaced by "content distribution request" or "content distribution notification" as appropriate</li>
<li>Update CR exit criteria text to past tense</li>
<li>Added explanatory text about why a publisher may advertise multiple hubs</li>
<li>Replaced sentence in section 8 to better describe the situation "the topic URL in the content distribution request may be different from the topic URL that was originally subscribed to"</li>
<li>Dropped at-risk limitation of the link tag in the head</li>
<li>Added security consideration for discovery related to link rel discovery in body vs head</li>
<li>Dropped unused feature of the hub rejecting the subscription and providing an alternate topic URL</li>
<li>Added sequence diagram in high-level overview section, and minor updates to phrasing of that section</li>
<li>Added acknowledgements</li>
<li>Note that hubs may set a default value for lease_seconds</li>
</ul>
</section>
<section id="changes-from-11-april-2017-cr-to-03-october-2017-pr">
<h3 id="b-2-changes-from-11-april-2017-cr-to-03-october-2017-pr"><span class="secno">B.2 </span>Changes from 11 April 2017 CR to 03 October 2017 PR</h3>
<ul>
<li>Adds informative guidelines for how publishers can migrate subscribers to a new topic URL</li>
<li>Allow subscribers to reject invalid signatures with response codes other than 2xx</li>
<li>Suggest subscribers return HTTP 410 if a subscription has been deleted</li>
<li>Add informative note about the lack of specification of publisher-hub relationship</li>
<li>Drop at-risk <code>.host-meta</code> discovery feature due to lack of implementations (<a href="https://github.com/w3c/websub/issues/97">Issue #97</a>)</li>
<li>Add text to note the subscriber's <code>hub.secret</code> should be cryptographically random and unique</li>
<li>Clarify that failed delivery of notifications should not delete the subscription before the lease duration ends (<a href="https://github.com/w3c/websub/issues/119">Issue #119</a>)</li>
<li>Replaced note about referring to FIPS document for algorithm extensions with a note that says a proper WebSub extension should be defined in the future that enables negotiation of the hashing algorithm between subscribers and hubs</li>
<li>Add example of returning a different rel=self URL depending on the HTTP <code>Accept-Language</code> header</li>
<li>Add a note in Security Considerations about the hashing algorithm protecting against a compromised TLS channel</li>
<li>Clarify security consideration section regarding signature validation</li>
<li>Moved "at risk" section out of the "sotd" section which was causing a respec error</li>
<li>Replaced hyperlink to FIPS PUB 180-4 with an in-page reference</li>
</ul>
</section>
<section id="changes-from-24-november-wd-to-11-april-2017-cr">
<h3 id="b-3-changes-from-24-november-wd-to-11-april-2017-cr"><span class="secno">B.3 </span>Changes from 24 November WD to 11 April 2017 CR</h3>
<ul>
<li>Clarified wording on supported algorithms for authenticated distribution</li>
<li>Only allow <code>&lt;link&gt;</code> tags in the HTML &lt;head&gt; element</li>
<li>Added conformance criteria and CR exit criteria</li>
<li>Added examples of discovery request and response</li>
<li>Added example of using different <code>rel=self</code> URLs to support content negotiation</li>
<li>Added a security considerations section</li>
<li>Updated references to WHATWG-URL instead of HTML 4</li>
<li>Replaced abstract with updated description</li>
</ul>
</section>
<section id="changes-from-20-october-fpwd-to-24-november-2016">
<h3 id="b-4-changes-from-20-october-fpwd-to-24-november-2016"><span class="secno">B.4 </span>Changes from 20 October FPWD to 24 November 2016</h3>
<ul>
<li>Added informative reference to previous versions of the spec, PubSubHubbub 0.3 and 0.4</li>
<li>Split discovery section into separate publisher and subscriber sections</li>
<li>Clarify that publishers can use any available discovery method, and subscribers must support all</li>
<li>Marked host-meta discovery method At Risk due to no known implementations, and fixed reference to Host Meta spec instead of the previous reference to Well-Known</li>
<li>Recommend using Capability URLs as the subscriber's callback URLs for security and authenticating the notification delivery</li>
<li>Recommend not reusing callback URLs on subscription renewals</li>
<li>Clarify that the <code>hub.topic</code> must be the <code>self</code> URL that was discovered</li>
<li>Dropped the recommendation of including the <code>From</code> header on subscription requests</li>
<li>Clarify that the hub response to subscription requests must not depend on the verification or validation</li>
<li>Hubs must enforce lease expirations</li>
<li>Clarify that the notification payload should contain the full contents of the topic URL</li>
<li>Recommend that hubs should retry failed notification delivery up to self-imposed limits</li>
<li>Clarify that future defined signature methods in FIPS PUB 180-4 are allowed</li>
<li>Added informative note about the use of GET vs POST at the callback URL</li>
<li>Renamed the spec to WebSub</li>
</ul>
</section>
</section>
<script>
// After text is selected (mouseup), find the closest element that has an ID
// attribute, and update the browser location bar to include that as the fragment
document.body.onmouseup = function(){
var selection;
if(selection=window.getSelection()) {
var range = selection.getRangeAt(0);
var el = range.startContainer;
while((el=el.parentElement) && !el.attributes["id"]);
var hash = el.attributes["id"].value;
if(history.replaceState) {
history.replaceState(null, null, "#"+hash);
}
}
};
</script>
<section id="references" class="appendix"><!--OddPage--><h2 id="c-references"><span class="secno">C. </span>References</h2><section id="normative-references"><h3 id="c-1-normative-references"><span class="secno">C.1 </span>Normative references</h3><dl class="bibliography"><dt id="bib-Encoding">[Encoding]</dt><dd><a href="https://encoding.spec.whatwg.org/"><cite>Encoding Standard</cite></a>. Anne van Kesteren. WHATWG. Living Standard. URL: <a href="https://encoding.spec.whatwg.org/">https://encoding.spec.whatwg.org/</a>
</dd><dt id="bib-HTML5">[HTML5]</dt><dd><a href="https://www.w3.org/TR/html5/"><cite>HTML5</cite></a>. Ian Hickson; Robin Berjon; Steve Faulkner; Travis Leithead; Erika Doyle Navara; Theresa O'Connor; Silvia Pfeiffer. W3C. 28 October 2014. W3C Recommendation. URL: <a href="https://www.w3.org/TR/html5/">https://www.w3.org/TR/html5/</a>
</dd><dt id="bib-RFC2119">[RFC2119]</dt><dd><a href="https://tools.ietf.org/html/rfc2119"><cite>Key words for use in RFCs to Indicate Requirement Levels</cite></a>. S. Bradner. IETF. March 1997. Best Current Practice. URL: <a href="https://tools.ietf.org/html/rfc2119">https://tools.ietf.org/html/rfc2119</a>
</dd><dt id="bib-RFC2818">[RFC2818]</dt><dd><a href="https://tools.ietf.org/html/rfc2818"><cite>HTTP Over TLS</cite></a>. E. Rescorla. IETF. May 2000. Informational. URL: <a href="https://tools.ietf.org/html/rfc2818">https://tools.ietf.org/html/rfc2818</a>
</dd><dt id="bib-RFC5988">[RFC5988]</dt><dd><a href="https://tools.ietf.org/html/rfc5988"><cite>Web Linking</cite></a>. M. Nottingham. IETF. October 2010. Proposed Standard. URL: <a href="https://tools.ietf.org/html/rfc5988">https://tools.ietf.org/html/rfc5988</a>
</dd><dt id="bib-RFC6151">[RFC6151]</dt><dd><a href="https://tools.ietf.org/html/rfc6151"><cite>Updated Security Considerations for the MD5 Message-Digest and the HMAC-MD5 Algorithms</cite></a>. S. Turner; L. Chen. IETF. March 2011. Informational. URL: <a href="https://tools.ietf.org/html/rfc6151">https://tools.ietf.org/html/rfc6151</a>
</dd><dt id="bib-RFC7230">[RFC7230]</dt><dd><a href="https://tools.ietf.org/html/rfc7230"><cite>Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing</cite></a>. R. Fielding, Ed.; J. Reschke, Ed.. IETF. June 2014. Proposed Standard. URL: <a href="https://tools.ietf.org/html/rfc7230">https://tools.ietf.org/html/rfc7230</a>
</dd><dt id="bib-RFC7231">[RFC7231]</dt><dd><a href="https://tools.ietf.org/html/rfc7231"><cite>Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content</cite></a>. R. Fielding, Ed.; J. Reschke, Ed.. IETF. June 2014. Proposed Standard. URL: <a href="https://tools.ietf.org/html/rfc7231">https://tools.ietf.org/html/rfc7231</a>
</dd><dt id="bib-URL">[URL]</dt><dd><a href="https://url.spec.whatwg.org/"><cite>URL Standard</cite></a>. Anne van Kesteren. WHATWG. Living Standard. URL: <a href="https://url.spec.whatwg.org/">https://url.spec.whatwg.org/</a>
</dd></dl></section><section id="informative-references"><h3 id="c-2-informative-references"><span class="secno">C.2 </span>Informative references</h3><dl class="bibliography"><dt id="bib-capability-urls">[capability-urls]</dt><dd><a href="https://www.w3.org/TR/capability-urls/"><cite>Good Practices for Capability URLs</cite></a>. Jeni Tennison. W3C. 18 February 2014. W3C Working Draft. URL: <a href="https://www.w3.org/TR/capability-urls/">https://www.w3.org/TR/capability-urls/</a>
</dd><dt id="bib-FIPS-PUB-180-4">[FIPS-PUB-180-4]</dt><dd><a href="http://dx.doi.org/10.6028/NIST.FIPS.180-4"><cite>Secure Hash Standard (SHS)</cite></a>. National Institute of Standards and Technology. U.S. Department of Commerce. URL: <a href="http://dx.doi.org/10.6028/NIST.FIPS.180-4">http://dx.doi.org/10.6028/NIST.FIPS.180-4</a>
</dd><dt id="bib-PubSubHubbub-Core-0.3">[PubSubHubbub-Core-0.3]</dt><dd><a href="https://pubsubhubbub.github.io/PubSubHubbub/pubsubhubbub-core-0.3.html"><cite>PubSubHubbub Core 0.3 -- Working Draft</cite></a>. B. Fitzpatrick; B. Slatkin; M. Atkins.URL: <a href="https://pubsubhubbub.github.io/PubSubHubbub/pubsubhubbub-core-0.3.html">https://pubsubhubbub.github.io/PubSubHubbub/pubsubhubbub-core-0.3.html</a>
</dd><dt id="bib-PubSubHubbub-Core-0.4">[PubSubHubbub-Core-0.4]</dt><dd><a href="https://pubsubhubbub.github.io/PubSubHubbub/pubsubhubbub-core-0.4.html"><cite>PubSubHubbub Core 0.4 -- Working Draft</cite></a>. B. Fitzpatrick; B. Slatkin; M. Atkins; J. Genestoux.URL: <a href="https://pubsubhubbub.github.io/PubSubHubbub/pubsubhubbub-core-0.4.html">https://pubsubhubbub.github.io/PubSubHubbub/pubsubhubbub-core-0.4.html</a>
</dd><dt id="bib-RFC4287">[RFC4287]</dt><dd><a href="https://tools.ietf.org/html/rfc4287"><cite>The Atom Syndication Format</cite></a>. M. Nottingham, Ed.; R. Sayre, Ed.. IETF. December 2005. Proposed Standard. URL: <a href="https://tools.ietf.org/html/rfc4287">https://tools.ietf.org/html/rfc4287</a>
</dd><dt id="bib-RFC6838">[RFC6838]</dt><dd><a href="https://tools.ietf.org/html/rfc6838"><cite>Media Type Specifications and Registration Procedures</cite></a>. N. Freed; J. Klensin; T. Hansen. IETF. January 2013. Best Current Practice. URL: <a href="https://tools.ietf.org/html/rfc6838">https://tools.ietf.org/html/rfc6838</a>
</dd><dt id="bib-RSS-2.0">[RSS-2.0]</dt><dd><a href="http://www.rssboard.org/rss-specification"><cite>RSS 2.0</cite></a>. Dave Winer. RSS Board. Stable. URL: <a href="http://www.rssboard.org/rss-specification">http://www.rssboard.org/rss-specification</a>
</dd><dt id="bib-security-privacy-questionnaire">[security-privacy-questionnaire]</dt><dd><a href="https://www.w3.org/TR/security-privacy-questionnaire/"><cite>Self-Review Questionnaire: Security and Privacy</cite></a>. Mike West. W3C. 10 December 2015. W3C Note. URL: <a href="https://www.w3.org/TR/security-privacy-questionnaire/">https://www.w3.org/TR/security-privacy-questionnaire/</a>
</dd></dl></section></section><p role="navigation" id="back-to-top"><a href="#toc"><abbr title="Back to Top">↑</abbr></a></p><script src="https://www.w3.org/scripts/TR/2016/fixup.js"></script></body></html>