Christopher,

On 4/13/21 2:41 PM, Christopher Faulet wrote:
Sorry for the delay. I'll comment your patches by replying inline when

No delay experienced. You said that you'd try this week and it's still this week. So this is fine :-)

appropriate. The quality of the whole series is pretty good. Thanks for the effort. Just a suggestion to simplify the error handling introduced in the 7th patch. You may use following prototype for your normalizers:

   int uri_normalizer_NAME(const struct ist path, struct ist *dst);

returning for instance 0 on success and anything else on error. This way, it is easy to return an enum instead of an integer to be able to handle errors.


Yes, I struggled a bit with the method signature, due to the following constraints:

1. I did not want to allocate the result buffer within the normalizer itself, because this makes the method less flexible with regard to both allocation and freeing. 2. I need to somehow pass a size of the target buffer to prevent buffer overflows.

Thus I can't simply take a `struct ist*` for the destination, as an ist cannot communicate the size of the underlying buffer. I could technically take a `struct buffer`, but I'd still like the result to reside in an ist, because this is what the HTX API expects.

Your suggested signature would work if I would allocate a trash buffer within the normalizer. Should I do this? Is it safe to return a pointer to a trash buffer from a function? I remember something about these buffers being reused, accidentally destroying the contained information if one is not careful.

Best regards
Tim Düsterhus

Reply via email to