libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] Creating instances in the option MHD_OPTION_URI_LOG_CALL


From: silvioprog
Subject: [libmicrohttpd] Creating instances in the option MHD_OPTION_URI_LOG_CALLBACK
Date: Sun, 7 Aug 2016 21:26:28 -0300

Hello listers,

I have a Pascal object representing the request so it is created for each browser request, and MHD maintains the life cycle of that one. So far so good, but the only problem is about my approach choice, I used the option MHD_OPTION_URI_LOG_CALLBACK to create the object and the MHD_OPTION_NOTIFY_COMPLETED to free that one.

Researching at Google, I've seen some people using this approach too, for example (in C++):

Routines attribution:

https://github.com/tpoechtrager/cube-server-browser/blob/f2e5c22dc08250756f9f08b834276ee5c62eed5d/src/plugins/web/httpserver.cpp#L586

Object life cycle management:

https://github.com/tpoechtrager/cube-server-browser/blob/f2e5c22dc08250756f9f08b834276ee5c62eed5d/src/plugins/web/httpserver.cpp#L211

https://github.com/tpoechtrager/cube-server-browser/blob/f2e5c22dc08250756f9f08b834276ee5c62eed5d/src/plugins/web/httpserver.cpp#L229

Anyway, I have some doubts. When I set a routine to the MHD_OPTION_URI_LOG_CALLBACK option, is this one always called once time for each request? If so, that's OK, otherwise, which one can I use instead?

Researching more a bit, I've found many examples using the parameter `con_cls` as a flag:

https://github.com/inn1983/teropi/blob/94f2e575a05a52581aba0a0b6c7d3f19a1ac4397/xbmc/network/WebServer.cpp#L130

However, this approach is a little bit hard to be maintained in the oriented object programming, and it was the reason that I chose the "first called routine" instead of using the `con_cls` as a flag.

Thank you!

--
Silvio Clécio

reply via email to

[Prev in Thread] Current Thread [Next in Thread]