openresty / lua-resty-upload

Streaming reader and parser for http file uploading based on ngx_lua cosocket
404 stars 113 forks source link

make the constant MAX_LINE_SIZE configurable #20

Closed sjnam closed 8 years ago

sjnam commented 8 years ago

local form, err = upload:new() if not form then ngx.log(ngx.ERR, "failed to new upload: ", err) ngx.exit(500) end

local max_line_size = 1024 form:set_line_size(max_line_size)

agentzh commented 8 years ago

Maybe we can just make the max_line_size the (optional) second argument to the new method?

sjnam commented 8 years ago

Is this OK?

agentzh commented 8 years ago

@sjnam Will you please add some test cases for this feature to the existing test suite? Otherwise it looks good to me :) Thanks a lot!

sjnam commented 8 years ago

I added test case "TEST 10" which is almost identical to "TEST 2" except the following line

local form = upload:new(5, 1024) -- max_line_size = 1024

so this test case has not an error. TEST 2 has an "fail to read: line too long" error.

agentzh commented 8 years ago

@sjnam That's cool. Thank you. I'll look into this PR soon.

sjnam commented 8 years ago

@agentzh Happy New Year! :-) I added one more blank line.

agentzh commented 8 years ago

I'll check this out soon, thank you. And happy new year :)

agentzh commented 8 years ago

@sjnam Sorry for the delay on my side. Just merged your changes to git master :) Thanks a lot!