Giter Site home page Giter Site logo

Comments (11)

oneoo avatar oneoo commented on September 17, 2024
  1. 大文件上传,稍后加入
  2. reqiure 的虚拟主机路径支持,也会加入
  3. header 和 body 的设置稍后会,并入到 host-route.lua 进行统一配置
  4. 代码缓存的ttl请在命令行使用 code-cache-ttl=0 参数

from alilua.

t2meng avatar t2meng commented on September 17, 2024

好的。

from alilua.

oneoo avatar oneoo commented on September 17, 2024

require 的虚拟主机路径已加入(但 require 会缓存结果,多个虚拟主机会出现命名冲突;可在 core.lua 打开防止冲突的支持。因为影响性能,所以未默认打开)

request header body等限制已加入,稍后再整理需求进行补充(在 host-route.lua 配置文件增加 config 配置)

而大文件上传,待 AIO 封装好会补上。这个工作量比较大。预计下一版本实现

from alilua.

t2meng avatar t2meng commented on September 17, 2024

非常感谢oneoo。

还有个建议,对于大文件上传,建议也实现一组non-blocking的操作文件的api(类 io.* api),还有在实现AIO 封装上,希望做到平台无关,让mac和freebsd也能用上,我是在freebsd上运行alilua的。

from alilua.

t2meng avatar t2meng commented on September 17, 2024

对于require的命名冲突,建议还是每个虚拟主机一个不相关的state吧。

from alilua.

oneoo avatar oneoo commented on September 17, 2024

多个 state 会带来更多开销,1是查找对应的state,另外消耗更多内存。
如果不希望影响性能,而又要避免 require 的命名冲突。还有个方法是把模块文件放在一个特殊的目录下。
比如:
/a.com/a-com-lib/m.lua

require('a-com-lib.m')

from alilua.

oneoo avatar oneoo commented on September 17, 2024

已改写 Lua 原生的 require 方法,支持虚拟机的代码缓存隔离,且支持缓存生命时间设置(跟 code cache 一致)

from alilua.

t2meng avatar t2meng commented on September 17, 2024

感谢。^ ^

from alilua.

oneoo avatar oneoo commented on September 17, 2024

重写 HTTP Parse并引入 eio 伪非堵塞IO。以实现流式处理

例子:

local key,val,need_chunk_read,file_name,file_type = next_post_field()
while key do
    print(key,val,need_chunk_read,file_name,file_type, "\n")
    if need_chunk_read then
        local fh,en,e
        if file_name then
            fh,en,e = eio.open('/tmp/a', 'w')
            if not fh then
                _print(fh,en,e)
            end
        end

        local chunk = read_post_field_chunk()
        while chunk do
            print('[', file_name and #chunk or chunk, ']', "\n")
            if file_name then fh:write(chunk) end
            chunk = read_post_field_chunk()
        end
        if file_name then fh:close() end
    end

    key,val,need_chunk_read,file_name,file_type = next_post_field()
end

from alilua.

t2meng avatar t2meng commented on September 17, 2024

赞!^ ^

from alilua.

oneoo avatar oneoo commented on September 17, 2024

done

from alilua.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.