|
From: | Nader Zeid |
Subject: | Re: [libmicrohttpd] MHD_OPTION_URI_LOG_CALLBACK function is passed empty URI string: |
Date: | Wed, 28 May 2014 11:05:53 -0400 |
On 05/28/2014 03:20 AM, Nader Zeid wrote:A first bug here is that you need to add an extra 'NULL' argument
> I can't think of any reason why this won't work. I have the following
> function:
>
>
>
> void * MicroHttpdServer::log(void * cls, const char * uri) {
> Request *request(new Request());
> printf("\nURI: %s\n", uri);
> return request;
> }
>
>
>
> Given as the value of the MHD_OPTION_URI_LOG_CALLBACK option:
>
>
>
> MHD_Daemon *daemon;
> daemon = MHD_start_daemon(
> MHD_USE_SELECT_INTERNALLY | MHD_USE_IPv6,
> MicroHttpdServer::port,
> NULL, // &MicroHttpdServer::authorize
> NULL,
> &MicroHttpdServer::handle,
> NULL,
> MHD_OPTION_THREAD_POOL_SIZE,
> MicroHttpdServer::amount,
> MHD_OPTION_URI_LOG_CALLBACK,
> &MicroHttpdServer::log,
> MHD_OPTION_END
> );
after &MicroHttpdServer::log for the 'cls'. Right now, the behavior
is undefined.
Next, you might need to avoid the C++-ism of "MicroHttpdServer::log"
as there is no "self" pointer passed from C, which might effectively
shift your arguments by one. So try with a plain old C function ;-)
Happy hacking!
Christian
[Prev in Thread] | Current Thread | [Next in Thread] |