Re: [Cppcms-users] Some remarks
Brought to you by:
artyom-beilis
From: Markus R. <us...@ma...> - 2009-10-28 18:15:32
|
Artyom wrote: >> Can someone explain me how to use cppcms_run for a production release or >> is it not suitable for that? > > Defenatly not. cppcms_run is just tool for debugging and testing the > framework agains different web servers. Thanks for making that clear. I have to admit that it is great tool for debugging and testing! > For example. This is configuration of production CppCMS wiki service for > lighttpd. Thank you for your configuration and explanation! I am not sure at the moment which server to use. >> I am a bit confused why the document root is an absolut path, while the >> fcgi process must be relative: >> /usr/local/bin/cppcms_run: line 474: ./MY_ABS_PATH/hello.fcgi: File not >> found (so ./ is prefixed there) > > It is just because I'm too lazy to write full path. So cppcms_run assumes > that the script is placed in current working directory and it names script > -- the base path according to program name by default. Ok, this makes perfectly sense when it is used for debugging. >> 2.) How can I run the site at the root of the server? >> >> When I use -s /hello, I can access the site at >> http://markusbyte:8080/hello/. How can I completely avoid the /hello/ to >> access the site at http://markusbyte:8080/. >> >> I hope it can be done without rewrite rules. It would be perfect if there >> is a webserver independend way? > > > Generally it is **bad** idea. And I explain why. Web server does much more > then providing fast-cgi service it also serves files. If hello is related > to / then if you want to get a file "/hello.css" you need to know how to > serve it VIA your program, and beleve me YOU DO NOT want to do this > because serving files has LOTs of security issues that should be handled > correctly. It is easy to give exceptions that specific paths or file extensions are not handeled by a fcgi program. At least with mod_rewrite for apache. I absolutely agree that for a normal web application or cms the normal file delievery should be done by the web server because of the security issues. But for the project I am writing these security issues do not exist. All files are in a single directory where the user has only read, but no write permissions. For my system it is not possible to distinguish between content and media files, because all can be delieverd as they are or rendered to html files. Besides that I want full control over the delievery and want my own code to design what to do with a specific mime type and so on. Delievering everything myself also makes it possible to have a global caching strategy for all files. I also want syndication for all directories. The file delievery already works btw. > Generally you may specify as script "/", but some web servers have problem > with that. I tried it with nginx and apache2 and it did not work for both. >> 3.) Using filters in other classes than base_view. >> >> The filters like escape can be only used in base_view classes (or classes >> inheriting from it) and I don't see any reason why. In addition to that >> there are not const, but they don't modify the object (they just return a >> string). >> > > They are not const but some filter may be non-const. Just think that you > may to access DB from filter if cache is not avalible (not that it is > correct way to do this) const only refers to the state of the object, not to global sideeffects like network or database. For caching you can use the keyword mutable. >> I would suggest to make them as functions or static methods. >> --------- > > In CppCMS 1.x.x they are static methods. Ok, this is perfect then. Up to that I need a copy of encode in my code. > There is one more important quite technical point why these functions are > members. I have not used filters enough up to yet. But I am sure creating your own filters can be very handy. >> 4.) Wrong mime type for failure pages. >> >> For 500 internal server errors, 404 document not found and so on the >> Content-Type is text/plain even though a html page is shown[0]. > > Ok I need to check this. When do you get page of size "0" generally when > 500 or 404 error occures an html page is generated as well? How do you > get such error? There is a telnet session at the end. Do you need other information? >> 5.) Interface to set_header. >> >> In cppcms::application set_header takes a pointer to HTTPHeader. When I >> look into cppcms::worker_thread::set_header I see that a auto_ptr is >> taking ownership of this pointer. Maybe the documentation points out that >> too, but it would be much clearer if the the auto_ptr is used in the >> interface. Having that, it would be easy to see that you can pass a fresh >> allocated object without having to worry what will happen. So it should >> read: >> >> void set_header(std::auto_ptr<cgicc::HTTPHeader> h) { >> worker.set_header(h); } >> > > I am absolutly agree, but I must admit that all http headers stuff is > quite conceptually broken because of very bad design of CgiCC library > CppCMS uses. It is totally rewritten in CppCMS 1.x.x Ok, now I can't await CppCMS 1.x.x :-) thank you Markus Raab -- http://www.markus-raab.org | Einsicht ist der erste Schritt zur -o) | Besserung. -- Sprichwort Kernel 2.6.24-1-a /\ | on a x86_64 _\_v | |