File: extendconfiguration.wiki

package info (click to toggle)
ocsigenserver 2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 2,484 kB
  • sloc: ml: 11,641; makefile: 707; sh: 619
file content (120 lines) | stat: -rw-r--r-- 4,591 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120

=Extendconfiguration=

Extendconfiguration allows to configure some options of the server inside a {{{<host>}}} tag. (This extension is available starting from Ocsigen ≥ 1.2)

==Loading the extension

To use that extension, first load it from the configuration file:

{{{
<extension findlib-package="ocsigenserver.ext.extendconfiguration"/>
}}}

== Options
=== Following symlinks

For extensions that access files on the filesystem (<<a_manual chapter="staticmod"|staticmod>>,...), you can decide whether symlinks should be followed or not, using the tag

{{{
<followsymlinks value="VAL" />
}}}

where {{{VAL}}} can be:
    * {{{never}}} entirely disallows following symlinks.
    * {{{always}}} always follows symlinks (more efficient). Note that this setting is not permitted in userconf files
    * {{{ownermatch}}} symlinks are followed only if the owner of the symlink and of the target coincide. (Default value)

Notice that staticmod partially overrides this setting when it not used in a userconf file. When used with the syntax {{{<static dir="dir" />}}}, the checks start only after the directory {{{dir}}}. In regexp mode, the checks only start after the value given by the {{{root}}} attribute. See the documentation of <<a_manual chpater="staticmod"|staticmod>>] for details.

=== Hiding or forbidding local files

Again for extensions that send local files, you can selectively disallow sending some files. The syntax is as such:

<hidefile>
  <extension ext="php" />
  <extension ext="cgi" />
  <file file=".htaccess" />
  <regexp regexp=".*hidden_file.*" /> <!-- End the regexp with $ to match the full file name -->
</hidefile>

Using the tag {{{hidefile}}} results in 404 error codes. To have 403 errors, use {{{forbidfile}}} instead.

=== Index of directories

When the user requests access to a directory of the filesystem, Ocsigen can automatically try to find an index file. This is done through the following option

{{{
<defaultindex>
  <index>index1</index>
  <index>index2</index>
</defaultindex>
}}}

Ocsigen serves the first file (according to the order given by the index tags) that exists.

=== List the content of directories

If you want to list the content of a directory that does not contain an index file, use the tag

{{{
<listdirs value="true" />
}}}

You can also deactivate this option with {{{value="false"}}} instead.

=== Charset

The charset of the text files that are sent by the server can be set using the tag

{{{
<charset default="utf-8">
  <extension ext='txt' value="iso8859-15" />
  <file file="bla.text" value="iso8859-15" />
  <regexp regexp=".*text.*"  value="iso8859-15" />
</charset>
}}}

This sets the default charset for text files to {{{utf8}}}, while files whose extension
are {{{txt}}}, or that are named {{{bla.text}}}, or whose name contains {{{text}}} are sent as
{{{iso8859-15}}}.

Multiple extension tags can be specified. Both the default attribute and extension tags are optional. Extension tags are cumulative between the various sites.

=== Content-type

The content-type for the files sent by the server can be specified using the tag

{{{
<contenttype default="application/octet-stream">
  <extension ext='txt' value="text/plain" />
  <file file="bla.text" value="text/plain" />
  <regexp regexp=".*text.*"  value="text/plain" />
</contenttype>
}}}

The options are similar to the ones for the {{{charset}}} tag.


===@@id='upload' File uploading

//From Ocsigen ≥ 1.3//

You can specify the directory in which the files stored in POST requests are uploaded, as well
as the maximum size for these files. The two options are named {{{uploaddir}}} and {{{maxuploadfilesize}}}:
{{{
<uploaddir>/tmp</uploaddir>
<maxuploadfilesize>1MB</maxuploadfilesize>
}}}
The arguments are the same as for the global corresponding options ; see the <<a_manual chapter="config" fragment="upload"|configuration>> page for details. In order to disallow uploading for a specific
host or site, use an empty path: {{{<uploaddir></uploaddir>}}}.

//Warning//

POST arguments (including sent files) are read once and for all, by the first extension that attempts to decode the POST parameters. This means that the POST-uploaded files are stored //according to the settings local to this first extension//. Changing the {{{uploaddir}}} and {{{maxuploadfilesize}}} options later will have no effect; plan accordingly when you write your {{{ocsigen.conf}}} file. Currently the only extension supplied
with Ocsigen that reads POST data is Eliom.


== Visibility

The options above are visible until the end of the <site> tag they are part of.