• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item4662: TWiki as a stand alone server

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine   Enhancement Closed TWiki:Main.GilmarSantosJr major  

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

See TWiki:Codev/TWikiStandAlone

-- TWiki:Main/GilmarSantosJr - 18 Sep 2007

HTTP engine may send wrong Content-Type response header for static files ("text/plain" for css files, for example) unless there is a $HOME/.mime.types or $HOME/.media.types file with the following format:

text/css         css
text/html        html htm
# ...

Debian has a file like that: /etc/mime.types. Copy it to home directory of user running http stand alone. Don't forget to rename to .mime.types (notice the initial dot)

-- TWiki:Main.GilmarSantosJr - 19 Sep 2007

HTTP engine could send wrong status line response header for non-HTTP/0.9 clients. Fixed: svn 14943.

-- TWiki:Main.GilmarSantosJr - 19 Sep 2007

  • mime.types problem fixed: now $TWiki::cfg{MimeTypesFileName} is used.
  • auto restart feature added to HTTP engine
  • Fixed crash after the TWiki::generateHTTPHeaders and modifyHeaderHandler introduction

-- TWiki:Main.GilmarSantosJr - 15 Oct 2007

Added call to CGI::initialize_globals() just before call to CGI constructor.

This fix a great bug (and security hole): CGI caches information in global variables (so, it's possible to call constructor multiple times, even if data from STDIN was alredy read), and it was a serious problem to FastCGI engine, cause those variables were not reinitialized and data (mainly login information, since it is the first posted data most of times) persisted between calls, even if "logout" was used. It was not a problem to CGI engine: since it is executed for every request, it always have a "clean" memory.

CGI::initialize_globals() is not documented. Care must be taken, since it could be changed in future versions...

Tested with CGI, version 3.15 (distributed with perl 5.8.8)

-- TWiki:Main.GilmarSantosJr - 21 Oct 2007

Finally I'll start to merge this work with core code. In summary, changes are:

  • Add the abstraction layer created
  • Update code to use it
  • Add engine infra-structure
  • Add CGI and CLI engines
  • Update test framework
  • Update some unit tests
  • Update documentation

Add the abstraction Layer DONE

This work makes it possible to use TWiki under many execution mechanisms easily. To achieve this, an abstraction layer was created. This layer isolates most part of core code from the details of each mechanism. It's composed of three classes:

  • TWiki::Request: responsible for encapsulate request data and provide it to core, independent of which mechanism is in use
  • TWiki::Request::Upload: helper class to deal with uploads
  • TWiki::Response: container to response data
  • TWiki::LoginManager::Session: support for sessions independent from CGI environment
  • Update lib/MANIFEST

Add engine infra-structure & default engines DONE

This is the part in charge of dealing with details of execution mechanism. It complements the layer above. It's composed of:

  • TWiki::Engine: abstract base class. Must be overridden by each engine.
  • TWiki::EngineException: exception class, used by engines.
  • TWiki::Engine::CGI: CGI engine.
  • TWiki::Engine::CLI: CLI Engine
  • bin/twiki_cgi.pl: new start point
  • Update lib/MANIFEST

It's also needed to remove old scripts and make them links to twiki_cgi.pl.

Update REST Interface DONE

There is a script, bin/rest, that is different from others: it implements it's action without a TWiki::UI::* class. To make it work in the new way, I modified it to be similar to the others. So the needed changes are:

  • Add TWiki::UI::Rest
  • Make bin/rest a link to bin/twiki_cgi.pl
  • Update lib/MANIFEST

Core Updates DONE

There are many changes that need to be performed within core code in order to get things working:

  • Replace TWiki::UI with the new one
  • Replace %ENV reads with TWiki::Request method calls
  • Replace print=='s with ==TWiki::Response method calls
  • Rename $twiki->{cgiQuery} to $twiki->{request}
    • Propagate this change
  • Add new field: $twiki->{response}
  • Update some default tag handler's
  • Eliminate ==die=='s and ==exit=='s
  • Add $TWiki::engine variable
  • Make TWiki::UTF82SiteCharSet a method
  • Update TWiki::writeCompletePage
  • Update TWiki::redirect
  • Replace CGI class by TWiki::Request when appropriated
  • Update TWiki::Func::writeHeader
  • Update TWiki::LoginManager

UnitTestContrib updates DONE

There were updates to some unit tests of default plugins and to the UnitTestContrib itself. Main changes were:

  • Replace new CGI by new Unit::Request
  • Replace ->{cgiQuery} by ->{request} (or $this->{request} if test is derived from TWikiFnTestCase)
  • Set charset after the session object is created

Sven stated that plugins must work and be testable in any release, and currently (at least the test) works only with trunk. We agreed to add an abstraction layer class (to use in place of CGI and TWiki::Request) that verify version in use and makes itself derived from the right class, so tests work on any version. As soon as I can I'll implement this.

Updates to default plugins DONE

Only WysiwygPlugin needed to be updated. There was a discussion at twiki-dev mailing list and I implemented the proposed solution: pass TWiki::Response object to REST handlers. The handlers, then, test if there is such parameter and use it or print data directly if there isn't.

Write Unit Tests for the new code Work in progress, under construction

I'll concentrate on this just after solving the compatibility issue of plugin's unit tests.

Documentation updates Work in progress, under construction

Some documents need updates

  • TWikiFuncDotPm
    • Add TWiki::Response documentation
  • Install instructions
  • Code comments/docs

-- TWiki:Main.GilmarSantosJr - 18 Jun 2008/21 Jul 2008/04 Oct 2008

excellent smile I enabled the unit tests on the trunk a few weeks ago in preparation for you - I think the sooner you merge, the sooner more people can help.

-- TWiki:Main.SvenDowideit - 19 Jun 2008

I am setting this to "closed" - this is done besides some documentation.

-- TWiki:Main.PeterThoeny - 2013-10-17

ItemTemplate
Summary TWiki as a stand alone server
ReportedBy TWiki:Main.GilmarSantosJr
Codebase

SVN Range TWiki-4.2.0, Tue, 18 Sep 2007, build 14928
AppliesTo Engine
Component

Priority Enhancement
CurrentState Closed
WaitingFor TWiki:Main.GilmarSantosJr
Checkins TWikirev:14593 TWikirev:14882 TWikirev:14884 TWikirev:14885 TWikirev:14899 TWikirev:14900 TWikirev:14906 TWikirev:14924 TWikirev:14943 TWikirev:15054 TWikirev:15277 TWikirev:15278 TWikirev:15279 TWikirev:15283 TWikirev:15284 TWikirev:15345 TWikirev:15346 TWikirev:15363 TWikirev:15366 TWikirev:15381 TWikirev:15382 TWikirev:15394 TWikirev:15395 TWikirev:15396 TWikirev:15397 TWikirev:15399 TWikirev:15402 TWikirev:15421 TWikirev:15423 TWikirev:15425 TWikirev:15426 TWikirev:15427 TWikirev:15428 TWikirev:15538 TWikirev:15684 TWikirev:16425 TWikirev:16426 TWikirev:16427 TWikirev:16428 TWikirev:16429 TWikirev:16435 TWikirev:16462 TWikirev:16463 TWikirev:16464 TWikirev:16513 TWikirev:16514 TWikirev:16515 TWikirev:16726 TWikirev:16727 TWikirev:16728 TWikirev:16729 TWikirev:16730 TWikirev:16732 TWikirev:16893 TWikirev:16914 TWikirev:16949 TWikirev:16950 TWikirev:16951 TWikirev:16987 TWikirev:17062 TWikirev:17065 TWikirev:17066 TWikirev:17067 TWikirev:17068 TWikirev:17070 TWikirev:17071 TWikirev:17072 TWikirev:17073 TWikirev:17074 TWikirev:17075 TWikirev:17077 TWikirev:17078 TWikirev:17079 TWikirev:17080 TWikirev:17081 TWikirev:17082 TWikirev:17083 TWikirev:17084 TWikirev:17085 TWikirev:17086 TWikirev:17087 TWikirev:17088 TWikirev:17089 TWikirev:17090 TWikirev:17091 TWikirev:17317 TWikirev:17318 TWikirev:17319 TWikirev:17320 TWikirev:17321 TWikirev:17322 TWikirev:17535
TargetRelease major
ReleasedIn

Edit | Attach | Watch | Print version | History: r99 < r98 < r97 < r96 < r95 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r99 - 2013-10-17 - PeterThoeny
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback