[Mongrel] mongrel_upload_progress question/possible suggestion

Brad Ediger brad at bradediger.com
Mon Nov 13 10:58:30 EST 2006


I'm pretty sure that decision was made for performance reasons...  
nontrivial regexes take significantly more processing than string  
matching. If you have actual concerns about performance, you should  
always benchmark (http://mongrel.rubyforge.org/docs/ 
how_many_mongrels.html).

I used an array for this purpose... you can say :path_info => ['one  
path', 'another path' ... ]. I think Zed checked my patch for that in  
to svn, and I'm pretty sure it's available in the 0.3.13.4 prerelease.

Brad

On Nov 13, 2006, at 1:57 AM, Matt White wrote:

> Hey all,
>
> First off, thanks to Rick Olson and whoever else was involved with  
> this plugin... It's been amazingly easy to implement.
>
> I've got a question about the path_info parameter, though... It  
> seems that unless the request PATH_INFO exactly matches the  
> path_info passed in to the plugin at inclusion, it won't actually  
> trigger Add and add the upload to the list of running transfers.  
> I'm assuming that this is for performance reasons, and makes good  
> sense. However, I'm in a situation where I don't know the exact  
> path that I will b e uploading from, because of various routing  
> info in my app.
>
> Thus, the ability for path_info to be a regex instead of just a  
> string, thus allowing for:
>
> return unless params['PATH_INFO'] =~ @path_info &&
>         params[Mongrel::Const::REQUEST_METHOD] == 'POST' &&
>         upload_id = Mongrel::HttpRequest.query_parse(params 
> ['QUERY_STRING'])['upload_id']
>
> Then I just update my handler like so:
>
> uri "/",
>   :handler => plugin("/handlers/upload", :path_info => %r{/account/ 
> \d/\d/media/upload}),
>   :in_front => true
>
> And everything works fine... It's a super-small tweak, obviously,  
> but I found that it made it a lot easier for me to use the plugin.
>
> Thoughts? Is there a better way to do this?
>
> Matt
>
> -- 
> Thermal Creative
> http://blog.thermalcreative.com
> _______________________________________________
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20061113/bb6e0f84/attachment.html 


More information about the Mongrel-users mailing list