You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Cliff Woolley <jw...@virginia.edu> on 2003/04/30 19:05:30 UTC
passing bucket data to pcre
Hey..
Somebody from Tivoli sent me a question about passing data retrieved
from a bucket with apr_bucket_read() to pcre by way of ap_regexec(). The
problem, apparently, is that since ap_regexec()'s API does not allow
passing a length, it must assume that the string you pass it is
null-terminated, which of course bucket data is not. Having to copy the
data just to stick a null on the end would suck... so it would seem that
the logical thing to do is add an additional function to the API,
something like ap_regexecn(), that also takes a length parameter.
Thoughts?
Cliff
Re: passing bucket data to pcre
Posted by André Malo <nd...@perlig.de>.
* Cliff Woolley wrote:
> On Wed, 30 Apr 2003, [ISO-8859-1] André Malo wrote:
>
>> Which does the copy itself? I'd have no problem with such an API. But
>> ;-) do we really need it?
>
> No, it doesn't do the copy itself. Rather than taking a null-terminated
> string with no length, it takes a buffer (not necessarily null-terminated)
> and a length. The latter is what we get out of the bucket brigades.
> PCRE (from what I'm told) apparently has a function that can take data in
> this form directly.
Ah, that's the point. In my memory PCRE took only C-Strings. If it takes
buffers, yes, the API would be useful.
nd
--
>kann mir jemand sagen, was genau @-Domains sind?
Ein Mythos. Ein Werbetrick. Verarsche. Nenn es wie du willst...
-- Alexandra Buss und Björn Höhrmann in dciwam
Re: passing bucket data to pcre
Posted by Cliff Woolley <jw...@virginia.edu>.
On Wed, 30 Apr 2003, [ISO-8859-1] Andr� Malo wrote:
> Which does the copy itself? I'd have no problem with such an API. But
> ;-) do we really need it?
No, it doesn't do the copy itself. Rather than taking a null-terminated
string with no length, it takes a buffer (not necessarily null-terminated)
and a length. The latter is what we get out of the bucket brigades.
PCRE (from what I'm told) apparently has a function that can take data in
this form directly. No copies, no strlen()'s. So I'd say that means yes,
we need it. :)
--Cliff
Re: passing bucket data to pcre
Posted by André Malo <nd...@perlig.de>.
* Cliff Woolley wrote:
> Somebody from Tivoli sent me a question about passing data retrieved
> from a bucket with apr_bucket_read() to pcre by way of ap_regexec(). The
> problem, apparently, is that since ap_regexec()'s API does not allow
> passing a length, it must assume that the string you pass it is
> null-terminated, which of course bucket data is not. Having to copy the
> data just to stick a null on the end would suck... so it would seem that
> the logical thing to do is add an additional function to the API,
> something like ap_regexecn(), that also takes a length parameter.
Which does the copy itself? I'd have no problem with such an API. But ;-) do
we really need it?
nd
--
>I have tried using ErrorDocument 401, but doesn't work.
^^^^^^^^^^^^^
Oh dear. What does it do - lounge around on the couch all day drinking
beer and watching TV? -- "Kash" und Alan J. Flavell in ciwsu