lua-users home
lua-l archive

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

On Feb 20, 2008, at 11:45 AM, Bertrand Mansion wrote:

I think there are only a few tags allowed, <code> being one of them. But I haven't checked in the source. I know that Markdown doesn't filter this so it has to be added as a filter before Markdown filtering is launched.

Yes, one would need a filter first. The question is more about how restrictive one want to be: no html, some html, any html?

1. You should probably get rid of Blueprint since it doesn't allow liquid design and that's what you want.

But... I like blueprint! It's just like using good, old html table :))

2. Links color : I suggest light blue


3. Code blocks : I suggest using overflow: auto; with a light background color and syntax coloring, as well as a copy/paste plain text version :)

Oh, my...

4. File uploads : I suggest using ajax fun for posting the file to a form in an iframe. this way, you don't have to move to a new page, you can manage your files and your content on the same page. I have coded that for another project, I can help you with it if you want.

I would rather stay well away from ajax.

5. Filters : I haven't checked in your code but you should have a safe html filter in order to avoid your site being used for XSS attacks

Hmmm... wiki should be less prone being such a carrier as their content is under much more scrutiny, no?

In any case, better safa than sorry I guess:

return markdown( aText:gsub( '(<.*>)', '`%1`' ) )

6. I don't think it is possible to use your code with lighttpd

With lighttpd or any HTTP server, yes. Nanoki has one API, namely HTTP. Anything that talks HTTP can talk to Nanoki. And vis-versa.

and fastcgi for example

No CGI, FastCGI or any variation thereof.

since you seem to rely on your HTTP.lua server ?

Yes, Nanoki has its own HTTP implementation. One could emulate such module with CGI or what not, but... why bother?

Unless I missed something of course. It might then be interesting to make it easier to deploy your work in such environments ?

Typically, one has three broad option to run something like Nanoki:

1. Using the build-in TCPServer. The TCPServer module is implemented in terms of the LuaSocket library.



local TCPServer = require( 'TCPServer' )
local aServer = TCPServer( '', 1080 )

HTTP[ '/hello(%a*)' ] = function( aName ) return 'Hello ' .. ( aName or 'world' ) end

aServer( HTTP )


In such scenario, one has a single threaded long running instance of a HTTP server.

2. Using an external tcp wrapper, such as D. J. Bernstein tcpserver:

% tcpserver 0 1080 lua Hello.lua

In such scenario, the tcp wrapper starts a new lua instance for each request allowing one to handle multiple request at the concurrently through multiple processes. This is akin to a CGI setup.

3. Using the build-in TCPServer in a cluster configuration

Same as the first option, but with several long running processes sitting behind a load balancer/reverse proxy of some sort, e.g. nginx, lighttpd, apache, whatnot.

Something like this for nginx:

    upstream cluster

        listen      1080;
        location    /
            proxy_pass          http://cluster;
            proxy_set_header    Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;