Hi Sasha,

On Wed, May 21, 2014 at 05:43:27PM -0600, Sasha Pachev wrote:
> > No, it would not concatenate the headers, otherwise it breaks
> > set-cookie. For simple headers like above, you'd get the same
> > result with modify-header and replace-header. The difference
> > is visible when the header contains a comma :
> >
> > Set-Cookie: A=B; expires=Wed, 21 May 2014 05:11:16 GMT
> > Set-Cookie: C=D; expires=Wed, 21 May 2014 05:11:16 GMT
> >
> > replace-header Set-Cookie (.*) \1;bar would give :
> >
> > Set-Cookie: A=B; expires=Wed, 21 May 2014 05:11:16 GMT; bar
> > Set-Cookie: C=D; expires=Wed, 21 May 2014 05:11:16 GMT; bar
> >
> > modify-header Set-Cookie (.*) \1;bar would give :
> >
> > Set-Cookie: A=B; expires=Wed; bar, 21 May 2014 05:11:16 GMT; bar
> > Set-Cookie: C=D; expires=Wed; bar, 21 May 2014 05:11:16 GMT; bar
> >
> > Maybe the names are not the best choices, I don't know. At least I
> > tend to remember which one does what this way.
> 
> Good plan. Will do it this way. If I use buffer_replace2() on the
> header repeatedly from under  http_res_get_intercept_rule() or
> http_req_get_intercept_rule() it does not appear that it would cause
> any problems - It is already being used from under
> http_remove_header2() which is called from under those functions, but
> maybe I missed something. Did I?
> 
> And, is buffer_replace2() the best tool for the job, or would you
> suggest a different call?

Yes I think it's the appropriate one. Look how the Connection header
is processed for example. You might also be interested in looking at
how reqrep/rsprep are processed in apply_*_filter* with action
ACT_REPLACE. I think it's the closest to what you want to do.

Best regards,
Willy


Reply via email to