You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: post-canonicalization/latest/index.md
+18-9Lines changed: 18 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -101,13 +101,15 @@ Encoding the request body depends on the content-type.
101
101
| text/plain | JSON | binary |
102
102
| * | binary ||
103
103
104
-
#### AMF request body encoding
104
+
#### AMF (Action Message Format) request body encoding
105
105
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.
107
109
108
110
#### Binary request body encoding
109
111
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.
111
113
112
114
> **Example**
113
115
>
@@ -146,7 +148,7 @@ If a UTF-8 decoding error occurs then the binary encoding method MUST be used in
146
148
147
149
#### Encoding a multipart form request body
148
150
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.
150
152
151
153
> **Example**
152
154
>
@@ -187,7 +189,7 @@ The body MUST be decoded as form data per [RFC 2388][9] and then percent plus en
187
189
188
190
#### Encoding a JSON request body
189
191
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*.
191
193
192
194
To **encode a JSON *value***, given a *name* and an initially-empty map *nameCounts* of strings to integers:
193
195
@@ -211,6 +213,8 @@ To **encode a JSON *value***, given a *name* and an initially-empty map *nameCou
211
213
1. Store the integer 1 in *nameCounts* for *name*.
212
214
2. Append the string "&*name*=*encodedValue*" to the output.
213
215
216
+
The resulting query string will contain encoded key/value pairs of each leaf node of the JSON body.
217
+
214
218
> **Example**
215
219
>
216
220
> Original request:
@@ -256,6 +260,8 @@ To **percent plus encode a byte sequence**, for each byte in the input sequence:
256
260
> **Compatibility Note**
257
261
>
258
262
> 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.
259
265
260
266
261
267
[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:
0 commit comments