how to get apr_pool_t when need to call ap_md5

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

how to get apr_pool_t when need to call ap_md5

eeadev dev
In my function I need to get the checksum using md5.

I saw that there is this function ap_md5(apr_pool_t *a, const unsigned char *string);

but it needs apr_pool_t

how can I get it?

char key[] = "abc";

key_md5 = ap_md5(mem_pool, key);



Reply | Threaded
Open this post in threaded view
|

Re: how to get apr_pool_t when need to call ap_md5

Eric Covener
On Thu, Sep 7, 2017 at 12:07 PM, eeadev dev <[hidden email]> wrote:

> In my function I need to get the checksum using md5.
>
> I saw that there is this function ap_md5(apr_pool_t *a, const unsigned char
> *string);
>
> but it needs apr_pool_t
>
> how can I get it?
>
> char key[] = "abc";
>
> key_md5 = ap_md5(mem_pool, key);

Most request processing hooks are passed the request_rec which has a
pool with request lifetime.  Similar for connection-level hooks and
conn_rec.

While parsing directives, you have pools passed on the cmd_* structure
which are either temporary or very long-lived.

Finally, you can create & destroy a new pool if you are in some very weird code.

Could you elaborate on the context?

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: how to get apr_pool_t when need to call ap_md5

eeadev dev
thank u, Eric.
I just saw your reply.

2017-09-07 16:54 GMT-07:00 Eric Covener <[hidden email]>:
On Thu, Sep 7, 2017 at 12:07 PM, eeadev dev <[hidden email]> wrote:
> In my function I need to get the checksum using md5.
>
> I saw that there is this function ap_md5(apr_pool_t *a, const unsigned char
> *string);
>
> but it needs apr_pool_t
>
> how can I get it?
>
> char key[] = "abc";
>
> key_md5 = ap_md5(mem_pool, key);

Most request processing hooks are passed the request_rec which has a
pool with request lifetime.  Similar for connection-level hooks and
conn_rec.

While parsing directives, you have pools passed on the cmd_* structure
which are either temporary or very long-lived.

Finally, you can create & destroy a new pool if you are in some very weird code.

Could you elaborate on the context?

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]