expath-cg
expath-cg copied to clipboard
HTTP requests: options
Here is some discusson the current options set for HTTP requests.
@adamretter: If you agree with all my proposals, I’ll be glad to create a pull request.
A. content-encoding
- If I understand this correctly,
none
has a special meaning, because it is no supported value for theContent-Encoding
header field. I am wondering…
- If we should keep it, or (my preference) drop it and use an empty sequence as default?
- If we keep it, we should probably clarify what happens with the
Content-Encoding
header field. Will it be ignored, removed, or overwritten with an empty string ifnone
is supplied?
B. transfer-encoding
-
none
: Same here… -
chunked
is not supported by HTTP/2 anymore, so I’ll include it in the error check. - I would tend to raise
http:invalid-option
instead ofhttp:version
(the attached error message should be explanatory enough, and it basically falls into the same category).
C. follow-redirect
- In the initial version of the spec, the default was
true
. I liked this default, maybe we can keep it. - We might need to clarify what kinds of redirections an implementation is expected or required to support. The Java default implementation follows redirections automatically as long as the protocol is the same. Redirects from
http
tohttps
won’t be resolved. I don’t know what the Apache HTTP Client does, or if/how redirects were handled in the Java implementation of the EXPath HTTP Client?
D. timeout
- Java’s default is
0
, which stands for “no timeout”. Maybe it’s best to adopt this default? And an error could be raised if a negative value is supplied.
E. parse-response-entity-body
- I would definitely love to have a shorter name for this option, as I imagine it might be used pretty often. I see that
parse-response
is ambiguous; on the other hand, I assume that people who use this option will know what it does anyway. A possible alternative:parse-bodies
: Only responses are “parsed” (requests are serialized), and the plural form indicates that we may have multiple bodies in a response. What do you think?