Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file ocsigen_config.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228(* Ocsigen
* Copyright (C) 2005-2017 Vincent Balat
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, with linking exception;
* either version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)includeOcsigen_config_staticexceptionConfig_file_errorofstringtypessl_info={ssl_certificate:stringoption;ssl_privatekey:stringoption;ssl_ciphers:stringoption;ssl_dhfile:stringoption;ssl_curve:stringoption}moduleSocket_type=structtypet=[|`All|`IPv4ofUnix.inet_addr|`IPv6ofUnix.inet_addr]letto_string=function|`All->Unix.string_of_inet_addrUnix.inet_addr_any|`IPv4u->Unix.string_of_inet_addru|`IPv6u->Unix.string_of_inet_addruletto_inet_addr=function|`All->Unix.inet_addr_any|`IPv4u->u|`IPv6u->uendtypesocket_type=Socket_type.t(* General config *)letverbose=reffalseletsilent=reffalseletdaemon=reffalseletveryverbose=reffalseletdebug=reffalseletversion_number="0000000000000000"letpidfile=ref(None:stringoption)letserver_name="Ocsigen"letfull_server_name=server_name^"/"^version_numberletnative_ext=ifis_nativethen".exe"else".bc"let(uploaddir:stringoptionref)=refNoneletsyslog_facility=ref(None:Lwt_log.syslog_facilityoption)letminthreads=ref10letmaxthreads=ref30letmax_number_of_connections=ref350letsilent_client_timeout=ref30(* without speaking during sending frame *)letsilent_server_timeout=ref30(* without speaking during sending frame *)letfilebuffersize=ref8192letmaxrequestbodysize=ref(Some(Int64.of_int8000000))letmaxrequestbodysizeinmemory=ref8192letmaxuploadfilesize=ref(Some(Int64.of_int2000000))letdefaultcharset=ref(None:stringoption)letuser=ref(Some!default_user)letgroup=ref(Some!default_group)letdebugmode=reffalseletdisablepartialrequests=reffalseletusedefaulthostname=reffalseletrespectpipeline=reffalseletmaxretries=ref10letshutdowntimeout=ref(Some10.)letssl_info=refNoneletports=ref[]letssl_ports=ref[]letset_uploaddiru=uploaddir:=uletset_logdirs=logdir:=Somesletset_syslog_facilityf=syslog_facility:=f;logdir:=Noneletset_configfiles=config_file:=sletset_pidfiles=pidfile:=Somesletset_mimefiles=mimefile:=slet()=Lwt_log.add_rule"ocsigen:*"Lwt_log.Warning(* without --verbose *)letset_verbose()=verbose:=true;Lwt_log.add_rule"ocsigen:*"Lwt_log.Noticeletset_silent()=silent:=trueletset_daemon()=set_silent();daemon:=trueletset_veryverbose()=verbose:=true;veryverbose:=true;Lwt_log.add_rule"ocsigen:*"Lwt_log.Infoletset_debug()=verbose:=true;veryverbose:=true;debug:=true;Lwt_log.add_rule"ocsigen:*"Lwt_log.Debugletset_minthreadsi=minthreads:=iletset_maxthreadsi=maxthreads:=iletset_max_number_of_threads_queued=Lwt_preemptive.set_max_number_of_threads_queuedletset_max_number_of_connectionsi=max_number_of_connections:=iletset_client_timeouti=silent_client_timeout:=iletset_server_timeouti=silent_server_timeout:=i(* let set_keepalive_timeout i = keepalive_timeout := i
let set_keepopen_timeout i = keepopen_timeout := i *)letset_filebuffersizei=filebuffersize:=iletset_maxuploadfilesizei=maxuploadfilesize:=iletset_maxrequestbodysizei=maxrequestbodysize:=iletset_maxrequestbodysizeinmemoryi=maxrequestbodysizeinmemory:=iletset_default_charseto=defaultcharset:=oletset_datadiro=datadir:=oletset_bindiro=bindir:=oletset_extdiro=extdir:=oletset_usero=user:=oletset_groupo=group:=oletset_command_pipes=command_pipe:=sletset_debugmodes=debugmode:=sletset_disablepartialrequestss=disablepartialrequests:=sletset_usedefaulthostnames=usedefaulthostname:=sletset_respect_pipeline()=respectpipeline:=trueletset_maxretriesi=maxretries:=iletset_shutdown_timeouts=shutdowntimeout:=sletset_ssl_infoi=ssl_info:=iletset_portsl=ports:=lletset_ssl_portsl=ssl_ports:=lletget_uploaddir()=!uploaddirletget_logdir()=match!logdirwith|Somes->s|None->raise(Config_file_error("Log directory requested, but not set"));;letget_syslog_facility()=!syslog_facilityletget_config_file()=!config_fileletget_pidfile()=!pidfileletget_mimefile()=!mimefileletget_verbose()=!verboseletget_silent()=!silentletget_daemon()=!daemonletget_veryverbose()=!veryverboseletget_debug()=!debugletget_default_user()=!default_userletget_default_group()=!default_groupletget_minthreads()=!minthreadsletget_maxthreads()=!maxthreadsletget_max_number_of_threads_queued=Lwt_preemptive.get_max_number_of_threads_queuedletget_max_number_of_connections()=!max_number_of_connectionsletget_client_timeout()=!silent_client_timeoutletget_server_timeout()=!silent_server_timeoutletget_filebuffersize()=!filebuffersizeletget_maxuploadfilesize()=!maxuploadfilesizeletget_maxrequestbodysize()=!maxrequestbodysizeletget_maxrequestbodysizeinmemory()=!maxrequestbodysizeinmemoryletget_default_charset()=!defaultcharsetletget_datadir()=!datadirletget_bindir()=!bindirletget_extdir()=!extdirletget_user()=!userletget_group()=!groupletget_command_pipe()=!command_pipeletget_debugmode()=!debugmodeletget_disablepartialrequests()=!disablepartialrequestsletget_usedefaulthostname()=!usedefaulthostnameletget_respect_pipeline()=!respectpipelineletget_maxretries()=!maxretriesletget_shutdown_timeout()=!shutdowntimeoutletget_ssl_info()=!ssl_infoletget_ports()=!portsletget_ssl_ports()=!ssl_portsletget_default_port()=match!portswith|(_,p)::_->p|[]->80letget_default_sslport()=match!ssl_portswith|(_,p)::_->p|[]->443letdisplay_version()=print_stringversion_number;print_newline();exit0moduleCustom=structletm=refHmap.empty(* TODO : two type variables? *)type'akey=('a->'a)option*'aHmap.keyletkey?preprocess()=preprocess,Hmap.Key.create()letfind(_,k)=Hmap.findk!mletset(f,k)v=letv=matchfwith|Somef->fv|None->vinm:=Hmap.addkv!mletunset(_,k)=m:=Hmap.remk!mend