expath-cg icon indicating copy to clipboard operation
expath-cg copied to clipboard

HTTP requests: options

Open ChristianGruen opened this issue 6 years ago • 6 comments

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

  1. If I understand this correctly, none has a special meaning, because it is no supported value for the Content-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 if none is supplied?

B. transfer-encoding

  1. none: Same here…
  2. chunked is not supported by HTTP/2 anymore, so I’ll include it in the error check.
  3. I would tend to raise http:invalid-option instead of http:version (the attached error message should be explanatory enough, and it basically falls into the same category).

C. follow-redirect

  1. In the initial version of the spec, the default was true. I liked this default, maybe we can keep it.
  2. 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 to https 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

  1. 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

  1. 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?

ChristianGruen avatar Aug 27 '18 10:08 ChristianGruen