One idea that was floated at least once was to replace all the code currently have on top of mochiweb directly with webmachine.
This would make extensions and improvements follow already well defined patterns provided by webmachine. -Mikeal Sent from my iPhone On Aug 20, 2010, at 2:09 AM, Benoit Chesneau <[email protected]> wrote: > Hi all, > > I work a lot these days around the httpd code and the more I work on > the more I think we should refactor it to make it easier to hack and > extend. There is indeed a lot of code in one module (couch_httpd_db) > and recent issue like vhost and location rewriting could be easier to > solve if we had an http layer more organized in my opinion. > > Actually we do (in 1.0.1 or trunk) : > > request -> couch_httpd loop -> request_handler -> check vhost and > eventually rewrite url -> request_int -> request_db -> request > doc|request _design | request attachment | request global handler | > request misc handler > > with extra level : request_design -> rewrite handler| > show|lists|update\lview ... and request_int that catch all errors and > has the responsibility to send errors if anything happend and wasn't > catched on other layers. > > It could be easier. We could do it more resource oriented for example > than it is. 1 module, 1 resource. Refactoring httpd code would also > allow us to reuse more code than we do actually maybe by wrapping api. > > How : > > - Some times ago we started to port it using webmachine with davisp, > but we didn't finish. Maybe it's a good time ? Or do we want to follow > another way ? > > - If we go on this refactoring it could be also a good time to split > couchdb in different apps : couchdb-core and couchdb foe example > (maybe couchdb-appengine ?) so we could develop independantly each > levels and make code history cleaner. > > > Thoughts ? > > > - benoit
