RejectedSoftware Forums

Sign up

Parsing a structured header body

currently header bodies are just strings (right?). is there any plan to implement parsing of structured header bodies (like e.g. Content-Disposition)? is there any other library that does that? For example i want to be able to access individual fields of a Content-Disposition header the way i access an AA item value or better yet the way i access a struct field.

Re: Parsing a structured header body

On Wed, 20 Aug 2014 22:44:42 GMT, Jay wrote:

currently header bodies are just strings (right?). is there any plan to implement parsing of structured header bodies (like e.g. Content-Disposition)? is there any other library that does that? For example i want to be able to access individual fields of a Content-Disposition header the way i access an AA item value or better yet the way i access a struct field.

There is actually an open ticket (#12) for this. In theory I'd like to integrate something like this, but that would require some serious thoughts about how a good design for this would look like. It would have to be efficient (performance/memory) and backwards compatible, and ideally it would even reduce the amount of memory required per request.

So currently there are no concrete plans, because the string only solution is sufficient in most cases and the design isn't clear yet.

Re: Parsing a structured header body

There is actually an open ticket (#12) for this. In theory I'd like to integrate something like this, but that would require some serious thoughts about how a good design for this would look like. It would have to be efficient (performance/memory) and backwards compatible, and ideally it would even reduce the amount of memory required per request.

So currently there are no concrete plans, because the string only solution is sufficient in most cases and the design isn't clear yet.

maybe something like this:

res.headers is still a DictionaryList.
res.headers.std.headerName is used for accessing standard headers.

e.g. res.headers.std.contentDisposition.filename would return a slice (possibly empty) providing access to some of the chars in res.headers["Content-Disposition"]. obviously header bodies should be parsed in a lazy manner.