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

Sigh...

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:

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

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.

http://dev.alt.textdrive.com/browser/HTTP/TCPServer.lua

E.g.:

-->8--

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


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

aServer( HTTP )

--8<--

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:

http
{
    upstream cluster
    {
        server 127.0.0.1:2081;
        server 127.0.0.1:2082;
        server 127.0.0.1:2083;
        server 127.0.0.1:2084;
    }

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

Cheers,

PA.