https://issues.apache.org/bugzilla/show_bug.cgi?id=45687
Dan Poirier <[EMAIL PROTECTED]> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |[EMAIL PROTECTED]
--- Comment #2 from Dan Poirier <[EMAIL PROTECTED]> 2008-08-27 04:50:17 PST ---
Thanks for catching the fprintf.
The logic in charset_lite was fundamentally different on input and
output.
On input (xlate_in_filter, xlate_brigade), the brigade is our output. We're
pulling data from upstream, translating it, and adding it to the brigade. If
we find a metadata bucket in what we've pulled, we need to pass it on to the
brigade, keeping it in the right order relative to the translated data.
The logic in xlate_in_filter is a bit confusing. It either pulls data or finds
some carried over from the previous call in ctx->bb. Either way, it puts it on
the brigade, then calls xlate_brigade. xlate_brigade goes through the brigade,
removing buckets, translating the data, and putting the translated data into a
buffer. Then when control returns to xlate_in_filter, the translated data is
put into a new bucket and put onto the brigade to be returned to the caller.
Returning from xlate_brigade when we come to metadata avoids "reading" the
bucket and throwing it away, but then xlate_in_filter sees we haven't emptied
the brigade and moves the remaining buckets over to ctx->bb so they can be
processed next time, including any metadata. If we left the metadata there,
we'd get stuck in a loop doing this over and over, so we need to move it back
to bb before returning, but we should put the data we've processed onto the end
of bb first so the metadata stays in order relative to the data.
On EOS, we just skip moving the remaining bucket over to ctx->bb, but for
general metadata, we don't know there aren't more data buckets later (I don't
think we know that, anyway), so if we left the brigade alone, any data after
the metadata would be passed up the filter chain untranslated.
Perhaps a simpler change in xlate_in_filter would be, immediately after the
successful return from xlate_brigade, to see if the head bucket is metadata and
move it aside for the moment. We know there's only one because we return from
xlate_brigade as soon as we see one. Then after putting any remaining
untranslated data onto ctx->bb, put the metadata back onto the head of the
brigade. The translated data would then be put in front of it, and everything
would be in the right order upon returning the brigade to our caller.
Thoughts?
The output side is simpler. We pull buckets off the brigade, translate their
data, and push it downstream. So all we need to do is recognize that we have
metadata and push it downstream as-is instead of translating the data and
discarding the bucket. If metadata is frequent enough that it would be
worthwhile optimizing the brigade creation to pass it downstream, we could look
at that, but my impression is that metadata isn't that frequent.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]