Project

General

Profile

Can anyone show me some hints to port lighty plugin header to pascal / delphi ?

Added by cst_zf over 16 years ago

I have used lighty as my http server for for some months and written some plugins in C. It makes me shock that the code of lighty is so short and clear. It's a wonderful job, including the clear wiki works.

I used to do some things with IIS filter or IIS extensions, and build webs using WebBroker for delphi (which wrapped the IIS extensions). It is an interesting thing to work in the original layer of the web server, not in the dynamic language layer (such as php, jsp, asp).

Can anyone show me some hints to help me to make plugin libs with pascal(free pascal or delphi)? I have little experience in linux. Will me must implement the buffer and array functions again in pascal or I can get the pointer to the functions?

I think I can handle it in the end, but if anyone show me some hints about the memory management and ways of interaction between plugin and server, it may help me much. _


Replies (14)

RE: Can anyone show me some hints to port lighty plugin header to pascal / delphi ? - Added by ycheng over 16 years ago

It seems that you want to write lighttpd plugin in pascal or delphi language.

As far as I know, all of the plugins are .so files.
And the only thing that lighttpd cares is int mod_proxy_plugin_init(plugin *p), the entrance of that plugin.

Memory management is taken care by yourself. But we take the advantage of the stuff that lighttpd supplies.
array, buffer, data_xxx etc, they are handy, fast, strong.
You can re-implement them by other language. Even enrich them.
But there are many data structures shared between plugins and the core. Like chunkqueue, chunk ...

So if you want to write lighttpd plugins, I suggest that you use C and based on lighttpd.
The developers have made many handy bricks, just use them!

RE: Can anyone show me some hints to port lighty plugin header to pascal / delphi ? - Added by cst_zf over 16 years ago

To Olaf-van-der-Spek:

I don't like fastCGI for I like threads, not multi-process. It already makes me agonising that php do not have application vars. And also I like use in-process db / memory db.

To ycheng

Many apis are translated to pascal, why not lighty? I just set JEDI-Project for example. If I have time, I will do this translation. :p
btw, I'm in Beijing now, and you?

RE: Can anyone show me some hints to port lighty plugin header to pascal / delphi ? - Added by cst_zf over 16 years ago

is it a bug of redmine....my post looks strange.....

RE: Can anyone show me some hints to port lighty plugin header to pascal / delphi ? - Added by cst_zf over 16 years ago

I find a easy way to solve the problem that I should re-implement them by other language.
The problem is that i must modify the interface struct between the core and the plugin to
send pointers to all the core functions including the calloc and free, just like IIS's
ECB server function.

[quote]
if NO_RDYNAMIC
  1. if the linker doesn't allow referencing symbols of the binary
  2. we have to put everything into a shared-lib and link it into
  3. everything
    [/quote]

this is some remark in makefile.am, I think put everything into a shared-lib is a lazy way
to solve it, :P maybe send pointers to all core function is a better way to solve it.

RE: Can anyone show me some hints to port lighty plugin header to pascal / delphi ? - Added by cst_zf over 16 years ago

e....another bad format post and i cannot modify it...

RE: Can anyone show me some hints to port lighty plugin header to pascal / delphi ? - Added by cst_zf over 16 years ago

the first bad format is caused by

...

it is recognized by redmine itself

i don't known why the second bad format happened. I just write ubb code [quote]

RE: Can anyone show me some hints to port lighty plugin header to pascal / delphi ? - Added by icy over 16 years ago

Formatting is not done via UBB code, when you reply there are buttons for some formatting stuff and a link to the text formatting help. Read it.

RE: Can anyone show me some hints to port lighty plugin header to pascal / delphi ? - Added by Olaf-van-der-Spek over 16 years ago

cst_zf wrote:

To Olaf-van-der-Spek:

I don't like fastCGI for I like threads, not multi-process. It already makes me agonising that php do not have application vars. And also I like use in-process db / memory db.

Eh, it's like you're talking about CGI, not about FastCGI. Stuff like app vars, in-process / memory DB are no problem for a FastCGI app.

RE: Can anyone show me some hints to port lighty plugin header to pascal / delphi ? - Added by ycheng over 16 years ago

shanghai

cst_zf wrote:

To ycheng

Many apis are translated to pascal, why not lighty? I just set JEDI-Project for example. If I have time, I will do this translation. :p
btw, I'm in Beijing now, and you?

RE: Can anyone show me some hints to port lighty plugin header to pascal / delphi ? - Added by cst_zf over 16 years ago

Olaf-van-der-Spek wrote:

cst_zf wrote:

To Olaf-van-der-Spek:

I don't like fastCGI for I like threads, not multi-process. It already makes me agonising that php do not have application vars. And also I like use in-process db / memory db.

Eh, it's like you're talking about CGI, not about FastCGI. Stuff like app vars, in-process / memory DB are no problem for a FastCGI app.

FastCGI starts multi-process for one web application, doesn't it? I don't know if it is a problem in c & linux, but it will make you unhappy when you must process cross-process vars in delphi, the map & hashmap class i used depends on the normal memory allocator, move it to shared mem is a tiring job.

RE: Can anyone show me some hints to port lighty plugin header to pascal / delphi ? - Added by Olaf-van-der-Spek over 16 years ago

cst_zf wrote:

FastCGI starts multi-process for one web application, doesn't it?

No.

I don't know if it is a problem in c & linux, but it will make you unhappy when you must process cross-process vars in delphi, the map & hashmap class i used depends on the normal memory allocator, move it to shared mem is a tiring job.

I understand, but that doesn't apply.

RE: Can anyone show me some hints to port lighty plugin header to pascal / delphi ? - Added by cst_zf over 16 years ago

Olaf-van-der-Spek wrote:

cst_zf wrote:

FastCGI starts multi-process for one web application, doesn't it?

No.

I don't know if it is a problem in c & linux, but it will make you unhappy when you must process cross-process vars in delphi, the map & hashmap class i used depends on the normal memory allocator, move it to shared mem is a tiring job.

I understand, but that doesn't apply.

Ok, I see. i misunderstand fastcgi and should learn more about it.
Can fastcgi do the same thing with iisapi filter, such as to perform url magic or modify the request/response header and pass the request to normal plugin or static files?

RE: Can anyone show me some hints to port lighty plugin header to pascal / delphi ? - Added by Olaf-van-der-Spek over 16 years ago

cst_zf wrote:

Can fastcgi do the same thing with iisapi filter, such as to perform url magic or modify the request/response header and pass the request to normal plugin or static files?

It can pass the request to a static file, I don't think it can do the other parts (at this time).

    (1-14/14)