Confirmed users
971
edits
Line 197: | Line 197: | ||
<pre>C: GET /new_channel HTTP/1.1 | <pre>C: GET /new_channel HTTP/1.1 | ||
S: "a7id"</pre></li> | S: "a7id"</pre></li> | ||
<li>Mobile generates PIN from random weak secret (4 characters a-z0-9) and the channel ID, computes and uploads J-PAKE msg 1. To prevent double uploads in case of retries, the If-None-Match: * header is specified. This makes sure that the message is only uploaded if the channel is empty. If it is not then the request will fail with a 412 Precondition Failed which should be considered the same as 200 OK. The 412 will also contain the Etag of the data was the client just uploaded. | <li>Mobile generates PIN from random weak secret (4 characters a-z0-9) and the channel ID, computes and uploads J-PAKE msg 1. | ||
<b>New for v2:</b> To prevent double uploads in case of retries, the If-None-Match: * header is specified. This makes sure that the message is only uploaded if the channel is empty. If it is not then the request will fail with a 412 Precondition Failed which should be considered the same as 200 OK. The 412 will also contain the Etag of the data was the client just uploaded. | |||
<pre> | <pre> | ||
C: PUT /a7id HTTP/1.1 | C: PUT /a7id HTTP/1.1 | ||
Line 219: | Line 221: | ||
C: } | C: } | ||
C: } | C: } | ||
</pre> | |||
Success response: | |||
<pre> | |||
S: HTTP/1.1 200 OK | S: HTTP/1.1 200 OK | ||
S: ETag: "etag-of-receiver1-message" | S: ETag: "etag-of-receiver1-message" | ||
</pre> | |||
Response that will be returned on retries if the Desktop already replaced the message. | |||
<pre> | |||
S: HTTP/1.1 412 Precondition Failed | S: HTTP/1.1 412 Precondition Failed | ||
S: ETag: "etag-of-receiver1-message" | S: ETag: "etag-of-receiver1-message" | ||
Line 229: | Line 239: | ||
<pre> | <pre> | ||
C: GET /a7id HTTP/1.1 | C: GET /a7id HTTP/1.1 | ||
</pre> | |||
Success response: | |||
<pre> | |||
S: HTTP/1.1 200 OK | S: HTTP/1.1 200 OK | ||
S: ETag: "etag-of-receiver1-message" | S: ETag: "etag-of-receiver1-message" | ||
</pre></li> | |||
<li>Desktop computes and uploads msg 1. | |||
<li>Desktop computes and uploads msg 1 | |||
<b>New in version 2:</b> The If-Match header is set so that we only upload this message if the previous Desktop's message is still in the channel. This is to prevent double PUTs during retries. | |||
<pre> | <pre> | ||
C: PUT /a7id HTTP/1.1 | C: PUT /a7id HTTP/1.1 | ||
Line 256: | Line 272: | ||
C: } | C: } | ||
C: } | C: } | ||
</pre> | |||
Success response: | |||
<pre> | |||
S: HTTP/1.1 200 OK | S: HTTP/1.1 200 OK | ||
S: Etag: "etag-of-sender1-message" | S: Etag: "etag-of-sender1-message" | ||
</pre> | |||
<pre> | |||
S: HTTP/1.1 412 Precondition Failed | S: HTTP/1.1 412 Precondition Failed | ||
S: Etag: "etag-of-sender1-message" | S: Etag: "etag-of-sender1-message" |