discovery-api/Overview.src.html
changeset 230 3c13dc93cfb1
parent 216 5583626294f6
child 231 a0e6b501258d
     1.1 --- a/discovery-api/Overview.src.html	Tue Sep 25 11:20:35 2012 +0200
     1.2 +++ b/discovery-api/Overview.src.html	Tue Sep 25 12:48:42 2012 +0200
     1.3 @@ -8,7 +8,7 @@
     1.4            specStatus:   "ED",
     1.5            //publishDate:  "2012-08-22",
     1.6            shortName:    "discovery-api",
     1.7 -          edDraftURI:   "http://w3c-test.org/dap/discovery-api/",
     1.8 +          edDraftURI:   "http://dvcs.w3.org/hg/dap/raw-file/tip/discovery-api/Overview.html",
     1.9            previousMaturity: "WD",
    1.10            previousPublishDate: "2012-08-07",
    1.11            editors: [
    1.12 @@ -218,10 +218,17 @@
    1.13        <p>
    1.14          A <dfn>valid service type</dfn> is a string that begins with <code>upnp:</code> or <code>zeroconf:</code> followed by one or more characters in the ranges U+0021, U+0023 to U+0027, U+002A to U+002B, U+002D to U+002E, U+0030 to U+0039, U+0041 to U+005A, U+005E to U+007E.
    1.15        </p>
    1.16 +      <p></p>
    1.17  
    1.18        <p>
    1.19 -        A <a>valid service type</a> provided in the <code>type</code> attribute of the <code>getNetworkServices()</code> method will be matched against the services currently contained in the <a>list of available service records</a> according to the algorithms defined in this specification.
    1.20 +        A <a>valid service type</a> provided in the <code>type</code> attribute of the <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> method will be matched against the services currently contained in the <a>list of available service records</a> according to the algorithms defined in this specification.
    1.21        </p>
    1.22 +
    1.23 +      <p>
    1.24 +        A <dfn>user-agent generated callback url</dfn> is a Local-network accessible URL endpoint that a <a>user agent</a> must generate and maintain for receiving HTTP NOTIFY requests from UPnP Event sources. It is only required when the user agent implements UPnP Service Discovery as defined in
    1.25 +        this specification.
    1.26 +      </p>
    1.27 +
    1.28      </section>
    1.29  
    1.30      <section>
    1.31 @@ -423,7 +430,7 @@
    1.32              </li>
    1.33  
    1.34              <li>
    1.35 -              Store the set of <var>services</var> as <dfn id="current_authorized_services">current authorized services</dfn> internally against the newly created <var>services manager</var> object.
    1.36 +              Add the set of <var>services</var> to the <a>list of authorized service records</a> internally against the newly created <var>services manager</var> object.
    1.37              </li>
    1.38  
    1.39              <li>
    1.40 @@ -542,7 +549,7 @@
    1.41            </dt>
    1.42            <dd>
    1.43              <p>
    1.44 -              Returns the current number of services in the respective object's <a>current authorized services</a>.
    1.45 +              Returns the current number of services belonging in the respective object's <a>list of authorized service records</a>.
    1.46              </p>
    1.47            </dd>
    1.48            <dt>
    1.49 @@ -559,7 +566,7 @@
    1.50  
    1.51          <div>
    1.52             <p>
    1.53 -              The <dfn id="dom-networkservices-length"><code>length</code></dfn> attribute MUST return the number of services represented in the object's corresponding <a>current authorized services</a> list at the time of getting.
    1.54 +              The <dfn id="dom-networkservices-length"><code>length</code></dfn> attribute MUST return the number of services represented in the object's corresponding <a>list of authorized service records</a> at the time of getting.
    1.55             </p>
    1.56  
    1.57             <p>
    1.58 @@ -623,24 +630,24 @@
    1.59        </dl>
    1.60  
    1.61        <p>
    1.62 -        A <a href="#networkservices"><code>NetworkServices</code></a> object represents the current list of zero or more <a>current authorized services</a>, of which zero or more can be available at a time. Each item in <a>current authorized services</a> is represented by a <a href="#networkservice"><code>NetworkService</code></a> object. The list of <a>current authorized services</a> is <span>immutable</span> meaning that it cannot be modified for the lifetime of a <a href="#networkservices"><code>NetworkServices</code></a> object.
    1.63 +        A <a href="#networkservices"><code>NetworkServices</code></a> object represents the current list of one or more current authorized services - the <a>list of authorized service records</a>. Each item in the <a>list of authorized service records</a> is represented by a <a href="#networkservice"><code>NetworkService</code></a> object. The <a>list of authorized service records</a> is <span>immutable</span> meaning that it cannot be modified for the lifetime of a <a href="#networkservices"><code>NetworkServices</code></a> object.
    1.64        </p>
    1.65  
    1.66        <p class="note">
    1.67 -        Each service in a <a href="#networkservices"><code>NetworkServices</code></a> object thus has an index; the first has the index 0, and each subsequent service is numbered one higher than the previous one. If the <a>user agent</a> dynamically adds or removes network services for any reason, then the indices of the services in <a>current authorized services</a> will change dynamically. If the set of network services changes entirely, then all the previous services will be removed from <a>current authorized services</a> and replaced with new services.
    1.68 +        Each service in a <a href="#networkservices"><code>NetworkServices</code></a> object thus has an index; the first has the index 0, and each subsequent service is numbered one higher than the previous one.
    1.69        </p>
    1.70  
    1.71        <p>
    1.72 -        The <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#supported-property-indices" class="externalDFN">supported property indices</a> of <a href="#networkservices"><code>NetworkServices</code></a> objects at any instant are the numbers from zero to the number of items in <a>current authorized services</a> represented by the respective object minus one, if any services are represented in <a>current authorized services</a>. If a <a href="#networkservices"><code>NetworkServices</code></a> object represents no <a>current authorized services</a>, it has no <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#supported-property-indices" class="externalDFN">supported property indices</a>.
    1.73 +        The <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#supported-property-indices" class="externalDFN">supported property indices</a> of <a href="#networkservices"><code>NetworkServices</code></a> objects at any instant are the numbers from zero to the number of items in the <a>list of authorized service records</a> represented by the respective object minus one, if any services are represented in the <a>list of authorized service records</a>.
    1.74        </p>
    1.75  
    1.76        <p>
    1.77 -        To <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#determine-the-value-of-an-indexed-property" class="externalDFN">determine the value of an indexed property</a> for a given index <var>index</var> in a <a href="#networkservices"><code>NetworkServices</code></a> object's <a>current authorized services</a>, the user agent MUST return the <a href="#networkservice"><code>NetworkService</code></a> object that represents the <var>index</var>th service in <a>current authorized services</a>.
    1.78 +        To <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#determine-the-value-of-an-indexed-property" class="externalDFN">determine the value of an indexed property</a> for a given index <var>index</var> in a <a href="#networkservices"><code>NetworkServices</code></a> object's <a>list of authorized service records</a>, the user agent MUST return the <a href="#networkservice"><code>NetworkService</code></a> object that represents the <var>index</var>th service in the <a>list of authorized service records</a>.
    1.79        </p>
    1.80  
    1.81        <p>
    1.82 -        The <dfn id="dom-networkservices-getservicebyid"><code>getServiceById(id)</code></dfn> method MUST return the first <a href="#networkservice"><code>NetworkService</code></a> object in <a>current authorized services</a> represented by the respective object whose <a href="#dom-networkservice-id"><code>id</code></a> attribute is equal to the value of the <var>id</var> argument.
    1.83 -        When no services in <a>current authorized services</a> match the given argument, the method MUST return null.
    1.84 +        The <dfn id="dom-networkservices-getservicebyid"><code>getServiceById(id)</code></dfn> method MUST return the first <a href="#networkservice"><code>NetworkService</code></a> object in the <a>list of authorized service records</a> represented by the respective object whose <a href="#dom-networkservice-id"><code>id</code></a> attribute is equal to the value of the <var>id</var> argument.
    1.85 +        When no services in the <a>list of authorized service records</a> match the given argument, the method MUST return null.
    1.86        </p>
    1.87  
    1.88        <p>
    1.89 @@ -911,7 +918,7 @@
    1.90        </p>
    1.91        <p>
    1.92           This section presents how the results of these two service discovery
    1.93 -         mechanisms will be matched to requested service types and how their properties will be applied to any resulting <a href="#networkservice"><code>NetworkService</code></a> objects.
    1.94 +         mechanisms will be matched to requested service types, how the user agent stores available and active services, how their properties are applied to any resulting <a href="#networkservice"><code>NetworkService</code></a> objects.
    1.95        </p>
    1.96  
    1.97        <p>
    1.98 @@ -921,12 +928,155 @@
    1.99        </p>
   1.100  
   1.101        <p>
   1.102 -         The <dfn>list of available service records</dfn> is a single dynamic internal lookup table within user agents that is used to track the current services available in the network at any given time.
   1.103 +         The <dfn>list of available service records</dfn> is a single dynamic internal lookup table within user agents that is used to track all the  services that have been discovered and are available in the current network at any given time.
   1.104           At any point during the running of either of the two service discovery mechanisms then existing entries within this table can be updated, entries can be added and entries can be removed as the status of networked
   1.105 -         services changes. Each record contained within this table contains the attributes: <code>id</code>, <code>name</code>, <code>type</code>, <code>url</code> and <code>config</code>.
   1.106 +         services changes according to the rules defined in this specification. <!--Each record contained within this table contains the attributes: <code>id</code>, <code>deviceId</code>, <code>name</code>, <code>type</code>, <code>url</code>, <code>config</code> and <code>expiryTimestamp</code>.-->
   1.107        </p>
   1.108  
   1.109 -            <section>
   1.110 +      <p>
   1.111 +        The <dfn>list of authorized service records</dfn> is a single dynamic internal lookup table within user agents that is used to track the
   1.112 +        current services that are being shared with web pages at any given time from the <a>list of available service records</a>. Each record in the <a>list of authorized service records</a> is associated with a <var>services manager</var> object that is assigned as part of the
   1.113 +         <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> algorithm.
   1.114 +      </p>
   1.115 +
   1.116 +      <p>
   1.117 +        The rule for <dfn>adding an available service</dfn> is the process of adding a new service or updating an existing service in the <a>list of available service records</a> that is generally available on the user's current network. This rule takes one argument, <var>network service record</var>, and consists of
   1.118 +        running the following steps:
   1.119 +      </p>
   1.120 +
   1.121 +      <ol class="rule">
   1.122 +
   1.123 +        <li>
   1.124 +          Let <var>new service registration flag</var> be <code>true</code>.
   1.125 +        </li>
   1.126 +
   1.127 +        <li>
   1.128 +           For each <var>existing service record</var> in the current <a>list of available service records</a>, run the following sub-steps:
   1.129 +           <ol class="rule">
   1.130 +
   1.131 +             <li>
   1.132 +              If the <var>existing service record</var>'s <code>id</code> property does not equal <var>network service record</var>'s <code>id</code>
   1.133 +               property then abort any remaining sub-steps and continue at the next available <var>existing service record</var>.
   1.134 +             </li>
   1.135 +
   1.136 +             <li>
   1.137 +              Set <var>new service registration flag</var> to <code>false</code>.
   1.138 +             </li>
   1.139 +
   1.140 +             <li>
   1.141 +               Replace the value of <var>existing service record</var> in the current <a>list of available service records</a> with the value of
   1.142 +              <var>network service record</var>.
   1.143 +             </li>
   1.144 +           </ol>
   1.145 +        </li>
   1.146 +
   1.147 +        <li>
   1.148 +           If <var>new service registration flag</var> is set to <code>true</code> then add <var>network service record</var> to the <a>list of available service records</a> as a new entry.
   1.149 +        </li>
   1.150 +
   1.151 +        <li>
   1.152 +          For each <var>active service</var> in the <a>list of authorized service records</a> run the following steps:
   1.153 +
   1.154 +          <ol class="rule">
   1.155 +
   1.156 +            <li>
   1.157 +               If <var>network service record</var>'s <code>type</code> property does not equal the current <var>active service</var>'s
   1.158 +                <code>type</code> attribute then abort any remaining sub-steps for this <var>active service</var> and continue at the next available <var>active service</var>.
   1.159 +            </li>
   1.160 +
   1.161 +            <li>
   1.162 +               If the <var>new service registration flag</var> is set to <code>true</code> then increment the <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute of the <var>services manager</var> associated with
   1.163 +               the current <var>active service</var>
   1.164 +                object by <code>1</code> and then <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a>
   1.165 +                 to dispatch a newly created event with the name <a href="#dom-networkservices-onserviceavailable"><code>serviceavailable</code></a> that uses the <code>Event</code> interface,
   1.166 +                 which does not bubble, is not cancellable, and has no default action, at the <var>services manager</var> associated with
   1.167 +                 the current <var>active service</var> object.
   1.168 +            </li>
   1.169 +
   1.170 +            <li>
   1.171 +               <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">Queue a task</a>
   1.172 +                to dispatch a newly created event with the name <a href="#dom-networkservice-onserviceonline"><code>serviceonline</code></a> that uses the <code>Event</code> interface, which
   1.173 +                 does not bubble, is not cancellable, and has no default action, at the current
   1.174 +                <var>active service</var> object.
   1.175 +            </li>
   1.176 +
   1.177 +          </ol>
   1.178 +
   1.179 +        </li>
   1.180 +
   1.181 +      </ol>
   1.182 +
   1.183 +
   1.184 +      <p>
   1.185 +        The rule for <dfn>removing an available service</dfn> is the general process of removing a service from the
   1.186 +        <a>list of available service records</a>
   1.187 +         that has left the user's current network or has otherwise expired. This rule takes one argument, <var>service identifier</var>, and consists of running the following steps:</p>
   1.188 +
   1.189 +      <ol class="rule">
   1.190 +
   1.191 +        <li>
   1.192 +           For each <var>existing service record</var> in the current <a>list of available service records</a>, run the following sub-steps:
   1.193 +           <ol class="rule">
   1.194 +
   1.195 +             <li>
   1.196 +              If the <var>existing service record</var>'s <code>id</code> property does not match <var>service identifier</var> then skip any remaining sub-steps for the current <var>existing service record</var> and continue at the next available <var>existing service record</var>.
   1.197 +             </li>
   1.198 +
   1.199 +             <li>
   1.200 +               If the <var>existing service record</var>'s <code>type</code> property begins with the DOMString "<code>upnp:</code>" and
   1.201 +               <var>existing service record</var>'s <code>eventsURL</code> property is set then run the rule to
   1.202 +               <a>terminate an existing UPnP Events Subscription</a>, if one is currently active (as a result of having previously called
   1.203 +               <a>setup a UPnP Events Subscription</a> against the current <var>existing service record</var>).
   1.204 +             </li>
   1.205 +
   1.206 +             <li>
   1.207 +               For each <var>active service</var> in <a>list of authorized service records</a> run the following steps:
   1.208 +
   1.209 +               <ol class="rule">
   1.210 +
   1.211 +                 <li>
   1.212 +                    If <var>existing service record</var>'s <code>type</code> property does not equal the current <var>active service</var>'s
   1.213 +                     <code>type</code> attribute then abort any remaining sub-steps for this <var>active service</var> and continue at the next available <var>active service</var>.
   1.214 +                 </li>
   1.215 +
   1.216 +                 <li>
   1.217 +                    Decrement the <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute of the
   1.218 +                    <var>services manager</var> associated with the current <var>active service</var>
   1.219 +                     object by <code>1</code> and then <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a>
   1.220 +                      to dispatch a newly created event with the name <a href="#dom-networkservices-onserviceunavailable"><code>serviceunavailable</code></a> that uses the <code>Event</code> interface,
   1.221 +                      which does not bubble, is not cancellable, and has no default action, at the <var>services manager</var> associated with
   1.222 +                      the current <var>active service</var> object.
   1.223 +                 </li>
   1.224 +
   1.225 +                 <li>
   1.226 +                    <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">Queue a task</a>
   1.227 +                     to dispatch a newly created event with the name <a href="#dom-networkservice-onserviceoffline"><code>serviceoffline</code></a> that uses the <code>Event</code> interface, which
   1.228 +                      does not bubble, is not cancellable, and has no default action, at the current
   1.229 +                     <var>active service</var> object.
   1.230 +                 </li>
   1.231 +
   1.232 +               </ol>
   1.233 +
   1.234 +             </li>
   1.235 +
   1.236 +             <li>
   1.237 +               Remove <var>existing service record</var> from the current <a>list of available service records</a>.
   1.238 +             </li>
   1.239 +
   1.240 +           </ol>
   1.241 +        </li>
   1.242 +
   1.243 +      </ol>
   1.244 +
   1.245 +      <p>
   1.246 +       User agents <em class="ct">SHOULD</em> expire a service record from the <a>list of available service records</a> when its
   1.247 +       <code>expiryTimestamp</code> attribute exceeds the current UTC timestamp. When this condition is met the <a>user agent</a> SHOULD
   1.248 +       run the rule for <a>removing an available service</a>, passing in the expired service record's <code>id</code> attribute as the
   1.249 +       only argument.
   1.250 +      </p>
   1.251 +
   1.252 +
   1.253 +      <section>
   1.254           <h4>Zeroconf (<abbr title="Multicast DNS">mDNS</abbr> + <abbr title="Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr>)</h4>
   1.255  
   1.256           <p>
   1.257 @@ -942,7 +1092,7 @@
   1.258                 <ol>
   1.259  
   1.260                    <li>
   1.261 -                     Let <var>network service record</var> be an Object consisting of the following empty properties: <code>id</code>, <code>name</code>, <code>type</code>, <code>url</code>, <code>config</code>.
   1.262 +                     Let <var>network service record</var> be an Object consisting of the following empty properties: <code>id</code>, <code>name</code>, <code>type</code>, <code>url</code>, <code>config</code>, <code>expiryTimestamp</code>.
   1.263                    </li>
   1.264  
   1.265                    <li>
   1.266 @@ -966,45 +1116,14 @@
   1.267                    </li>
   1.268  
   1.269                    <li>
   1.270 -                     For each Object <var>existing service record</var> in the current <a>list of available service records</a>, run the following sub-steps:
   1.271 -                     <ol class="rule">
   1.272 -
   1.273 -                       <li>
   1.274 -                        If the <var>existing service record</var>'s <code>id</code> property matches the value of the <var>network service record</var>'s <code>id</code>, then set the
   1.275 -                        value of <var>existing service record</var> in the current <a>list of available service records</a>  to the value of the
   1.276 -                        <var>network service record</var> and skip the next step.
   1.277 -                       </li>
   1.278 -                     </ol>
   1.279 +                     Set <var>network service record</var>'s <code>expiryTimestamp</code> property to the value of the current date, in UTC timestamp format, plus a value of <code>120</code> seconds.
   1.280                    </li>
   1.281  
   1.282                    <li>
   1.283 -                     Add <var>network service record</var> to the <a>list of available service records</a>.
   1.284 +                     Run the general rule for <a>adding an available service</a>, passing in the current <var>network service record</var> as the
   1.285 +                     only argument.
   1.286                    </li>
   1.287  
   1.288 -                  <li>
   1.289 -                     For each non-garbage collected <a href="#networkservice"><code>NetworkService</code></a> object run the following steps:
   1.290 -
   1.291 -                     <ol class="rule">
   1.292 -                        <li>
   1.293 -                           If the <a href="#networkservice"><code>NetworkService</code></a> object's <code>type</code> attribute does not equal the
   1.294 -                           current <a>network service record</a>'s <code>type</code> property then continue at the next available active
   1.295 -                           <a href="#networkservice"><code>NetworkService</code></a> object.
   1.296 -                        </li>
   1.297 -                        <li>
   1.298 -                           Increment the <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute of the <a href="#networkservices"><code>NetworkServices</code></a> object by <code>1</code>.
   1.299 -                        </li>
   1.300 -                        <li>
   1.301 -                          <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">Queue a task</a>
   1.302 -                           to dispatch a newly created event with the name <code>serviceavailable</code> that uses the <code>Event</code> interface, which does not bubble, is not cancellable, and has no default action, at the current
   1.303 -                            <a href="#networkservices"><code>NetworkServices</code></a> object.
   1.304 -                        </li>
   1.305 -                        <li>
   1.306 -                          <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">Queue a task</a>
   1.307 -                           to dispatch a newly created event with the name <code>serviceonline</code> that uses the <code>Event</code> interface, which does not bubble, is not cancellable, and has no default action, at the current
   1.308 -                           <a href="#networkservice"><code>NetworkService</code></a> object.
   1.309 -                        </li>
   1.310 -                     </ol>
   1.311 -                  </li>
   1.312              </ol>
   1.313             </li>
   1.314           </ol>
   1.315 @@ -1015,126 +1134,165 @@
   1.316           <h5>Universal Plug-and-Play (<abbr title="Universal Plug-and-Play">UPnP</abbr>)</h5>
   1.317  
   1.318           <p>
   1.319 -            For each SSDP Presence Announcement [[!UPNP-DEVICEARCH11]] - a HTTP NOTIFY request - received from a user-agent-initiated SSDP Discovery Request [[!UPNP-DEVICEARCH11]], the <a>user agent</a> MUST run the following steps:
   1.320 +          A user agent that implements UPnP service discovery must issue an <dfn>advertisement for UPnP root devices</dfn> against the user's
   1.321 +          current local network according to the full normative text and timing provided in 'Section 1.3.2: Search request with M-SEARCH' detailed in [[!UPNP-DEVICEARCH11]].
   1.322 +          </p>
   1.323 +
   1.324 +          <p>
   1.325 +            The user agent <em class="ct">MUST</em> issue all <a title="advertisement for UPnP root devices">advertisements for UPnP root devices</a> with a HTTP request line equal to <code>M-SEARCH * HTTP/1.1</code>, with a HOST header equal to the reserved multicast address and port of <code>239.255.255.250:1900</code>, a MAN header equal to <code>ssdp:discover</code>, an ST header equal to <code>upnp:rootdevice</code> and a user-agent defined MX header equal to a <dfn>maximum UPnP advertisement response wait time</dfn> value between <code>1</code> and <code>5</code> seconds.
   1.326 +         </p>
   1.327 +
   1.328 +         <p>
   1.329 +          The user agent <em class="ct">MUST</em> listen for incoming requests and process any incoming responses to any <a>advertisement for UPnP root devices</a> on the <dfn>standard UPnP address and port</dfn>, on all current local network interface addresses with the port <code>1900</code>, according to the rules defined in this section.
   1.330 +         </p>
   1.331 +
   1.332 +         <p>
   1.333 +          For each <dfn>HTTP Response</dfn> following an initial <a>advertisement for UPnP root devices</a> sent on a <a>standard UPnP address
   1.334 +            and port</a> the user agent <em class="ct">MUST</em> run the following steps:
   1.335           </p>
   1.336  
   1.337           <ol class="rule">
   1.338 -            <li>
   1.339 -               Let <var>ssdp device</var> be an Object with a property for each HTTP header received in the received SSDP Presence Announcement, with each key being the name of a HTTP header and its
   1.340 -               value being that HTTP header's accompanying value.
   1.341 -            </li>
   1.342 +          <li>
   1.343 +            If the <a>HTTP Response</a> is not a HTTP 200 OK response then this response is invalid and the user agent <em class="ct">MUST</em> discard this response, abort any remaining steps and return. The user agent <em class="ct">MAY</em> issue a new <a>advertisement for UPnP root devices</a> as a result of this error occurring.
   1.344 +          </li>
   1.345  
   1.346 -            <li>
   1.347 -               If <var>ssdp device</var> does not contain at least one <var>NTS</var>, <var>USN</var> and <var>Location</var> parameter, then the <a>user agent</a> MUST abort these steps.
   1.348 -            </li>
   1.349 +          <li>
   1.350 +            If the <a>maximum UPnP advertisement response wait time</a> has been exceeded since the initial <a>advertisement for UPnP root devices</a> was sent then the <a>HTTP Response</a> is invalid and the user agent <em class="ct">MUST</em> discard this response, abort any remaining steps and return.
   1.351 +          </li>
   1.352  
   1.353 -            <li>
   1.354 -               If the first occurrence of <var>NTS</var> has a value other than <code>ssdp:alive</code>, then continue to the step labeled <var>update service monitor</var> below.
   1.355 -            </li>
   1.356 +          <li>
   1.357 +             Let <var>ssdp device</var> be an Object with a property for each HTTP header received in the <a>HTTP Response</a>, with each key being the name of a HTTP response header and each value being that HTTP response header's value.
   1.358 +          </li>
   1.359  
   1.360 -            <li>
   1.361 -               Let <var>root device descriptor file</var> contain the contents of the file located at the URL provided in the first occurrence of <var>Location</var> obtained according to the rules
   1.362 -               defined in the section 'Retrieving a description using HTTP' [[!UPNP-DEVICEARCH11]].
   1.363 -            </li>
   1.364 +          <li>
   1.365 +            If <var>ssdp device</var> does not contain at least one <var>CACHE-CONTROL</var> entry, at least one <var>USN</var> entry, at least one <var>ST</var> entry and at least one <var>LOCATION</var> entry or the value of its <var>ST</var> entry is not <code>upnp:rootdevice</code>, then the <a>HTTP Response</a> is invalid and the <a>user agent</a> MUST discard this response, abort any remaining steps and return.
   1.366 +          </li>
   1.367  
   1.368 -            <li>
   1.369 -               If <var>root device descriptor file</var> is empty, then the <a>user agent</a> MUST abort these steps.
   1.370 -            </li>
   1.371 +          <li>
   1.372 +            The user agent <em class="ct">MUST</em> run the rule for <a>processing a UPnP Device Description File</a> passing in the first occurrence of <var>LOCATION</var> from <var>ssdp device</var> as the <var>device descriptor</var> argument and the first occurrence of <var>USN</var> from <var>ssdp device</var> as the <var>device identifier</var> argument and the first occurrence of <var>CACHE-CONTROL</var> from <var>ssdp device</var> as the <var>device expiry</var> argument
   1.373 +          </li>
   1.374  
   1.375 -            <li>
   1.376 -               Let <var>advertised services</var> be a <a>list of all advertised services</a> obtained from the <var>root device descriptor file</var> containing all sub-nodes of the <code>serviceList</code> node as described in
   1.377 -               the section 'Device Description' [[!UPNP-DEVICEARCH11]].
   1.378 -            </li>
   1.379 +        </ol>
   1.380  
   1.381 -            <li>
   1.382 -               For each Object <var>advertised service</var> in <var>advertised services</var> run the following steps:
   1.383 -               <ol class="rule">
   1.384 +        <p>
   1.385 +          For each <dfn>HTTP Request</dfn> received on a <a>standard UPnP address and port</a> the user agent <em class="ct">MUST</em> run the following steps:
   1.386 +         </p>
   1.387  
   1.388 -                  <li>
   1.389 -                     Let <var>network service record</var> be an Object consisting of the following empty properties: <code>id</code>, <code>name</code>, <code>type</code>, <code>url</code>, <code>eventsUrl</code>, <code>config</code>.
   1.390 -                  </li>
   1.391 +        <ol class="rule">
   1.392  
   1.393 -                  <li>
   1.394 -                     Set <var>network service record</var>'s <code>id</code> property to the string value of the first occurrence of <var>ssdp device</var>'s <var>USN</var> parameter.
   1.395 -                  </li>
   1.396 +          <li>
   1.397 +            If the <a>HTTP Request</a> is not a HTTP NOTIFY request then it is not a valid UPnP Request and the user agent <em class="ct">MUST</em> return a HTTP 200 OK response, discard this request, abort any remaining steps and return.
   1.398 +          </li>
   1.399  
   1.400 -                  <li>
   1.401 -                     Set <var>network service record</var>'s <code>name</code> property to the string value of the first occurrence of the <var>service</var>'s <code>serviceId</code> property.
   1.402 -                  </li>
   1.403 +          <li>
   1.404 +             Let <var>ssdp device</var> be an Object with a property for each HTTP header received in the <a>HTTP Request</a>, with each key being the name of a HTTP header and each value being that HTTP header's value.
   1.405 +          </li>
   1.406  
   1.407 -                  <li>
   1.408 -                     Set <var>network service record</var>'s <code>type</code> property to the concatenation of the string <code>upnp:</code> followed by the string value of the first occurrence of the <var>service</var>'s <code>serviceType</code> property.
   1.409 -                  </li>
   1.410 +          <li>
   1.411 +            If <var>ssdp device</var> does not contain at least one <var>CACHE-CONTROL</var> entry, at least one <var>USN</var> entry, at least one <var>NT</var> entry, at least one <var>NTS</var> entry and at least one <var>LOCATION</var> entry or the value of its <var>NT</var> entry is not <code>upnp:rootdevice</code>, then the <a>HTTP Request</a> is a malformed UPnP Request and the <a>user agent</a> MUST return a 400 Bad Request response, discard this request, abort any remaining steps and return.
   1.412 +          </li>
   1.413  
   1.414 -                  <li>
   1.415 -                     Set <var>network service record</var>'s <code>url</code> property to the string value of the first occurrence of the <var>service</var>'s <code>controlURL</code> property.
   1.416 -                  </li>
   1.417 +          <li>
   1.418 +            If <var>ssdp device</var>'s <var>NTS</var> entry is equal to <code>ssdp:alive</code> or <code>ssdp:update</code> then the user agent <em class="ct">MUST</em> run the rule for <a>processing a UPnP Device Description File</a> passing in the first occurrence of <var>LOCATION</var> from <var>ssdp device</var> as the <var>device descriptor</var> argument and the first occurrence of <var>USN</var> from <var>ssdp device</var> as the <var>device identifier</var> argument and the first occurrence of <var>CACHE-CONTROL</var> from <var>ssdp device</var> as the <var>device expiry</var>. <br/><br/>Otherwise, if <var>ssdp device</var>'s <var>NTS</var> entry is equal to <code>ssdp:byebye</code> then the user agent <em class="ct">MUST</em> run the rule for <a>removing all services from a registered UPnP Device</a> passing in the first occurrence of <var>USN</var> from <var>ssdp device</var> as the <var>device identifier</var> argument.
   1.419 +          </li>
   1.420  
   1.421 -                  <li>
   1.422 -                     Set <var>network service record</var>'s <code>config</code> property to the string value of the first occurrence of the <var>device</var> property.
   1.423 -                  </li>
   1.424 +        </ol>
   1.425  
   1.426 -                  <li>
   1.427 -                     If <var>service</var>'s <code>eventSubURL</code> property is empty, then continue to the step labeled <em>register</em> below.
   1.428 -                  </li>
   1.429 +      <p>
   1.430 +        The rule for <dfn>processing a UPnP Device Description File</dfn> is the process of parsing the contents of a standard UPnP Device Description [[!UPNP-DEVICEARCH11]] and
   1.431 +        registering the UPnP services contained therein within the <a>list of available service records</a>.
   1.432 +      </p>
   1.433  
   1.434 -                  <li>
   1.435 -                     Set <var>network service record</var>'s <code>eventsUrl</code> property to the string value of the first occurrence of the <var>service</var>'s <code>eventSubURL</code> property.
   1.436 -                  </li>
   1.437 +      <p>The rule for <a>processing a UPnP Device Description File</a> takes three arguments - <var>device descriptor</var>, <var>device identifier</var> and <var>device expiry</var> - and when called the user
   1.438 +         agent <em class="ct">MUST</em> run the following steps:</p>
   1.439  
   1.440 -                  <li>
   1.441 -                     <em>Register</em>: For each Object <var>existing service record</var> in the current <a>list of available service records</a>, run the following sub-steps:
   1.442 -                     <ol class="rule">
   1.443 +      <ol class="rule">
   1.444  
   1.445 -                       <li>
   1.446 -                        If the <var>existing service record</var>'s <var>id</var> property matches the value of the first occurrence of <var>USN</var> and the
   1.447 -                        <var>existing service record</var>'s <code>type</code> property matches the value of <var>network service record</var>'s <code>type</code>, then set the
   1.448 -                        value of <var>existing service record</var> in the current <a>list of available service records</a>  to the value of the
   1.449 -                        <var>network service record</var> and skip the next step.
   1.450 -                       </li>
   1.451 -                     </ol>
   1.452 -                  </li>
   1.453 +          <li>
   1.454 +             Let <var>root device descriptor file</var> contain the contents of the file located at the URL provided in <var>device descriptor</var> obtained according to the rules
   1.455 +             defined in 'Section 2.11: Retrieving a description using HTTP' in [[!UPNP-DEVICEARCH11]]. If the value provided in <var>device descriptor</var> cannot be resolved as a URL on the current network or the <var>root device descriptor file</var> remains empty then the <a>HTTP Response</a> is invalid and the <a>user agent</a> MUST discard this response, abort any remaining steps and return.
   1.456 +          </li>
   1.457  
   1.458 -                  <li>
   1.459 -                     Add <var>network service record</var> to the <a>list of available service records</a>.
   1.460 -                  </li>
   1.461 +          <li>
   1.462 +             Let <var>advertised services</var> be a <a>list of all advertised services</a> obtained from the <var>root device descriptor file</var> containing the value of the first occurrence of the <code>&lt;serviceList&gt;</code> element as it is defined in 'Section 2.3: Device Description' in [[!UPNP-DEVICEARCH11]].
   1.463 +          </li>
   1.464  
   1.465 -               </ol>
   1.466 -            </li>
   1.467 -            <li>
   1.468 -               <em>Update Service Monitor</em>: For each non-garbage collected <a href="#networkservice"><code>NetworkService</code></a> object run the following steps:
   1.469 +          <li>
   1.470 +             For each <code>&lt;service&gt;</code> element - known as an <var>advertised service</var> - in <var>advertised services</var> run the following steps:
   1.471  
   1.472 -               <ol class="rule">
   1.473 -                  <li>
   1.474 -                     If this <a href="#networkservice"><code>NetworkService</code></a> object's <code>type</code> attribute does not equal the
   1.475 -                     current <a>network service record</a>'s <code>type</code> property then continue at the next available active
   1.476 -                     <a href="#networkservice"><code>NetworkService</code></a> object.
   1.477 -                  </li>
   1.478 -                  <li>
   1.479 -                     If the <var>announcement type</var> equals <code>ssdp:alive</code> then increment the <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute of the <a href="#networkservices"><code>NetworkServices</code></a>
   1.480 -                     object by <code>1</code> and then <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a>
   1.481 -                      to dispatch a newly created event with the name <code>serviceavailable</code> that uses the <code>Event</code> interface, which does not bubble, is not cancellable, and has no default action, at the current
   1.482 -                      <a href="#networkservice"><code>NetworkServices</code></a> object. Otherwise, decrement the <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute of the <a href="#networkservices"><code>NetworkServices</code></a>
   1.483 -                     object by <code>1</code> and then  <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a>
   1.484 -                       to dispatch a newly created event with the name <code>serviceunavailable</code> that uses the <code>Event</code> interface, which does not bubble, is not cancellable, and has no default action, at the current
   1.485 -                       <a href="#networkservice"><code>NetworkServices</code></a> object.
   1.486 -                  </li>
   1.487 -                  <li>
   1.488 -                     If the <var>announcement type</var> equals <code>ssdp:alive</code> then <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a>
   1.489 -                      to dispatch a newly created event with the name <code>serviceonline</code> that uses the <code>Event</code> interface, which does not bubble, is not cancellable, and has no default action, at the current
   1.490 -                      <a href="#networkservice"><code>NetworkService</code></a> object. Otherwise, <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a>
   1.491 -                       to dispatch a newly created event with the name <code>serviceoffline</code> that uses the <code>Event</code> interface, which does not bubble, is not cancellable, and has no default action, at the current
   1.492 -                       <a href="#networkservice"><code>NetworkService</code></a> object.
   1.493 -                  </li>
   1.494 -               </ol>
   1.495 -            </li>
   1.496 +             <ol class="rule">
   1.497 +
   1.498 +                <li>
   1.499 +                   Let <var>network service record</var> be a new Object consisting of the following empty properties: <code>id</code>, <code>deviceId</code>, <code>name</code>, <code>type</code>, <code>url</code>, <code>eventsUrl</code>, <code>config</code>, <code>expiryTimestamp</code>.
   1.500 +                </li>
   1.501 +
   1.502 +                <li>
   1.503 +                   Set <var>network service record</var>'s <code>id</code> property to the concatenated string value of <var>device identifier</var> with the <var>advertised service</var>'s <code>&lt;serviceId&gt;</code> sub-element.
   1.504 +                </li>
   1.505 +
   1.506 +                <li>
   1.507 +                   Set <var>network service record</var>'s <code>deviceId</code> property to the value of <var>device identifier</var>.
   1.508 +                </li>
   1.509 +
   1.510 +                <li>
   1.511 +                   Set <var>network service record</var>'s <code>name</code> property to the string value of the first occurrence of the <var>advertised service</var>'s <code>&lt;serviceId&gt;</code> sub-element.
   1.512 +                </li>
   1.513 +
   1.514 +                <li>
   1.515 +                   Set <var>network service record</var>'s <code>type</code> property to the concatenation of the string <code>upnp:</code> followed by the string value of the first occurrence of the <var>advertised service</var>'s <code>&lt;serviceType&gt;</code> sub-element.
   1.516 +                </li>
   1.517 +
   1.518 +                <li>
   1.519 +                   Set <var>network service record</var>'s <code>url</code> property to the string value of the first occurrence of the <var>advertised service</var>'s <code>&lt;controlURL&gt;</code> sub-element.
   1.520 +                </li>
   1.521 +
   1.522 +                <li>
   1.523 +                   Set <var>network service record</var>'s <code>config</code> property to the string value of the contents of the first occurrence of the <code>&lt;device&gt;</code> element in the <var>root device descriptor file</var>.
   1.524 +                </li>
   1.525 +
   1.526 +                <li>
   1.527 +                   If <var>advertised service</var>'s <code>&lt;eventSubURL&gt;</code> sub-element is not empty, then set <var>network service record</var>'s <code>eventsUrl</code> property to the string value of the first occurrence of the <var>advertised service</var>'s <code>&lt;eventSubURL&gt;</code> sub-element. Otherwise, do not set <var>network service record</var>'s <code>eventsUrl</code> property.
   1.528 +                </li>
   1.529 +
   1.530 +                <li>
   1.531 +                   Set <var>network service record</var>'s <code>expiryTimestamp</code> property to the value of the current date, in UTC timestamp format, plus the value of <var>device expiry</var>.
   1.532 +                </li>
   1.533 +
   1.534 +                <li>
   1.535 +                  Run the general rule for <a>adding an available service</a>, passing in the current <var>network service record</var> as the only argument.
   1.536 +                </li>
   1.537 +
   1.538 +              </ol>
   1.539 +
   1.540 +          </ol>
   1.541 +
   1.542 +         <p>
   1.543 +           The rule for <dfn>removing all services from a registered UPnP Device</dfn> is the process of removing all services associated with a
   1.544 +           device from the <a>list of available service records</a> that has left the user's current network or has otherwise timed out or expired.
   1.545 +           This rule takes one argument, <var>device identifier</var>, and consists of running the following steps:
   1.546 +        </p>
   1.547 +
   1.548 +         <ol class="rule">
   1.549 +
   1.550 +           <li>
   1.551 +              For each <var>existing service record</var> in the current <a>list of available service records</a>, run the following sub-steps:
   1.552 +              <ol class="rule">
   1.553 +
   1.554 +                <li>
   1.555 +                 If the <var>existing service record</var>'s <code>deviceId</code> property does not match <var>device identifier</var> then skip any remaining sub-steps for the current <var>existing service record</var> and continue at the next available <var>existing service record</var>.
   1.556 +                </li>
   1.557 +
   1.558 +                <li>
   1.559 +                  Run the general rule for <a>removing an available service</a> passing in <var>existing service record</var>'s <code>id</code>
   1.560 +                  property as the only argument.
   1.561 +                </li>
   1.562 +
   1.563 +              </ol>
   1.564 +           </li>
   1.565 +
   1.566           </ol>
   1.567  
   1.568 -         <p>
   1.569 -            A <dfn>user-agent generated callback url</dfn> is a Local-network accessible URL endpoint that a <a>user agent</a> must generate and maintain for receiving HTTP NOTIFY requests from UPnP Event sources.
   1.570 -         </p>
   1.571 -
   1.572 -         <p>When the <a>user agent</a> is to <dfn>setup a UPnP Events Subscription</dfn>, it is to run the following steps with the current <var>network service record</var> object:</p>
   1.573 +         <p>When the <a>user agent</a> is to <dfn>setup a UPnP Events Subscription</dfn>, it is to run the following steps with the current <var>network service record</var> object as defined in 'Section 4.1.2: SUBSCRIBE with NT and CALLBACK' in [[!UPNP-DEVICEARCH11]]:</p>
   1.574  
   1.575           <ol class="rule">
   1.576              <li>
   1.577 @@ -1146,8 +1304,7 @@
   1.578              </li>
   1.579  
   1.580              <li>
   1.581 -               Send a HTTP SUBSCRIBE request with a <em>NT</em> header with a string value of <code>upnp:event</code>, a <em>TIMEOUT</em> header with an integer value ofÆ’
   1.582 -               <code>86400</code> and a <em>CALLBACK</em> header
   1.583 +               Send a HTTP SUBSCRIBE request with a <em>NT</em> header with a string value of <code>upnp:event</code>, a <em>TIMEOUT</em> header with a user-agent defined timeout value (in the form <code>Second-XX</code> where <code>XX</code> is the user-agent defined timeout value in seconds) and a <em>CALLBACK</em> header
   1.584                 with a string value of <var>callback URL</var> towards the <var>network service record</var>'s <code>eventsUrl</code> property.
   1.585              </li>
   1.586  
   1.587 @@ -1163,7 +1320,7 @@
   1.588                       Let <var>callback ID</var> equal the string value of the first included <em>SID</em> header, if it exists.
   1.589                    </li>
   1.590                    <li>
   1.591 -                     Let <var>timeout date</var> equal the sum of the current UTC date value plus the integer value of the first included <em>TIMEOUT</em> header, if it exists.
   1.592 +                     Let <var>timeout date</var> equal the sum of the current UTC date value plus the integer value of the first included <em>TIMEOUT</em> header (minus the leading string of <code>Second-</code>), if it exists.
   1.593                    </li>
   1.594                    <li>
   1.595                       Run the following steps aynchronously and continue to the step labeled <em>listen</em> below.
   1.596 @@ -1179,8 +1336,7 @@
   1.597                             If <var>current date</var> is less than the <var>timeout date</var> then continue to the step labeled <em>refresh subscription</em> above.
   1.598                          </li>
   1.599                          <li>
   1.600 -                           Send a HTTP SUBSCRIBE request with a <em>SID</em> header with the string value of <var>callback ID</var> and a <em>TIMEOUT</em> header
   1.601 -                           with an integer value of <code>86400</code> towards the <var>network service record</var>'s <code>eventsUrl</code> property.
   1.602 +                           Send a HTTP SUBSCRIBE request with a <em>SID</em> header with the string value of <var>callback ID</var> and a user-agent defined <em>TIMEOUT</em> header (in the form <code>Second-XX</code> where <code>XX</code> is the user-agent defined timeout value in seconds) towards the <var>network service record</var>'s <code>eventsUrl</code> property.
   1.603                          </li>
   1.604                          <li>
   1.605                             On receiving a valid 200 OK, update <var>callback ID</var> with the string value of the first included <em>SID</em> header, if it exists. All other HTTP
   1.606 @@ -1216,6 +1372,10 @@
   1.607              </li>
   1.608           </ol>
   1.609  
   1.610 +         <p>
   1.611 +           A <a>user agent</a> can <dfn>terminate an existing UPnP Events Subscription</dfn> at any time for any <var>active service</var> in the <a>list of authorized service records</a> by sending an HTTP UNSUBSCRIBE request - as defined in 'Section 4.1.4: Canceling a subscription with UNSUBSCRIBE' in [[!UPNP-DEVICEARCH11]] - with a HOST header set to that <var>active service</var>'s <code>eventsUrl</code> property and a SID header set to the <var>callback ID</var> obtained when the initial <a>setup a UPnP Events Subscription</a> action occurred.
   1.612 +         </p>
   1.613 +
   1.614           </section>
   1.615  
   1.616           <section>
   1.617 @@ -1223,53 +1383,18 @@
   1.618  
   1.619                    <div>
   1.620                       <p>
   1.621 -                        When the <a>user agent</a> detects that the user has dropped from their connected network, then it MUST run the following steps:
   1.622 -                     </p>
   1.623 -
   1.624 -                     <ol class="rule">
   1.625 -                        <li>
   1.626 -                           Flush all entries from the <a>list of available service records</a>.
   1.627 -                        </li>
   1.628 -                        <li>
   1.629 -                           For each <a href="#networkservice"><code>NetworkService</code></a> object currently active in the <a>user agent</a> perform the following steps:
   1.630 -
   1.631 -                           <ol class="rule">
   1.632 -                              <li>
   1.633 -                                 Set the <a href="#dom-networkservice-online"><code>online</code></a> attribute to <code>false</code>.
   1.634 -                              </li>
   1.635 -                              <li>
   1.636 -                                 <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">Queue a task</a>
   1.637 -                                                      to dispatch a newly created event with the name <code>serviceoffline</code> that uses the <code>Event</code> interface, which does not bubble, is not cancellable, and has no default action, at the current
   1.638 -                                                      <a href="#networkservice"><code>NetworkService</code></a> object.
   1.639 -                           </ol>
   1.640 -                        </li>
   1.641 -                        <li>
   1.642 -                          For each <a href="#networkservices"><code>NetworkServices</code></a> object currently active in the <a>user agent</a> perform the following steps:
   1.643 -
   1.644 -                          <ol class="rule">
   1.645 -                            <li>
   1.646 -                              Let <var>number of available services</var> equal the value of <a href="#networkservices"><code>NetworkServices</code></a>'s <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute.
   1.647 -                            </li>
   1.648 -                            <li>
   1.649 -                              Set the <a href="#networkservices"><code>NetworkServices</code></a>'s <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute to zero (<code>0</code>).
   1.650 -                            </li>
   1.651 -                            <li>
   1.652 -                              For each <var>available service</var> in <var>number of available services</var> the <a>user agent</a> MUST fire a new simple event with the name <code>serviceunavailable</code> that has no default action, does not bubble and is not cancellable, at the current <a href="#networkservices"><code>NetworkServices</code></a> object.
   1.653 -                            </li>
   1.654 -                          </ol>
   1.655 -                        </li>
   1.656 -
   1.657 -                     </ol>
   1.658 +                        When the <a>user agent</a> detects that the user has dropped from their connected network then, for each <var>existing service record</var> in the <a>list of available service records</a>, the user agent
   1.659 +                        <em class="ct">MUST</em>
   1.660 +                            run the general rule for <a>removing an available service</a> passing in each <var>existing service record</var>'s
   1.661 +                            <code>id</code> property as the only argument for each call.
   1.662 +                    </p>
   1.663  
   1.664                       <p>
   1.665 -                        When the <a>user agent</a> detects that the user has connected to a new network, then it SHOULD run the following steps:
   1.666 +                        When the <a>user agent</a> detects that the user has connected to a new network or reconnected to an existing network, then it
   1.667 +                        <em class="ct">SHOULD</em> restart its discovery
   1.668 +                         mechanisms as defined in the <a href="#service-discovery">Service Discovery</a> section of this specification, maintaining
   1.669 +                         the existing <a>list of authorized service records</a> currently in use.
   1.670                       </p>
   1.671 -
   1.672 -                     <ol class="rule">
   1.673 -                        <li>
   1.674 -                           Re-issue an mDNS search and SSDP discovery search using all of the <a>valid service type</a> tokens initially provided to all active <a href="#networkservices"><code>NetworkServices</code></a> objects and handle all discovery responses according to the processing defined in <a href="#service-discovery">Section 7: Service Discovery</a>.
   1.675 -                        </li>
   1.676 -                     </ol>
   1.677                    </div>
   1.678           </section>
   1.679        </section>
   1.680 @@ -1278,11 +1403,7 @@
   1.681        <h3>Garbage collection</h3>
   1.682  
   1.683        <p>
   1.684 -         A <a><code>NetworkService</code></a> object containing a <code>url</code> parameter currently in the <a>entry script origin's URL whitelist</a> MUST NOT be garbage collected.
   1.685 -      </p>
   1.686 -
   1.687 -      <p>
   1.688 -         Only when the user navigates away from the current browsing context can <a><code>NetworkService</code></a> objects be garbage-collected and records in the <a>entry script origin's URL whitelist</a> be removed.
   1.689 +         Only when the user navigates away from the current browsing context can <a><code>NetworkService</code></a> objects be garbage-collected, its records in the <a>entry script origin's URL whitelist</a> be removed and its corresponding entry in the <a>list of authorized service records</a> be removed.
   1.690        </p>
   1.691  
   1.692     </section>