Skip to content

Commit 6bf3dfa

Browse files
committed
Add AMF section and more detailed compatibility note
1 parent 40f75f8 commit 6bf3dfa

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

post-canonicalization/latest/index.md

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,15 @@ Encoding the request body depends on the content-type.
101101
| text/plain | JSON | binary |
102102
| * | binary | |
103103

104-
#### AMF request body encoding
104+
#### AMF (Action Message Format) request body encoding
105105

106-
[TODO: To be written]
106+
AMF request body encoding is considered experimental and is only supported in pywb. It is possible this feature will be deprecated in the future.
107+
108+
The current ([pywb implementation of AMF request body encoding][7]) and ([associated tests][8]) are available in the pywb repository.
107109

108110
#### Binary request body encoding
109111

110-
The request body is encoded as Base64 ([RFC 4648][7]) and appended to the query string as the `__wb_post_data` parameter.
112+
The request body is encoded as Base64 ([RFC 4648][9]) and appended to the query string as the `__wb_post_data` parameter.
111113

112114
> **Example**
113115
>
@@ -146,7 +148,7 @@ If a UTF-8 decoding error occurs then the binary encoding method MUST be used in
146148
147149
#### Encoding a multipart form request body
148150

149-
The body MUST be decoded as form data per [RFC 2388][9] and then percent plus encoded. If the body is not a valid multipart/form-data message then the binary encoding method MUST be used instead.
151+
The body MUST be decoded as form data per [RFC 2388][10] and then percent plus encoded. If the body is not a valid multipart/form-data message then the binary encoding method MUST be used instead.
150152

151153
> **Example**
152154
>
@@ -187,7 +189,7 @@ The body MUST be decoded as form data per [RFC 2388][9] and then percent plus en
187189
188190
#### Encoding a JSON request body
189191

190-
The request MUST be parsed as JSON ([RFC 8259][10]) and then apply the following algorithm with an empty string as the initial value of *name*.
192+
The request MUST be parsed as JSON ([RFC 8259][11]) and then apply the following algorithm with an empty string as the initial value of *name*.
191193

192194
To **encode a JSON *value***, given a *name* and an initially-empty map *nameCounts* of strings to integers:
193195

@@ -211,6 +213,8 @@ To **encode a JSON *value***, given a *name* and an initially-empty map *nameCou
211213
1. Store the integer 1 in *nameCounts* for *name*.
212214
2. Append the string "&*name*=*encodedValue*" to the output.
213215

216+
The resulting query string will contain encoded key/value pairs of each leaf node of the JSON body.
217+
214218
> **Example**
215219
>
216220
> Original request:
@@ -256,6 +260,8 @@ To **percent plus encode a byte sequence**, for each byte in the input sequence:
256260
> **Compatibility Note**
257261
>
258262
> Prior to Python 3.7 the character "~" was percent encoded.
263+
>
264+
> Older versions of ([pywb][12]) and ([warcio.js][]13) had slight discrepencies in the query strings they output for the same request data. For instance, pywb wrote Pythonic values for some values (`True`, `False`, `None`) rather than native JSON values (`true`, `false`, `null`), and warcio handled nested JSON differently than pywb. As of the publication of this specification, all current versions of Webrecorder software should behave identically.
259265
260266

261267
[1]: https://www.rfc-editor.org/rfc/rfc2119
@@ -264,7 +270,10 @@ To **percent plus encode a byte sequence**, for each byte in the input sequence:
264270
[4]: https://specs.webrecorder.net/wacz/latest/
265271
[5]: https://iipc.github.io/warc-specifications/specifications/cdx-format/cdx-2015/
266272
[6]: https://specs.webrecorder.net/cdxj/0.1.0/
267-
[7]: https://www.rfc-editor.org/rfc/rfc8259
268-
[8]: https://tools.ietf.org/html/rfc4648
269-
[9]: https://datatracker.ietf.org/doc/html/rfc2388
270-
[10]: https://datatracker.ietf.org/doc/html/rfc8259
273+
[7]: https://github.com/webrecorder/pywb/blob/main/pywb/warcserver/amf.py
274+
[8]: https://github.com/webrecorder/pywb/blob/main/pywb/warcserver/test/test_amf.py
275+
[9]: https://tools.ietf.org/html/rfc4648
276+
[10]: https://datatracker.ietf.org/doc/html/rfc2388
277+
[11]: https://www.rfc-editor.org/rfc/rfc8259
278+
[12]: https://github.com/webrecorder/pywb
279+
[13]: https://github.com/webrecorder/warcio.js

0 commit comments

Comments
 (0)