diff options
author | Ingela Anderton Andin <[email protected]> | 2015-06-10 14:11:14 +0200 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2015-06-16 09:45:02 +0200 |
commit | 77d02ff81a4b7c0ea5f26b4e83097902556bef83 (patch) | |
tree | 05d90213f216662e9b2912568c93ee63d1f3b7da /lib/inets | |
parent | d30b4ad1fac539b028fb8067caa6ff9c0cfbf004 (diff) | |
download | otp-77d02ff81a4b7c0ea5f26b4e83097902556bef83.tar.gz otp-77d02ff81a4b7c0ea5f26b4e83097902556bef83.tar.bz2 otp-77d02ff81a4b7c0ea5f26b4e83097902556bef83.zip |
inets: Remove use of httpd_conf:clean/1 and httpd_conf:custom_clean/3
Internal use of the function white_space_clean/1 could probably be done
in a much better way using re-module and removing a lot of legacy code.
But we will have to do this later, due to lack of time, we want to make
this commit as little work as possible.
Diffstat (limited to 'lib/inets')
-rw-r--r-- | lib/inets/src/http_server/httpd_conf.erl | 94 | ||||
-rw-r--r-- | lib/inets/src/http_server/mod_actions.erl | 4 | ||||
-rw-r--r-- | lib/inets/src/http_server/mod_alias.erl | 6 | ||||
-rw-r--r-- | lib/inets/src/http_server/mod_auth.erl | 26 | ||||
-rw-r--r-- | lib/inets/src/http_server/mod_auth_plain.erl | 4 | ||||
-rw-r--r-- | lib/inets/src/http_server/mod_cgi.erl | 8 | ||||
-rw-r--r-- | lib/inets/src/http_server/mod_disk_log.erl | 22 | ||||
-rw-r--r-- | lib/inets/src/http_server/mod_esi.erl | 16 | ||||
-rw-r--r-- | lib/inets/src/http_server/mod_htaccess.erl | 2 | ||||
-rw-r--r-- | lib/inets/src/http_server/mod_log.erl | 8 | ||||
-rw-r--r-- | lib/inets/src/http_server/mod_security.erl | 18 |
11 files changed, 106 insertions, 102 deletions
diff --git a/lib/inets/src/http_server/httpd_conf.erl b/lib/inets/src/http_server/httpd_conf.erl index e82ad5a637..89a7e96f3e 100644 --- a/lib/inets/src/http_server/httpd_conf.erl +++ b/lib/inets/src/http_server/httpd_conf.erl @@ -24,7 +24,7 @@ remove/1, remove_all/1, get_config/3, get_config/4, lookup_socket_type/1, lookup/2, lookup/3, lookup/4, - validate_properties/1]). + validate_properties/1, white_space_clean/1]). %% Deprecated -export([is_directory/1, is_file/1, make_integer/1, clean/1, @@ -80,7 +80,7 @@ load("MaxHeaderSize " ++ MaxHeaderSize, []) -> {ok, Integer} -> {ok, [], {max_header_size,Integer}}; {error, _} -> - {error, ?NICE(clean(MaxHeaderSize)++ + {error, ?NICE(string:strip(MaxHeaderSize)++ " is an invalid number of MaxHeaderSize")} end; @@ -89,7 +89,7 @@ load("MaxURISize " ++ MaxHeaderSize, []) -> {ok, Integer} -> {ok, [], {max_uri_size, Integer}}; {error, _} -> - {error, ?NICE(clean(MaxHeaderSize)++ + {error, ?NICE(string:strip(MaxHeaderSize)++ " is an invalid number of MaxHeaderSize")} end; @@ -98,12 +98,12 @@ load("MaxContentLength " ++ Max, []) -> {ok, Integer} -> {ok, [], {max_content_length, Integer}}; {error, _} -> - {error, ?NICE(clean(Max) ++ + {error, ?NICE(string:strip(Max) ++ " is an invalid number of MaxContentLength")} end; load("ServerName " ++ ServerName, []) -> - {ok,[], {server_name, clean(ServerName)}}; + {ok,[], {server_name, string:strip(ServerName)}}; load("ServerTokens " ++ ServerTokens, []) -> %% These are the valid *plain* server tokens: @@ -111,28 +111,28 @@ load("ServerTokens " ++ ServerTokens, []) -> %% It can also be a "private" server token: private:<any string> case string:tokens(ServerTokens, [$:]) of ["private", Private] -> - {ok,[], {server_tokens, clean(Private)}}; + {ok,[], {server_tokens, string:strip(Private)}}; [TokStr] -> - Tok = list_to_atom(clean(TokStr)), + Tok = list_to_atom(string:strip(TokStr)), case lists:member(Tok, [none, prod, major, minor, minimum, os, full]) of true -> {ok,[], {server_tokens, Tok}}; false -> - {error, ?NICE(clean(ServerTokens) ++ + {error, ?NICE(string:strip(ServerTokens) ++ " is an invalid ServerTokens")} end; _ -> - {error, ?NICE(clean(ServerTokens) ++ " is an invalid ServerTokens")} + {error, ?NICE(string:strip(ServerTokens) ++ " is an invalid ServerTokens")} end; load("SocketType " ++ SocketType, []) -> %% ssl is the same as HTTP_DEFAULT_SSL_KIND %% essl is the pure Erlang-based ssl (the "new" ssl) - case check_enum(clean(SocketType), ["ssl", "essl", "ip_comm"]) of + case check_enum(string:strip(SocketType), ["ssl", "essl", "ip_comm"]) of {ok, ValidSocketType} -> {ok, [], {socket_type, ValidSocketType}}; {error,_} -> - {error, ?NICE(clean(SocketType) ++ " is an invalid SocketType")} + {error, ?NICE(string:strip(SocketType) ++ " is an invalid SocketType")} end; load("Port " ++ Port, []) -> @@ -140,7 +140,7 @@ load("Port " ++ Port, []) -> {ok, Integer} -> {ok, [], {port, Integer}}; {error, _} -> - {error, ?NICE(clean(Port)++" is an invalid Port")} + {error, ?NICE(string:strip(Port)++" is an invalid Port")} end; load("BindAddress " ++ Address0, []) -> @@ -196,7 +196,7 @@ load("BindAddress " ++ Address0, []) -> end; load("KeepAlive " ++ OnorOff, []) -> - case list_to_atom(clean(OnorOff)) of + case list_to_atom(string:strip(OnorOff)) of off -> {ok, [], {keep_alive, false}}; _ -> @@ -208,7 +208,7 @@ load("MaxKeepAliveRequests " ++ MaxRequests, []) -> {ok, Integer} -> {ok, [], {max_keep_alive_request, Integer}}; {error, _} -> - {error, ?NICE(clean(MaxRequests) ++ + {error, ?NICE(string:strip(MaxRequests) ++ " is an invalid MaxKeepAliveRequests")} end; @@ -218,7 +218,7 @@ load("MaxKeepAliveRequest " ++ MaxRequests, []) -> {ok, Integer} -> {ok, [], {max_keep_alive_request, Integer}}; {error, _} -> - {error, ?NICE(clean(MaxRequests) ++ + {error, ?NICE(string:strip(MaxRequests) ++ " is an invalid MaxKeepAliveRequest")} end; @@ -227,7 +227,7 @@ load("KeepAliveTimeout " ++ Timeout, []) -> {ok, Integer} -> {ok, [], {keep_alive_timeout, Integer}}; {error, _} -> - {error, ?NICE(clean(Timeout)++" is an invalid KeepAliveTimeout")} + {error, ?NICE(string:strip(Timeout)++" is an invalid KeepAliveTimeout")} end; load("Modules " ++ Modules, []) -> @@ -235,18 +235,18 @@ load("Modules " ++ Modules, []) -> {ok, [], {modules,[list_to_atom(X) || X <- ModuleList]}}; load("ServerAdmin " ++ ServerAdmin, []) -> - {ok, [], {server_admin,clean(ServerAdmin)}}; + {ok, [], {server_admin,string:strip(ServerAdmin)}}; load("ServerRoot " ++ ServerRoot, []) -> - case is_directory(clean(ServerRoot)) of + case is_directory(string:strip(ServerRoot)) of {ok, Directory} -> {ok, [], [{server_root,string:strip(Directory,right,$/)}]}; {error, _} -> - {error, ?NICE(clean(ServerRoot)++" is an invalid ServerRoot")} + {error, ?NICE(string:strip(ServerRoot)++" is an invalid ServerRoot")} end; load("MimeTypes " ++ MimeTypes, []) -> - case load_mime_types(clean(MimeTypes)) of + case load_mime_types(white_space_clean(MimeTypes)) of {ok, MimeTypesList} -> {ok, [], [{mime_types, MimeTypesList}]}; {error, Reason} -> @@ -258,24 +258,24 @@ load("MaxClients " ++ MaxClients, []) -> {ok, Integer} -> {ok, [], {max_clients,Integer}}; {error, _} -> - {error, ?NICE(clean(MaxClients) ++ + {error, ?NICE(string:strip(MaxClients) ++ " is an invalid number of MaxClients")} end; load("DocumentRoot " ++ DocumentRoot,[]) -> - case is_directory(clean(DocumentRoot)) of + case is_directory(string:strip(DocumentRoot)) of {ok, Directory} -> {ok, [], {document_root,string:strip(Directory,right,$/)}}; {error, _} -> - {error, ?NICE(clean(DocumentRoot)++" is an invalid DocumentRoot")} + {error, ?NICE(string:strip(DocumentRoot)++" is an invalid DocumentRoot")} end; load("DefaultType " ++ DefaultType, []) -> - {ok, [], {default_type,clean(DefaultType)}}; + {ok, [], {default_type,string:strip(DefaultType)}}; load("SSLCertificateFile " ++ SSLCertificateFile, []) -> - case is_file(clean(SSLCertificateFile)) of + case is_file(string:strip(SSLCertificateFile)) of {ok, File} -> {ok, [], {ssl_certificate_file,File}}; {error, _} -> - {error, ?NICE(clean(SSLCertificateFile)++ + {error, ?NICE(string:strip(SSLCertificateFile)++ " is an invalid SSLCertificateFile")} end; load("SSLLogLevel " ++ SSLLogAlert, []) -> @@ -286,69 +286,69 @@ load("SSLLogLevel " ++ SSLLogAlert, []) -> {ok, [], {ssl_log_alert, true}} end; load("SSLCertificateKeyFile " ++ SSLCertificateKeyFile, []) -> - case is_file(clean(SSLCertificateKeyFile)) of + case is_file(string:strip(SSLCertificateKeyFile)) of {ok, File} -> {ok, [], {ssl_certificate_key_file,File}}; {error, _} -> - {error, ?NICE(clean(SSLCertificateKeyFile)++ + {error, ?NICE(string:strip(SSLCertificateKeyFile)++ " is an invalid SSLCertificateKeyFile")} end; load("SSLVerifyClient " ++ SSLVerifyClient, []) -> - case make_integer(clean(SSLVerifyClient)) of + case make_integer(string:strip(SSLVerifyClient)) of {ok, Integer} when (Integer >=0) andalso (Integer =< 2) -> {ok, [], {ssl_verify_client,Integer}}; {ok, _Integer} -> - {error,?NICE(clean(SSLVerifyClient) ++ + {error,?NICE(string:strip(SSLVerifyClient) ++ " is an invalid SSLVerifyClient")}; {error, nomatch} -> - {error,?NICE(clean(SSLVerifyClient) ++ + {error,?NICE(string:strip(SSLVerifyClient) ++ " is an invalid SSLVerifyClient")} end; load("SSLVerifyDepth " ++ SSLVerifyDepth, []) -> - case make_integer(clean(SSLVerifyDepth)) of + case make_integer(string:strip(SSLVerifyDepth)) of {ok, Integer} when Integer > 0 -> {ok, [], {ssl_verify_client_depth,Integer}}; {ok, _Integer} -> - {error,?NICE(clean(SSLVerifyDepth) ++ + {error,?NICE(string:strip(SSLVerifyDepth) ++ " is an invalid SSLVerifyDepth")}; {error, nomatch} -> - {error,?NICE(clean(SSLVerifyDepth) ++ + {error,?NICE(string:strip(SSLVerifyDepth) ++ " is an invalid SSLVerifyDepth")} end; load("SSLCiphers " ++ SSLCiphers, []) -> - {ok, [], {ssl_ciphers, clean(SSLCiphers)}}; + {ok, [], {ssl_ciphers, string:strip(SSLCiphers)}}; load("SSLCACertificateFile " ++ SSLCACertificateFile, []) -> - case is_file(clean(SSLCACertificateFile)) of + case is_file(string:strip(SSLCACertificateFile)) of {ok, File} -> {ok, [], {ssl_ca_certificate_file,File}}; {error, _} -> - {error, ?NICE(clean(SSLCACertificateFile)++ + {error, ?NICE(string:strip(SSLCACertificateFile)++ " is an invalid SSLCACertificateFile")} end; load("SSLPasswordCallbackModule " ++ SSLPasswordCallbackModule, []) -> {ok, [], {ssl_password_callback_module, - list_to_atom(clean(SSLPasswordCallbackModule))}}; + list_to_atom(string:strip(SSLPasswordCallbackModule))}}; load("SSLPasswordCallbackFunction " ++ SSLPasswordCallbackFunction, []) -> {ok, [], {ssl_password_callback_function, - list_to_atom(clean(SSLPasswordCallbackFunction))}}; + list_to_atom(string:strip(SSLPasswordCallbackFunction))}}; load("SSLPasswordCallbackArguments " ++ SSLPasswordCallbackArguments, []) -> {ok, [], {ssl_password_callback_arguments, SSLPasswordCallbackArguments}}; load("DisableChunkedTransferEncodingSend " ++ TrueOrFalse, []) -> - case list_to_atom(clean(TrueOrFalse)) of + case list_to_atom(string:strip(TrueOrFalse)) of true -> {ok, [], {disable_chunked_transfer_encoding_send, true}}; _ -> {ok, [], {disable_chunked_transfer_encoding_send, false}} end; load("LogFormat " ++ LogFormat, []) -> - {ok,[],{log_format, list_to_atom(httpd_conf:clean(LogFormat))}}; + {ok,[],{log_format, list_to_atom(string:strip(LogFormat))}}; load("ErrorLogFormat " ++ LogFormat, []) -> - {ok,[],{error_log_format, list_to_atom(httpd_conf:clean(LogFormat))}}. + {ok,[],{error_log_format, list_to_atom(string:strip(LogFormat))}}. clean_address(Addr) -> - string:strip(string:strip(clean(Addr), left, $[), right, $]). + string:strip(string:strip(string:strip(Addr), left, $[), right, $]). make_ipfamily(IpFamilyStr) -> @@ -974,7 +974,7 @@ verify_modules([]) -> verify_modules([Mod|Rest]) -> case code:which(Mod) of non_existing -> - {error, ?NICE(atom_to_list(Mod)++" does not exist")}; + {error, ?NICE(string:strip(atom_to_list(Mod), right, $\n) ++" does not exist")}; _Path -> verify_modules(Rest) end. @@ -1016,7 +1016,7 @@ parse_mime_types(Stream,MimeTypesList) -> eof -> eof; String -> - clean(String) + white_space_clean(String) end, parse_mime_types(Stream, MimeTypesList, Line). parse_mime_types(Stream, MimeTypesList, eof) -> @@ -1202,6 +1202,10 @@ plain_server_tokens() -> error_report(Where,M,F,Error) -> error_logger:error_report([{?MODULE, Where}, {apply, {M, F, []}}, Error]). +white_space_clean(String) -> + {ok,CleanedString,_} = + inets_regexp:gsub(String, "^[ \t\n\r\f]*|[ \t\n\r\f]*\$",""), + CleanedString. %%%========================================================================= diff --git a/lib/inets/src/http_server/mod_actions.erl b/lib/inets/src/http_server/mod_actions.erl index c3946ff9b4..e493ddbf93 100644 --- a/lib/inets/src/http_server/mod_actions.erl +++ b/lib/inets/src/http_server/mod_actions.erl @@ -84,14 +84,14 @@ load("Action "++ Action, []) -> {ok,[MimeType, CGIScript]} -> {ok,[],{action, {MimeType, CGIScript}}}; {ok,_} -> - {error,?NICE(httpd_conf:clean(Action)++" is an invalid Action")} + {error,?NICE(string:strip(Action)++" is an invalid Action")} end; load("Script " ++ Script,[]) -> case inets_regexp:split(Script, " ") of {ok,[Method, CGIScript]} -> {ok,[],{script, {Method, CGIScript}}}; {ok,_} -> - {error,?NICE(httpd_conf:clean(Script)++" is an invalid Script")} + {error,?NICE(string:strip(Script)++" is an invalid Script")} end. store({action, {MimeType, CGIScript}} = Conf, _) when is_list(MimeType), diff --git a/lib/inets/src/http_server/mod_alias.erl b/lib/inets/src/http_server/mod_alias.erl index 5039cd56b5..e0d34288cd 100644 --- a/lib/inets/src/http_server/mod_alias.erl +++ b/lib/inets/src/http_server/mod_alias.erl @@ -212,7 +212,7 @@ load("Alias " ++ Alias, []) -> {ok, [FakeName, RealName]} -> {ok,[],{alias,{FakeName,RealName}}}; {ok, _} -> - {error,?NICE(httpd_conf:clean(Alias)++" is an invalid Alias")} + {error,?NICE(string:strip(Alias)++" is an invalid Alias")} end; load("ReWrite " ++ Rule, Acc) -> load_re_write(Rule, Acc, "ReWrite", re_write); @@ -223,7 +223,7 @@ load("ScriptAlias " ++ ScriptAlias, []) -> RealName1 = filename:join(filename:split(RealName)), {ok, [], {script_alias, {FakeName, RealName1++"/"}}}; {ok, _} -> - {error, ?NICE(httpd_conf:clean(ScriptAlias)++ + {error, ?NICE(string:strip(ScriptAlias)++ " is an invalid ScriptAlias")} end; load("ScriptReWrite " ++ Rule, Acc) -> @@ -234,7 +234,7 @@ load_re_write(Rule0, Acc, Type, Tag) -> fun ($\s) -> true; ($\t) -> true; (_) -> false end, Rule0) of "" -> - {error, ?NICE(httpd_conf:clean(Rule0)++" is an invalid "++Type)}; + {error, ?NICE(string:strip(Rule0)++" is an invalid "++Type)}; Rule -> case string:chr(Rule, $\s) of 0 -> diff --git a/lib/inets/src/http_server/mod_auth.erl b/lib/inets/src/http_server/mod_auth.erl index 1f4470622d..ae716a6cff 100644 --- a/lib/inets/src/http_server/mod_auth.erl +++ b/lib/inets/src/http_server/mod_auth.erl @@ -127,35 +127,35 @@ do(Info) -> %% state it was previously. load("<Directory " ++ Directory,[]) -> - Dir = httpd_conf:custom_clean(Directory,"",">"), + Dir = string:strip(string:strip(Directory),right, $>), {ok,[{directory, {Dir, [{path, Dir}]}}]}; load(eof,[{directory, {Directory, _DirData}}|_]) -> {error, ?NICE("Premature end-of-file in "++ Directory)}; load("AuthName " ++ AuthName, [{directory, {Directory, DirData}}|Rest]) -> {ok, [{directory, {Directory, - [{auth_name, httpd_conf:clean(AuthName)} | DirData]}} + [{auth_name, string:strip(AuthName)} | DirData]}} | Rest ]}; load("AuthUserFile " ++ AuthUserFile0, [{directory, {Directory, DirData}}|Rest]) -> - AuthUserFile = httpd_conf:clean(AuthUserFile0), + AuthUserFile = string:strip(AuthUserFile0), {ok, [{directory, {Directory, [{auth_user_file, AuthUserFile}|DirData]}} | Rest ]}; load("AuthGroupFile " ++ AuthGroupFile0, [{directory, {Directory, DirData}}|Rest]) -> - AuthGroupFile = httpd_conf:clean(AuthGroupFile0), + AuthGroupFile = string:strip(AuthGroupFile0), {ok,[{directory, {Directory, [{auth_group_file, AuthGroupFile}|DirData]}} | Rest]}; load("AuthAccessPassword " ++ AuthAccessPassword0, [{directory, {Directory, DirData}}|Rest]) -> - AuthAccessPassword = httpd_conf:clean(AuthAccessPassword0), + AuthAccessPassword = string:strip(AuthAccessPassword0), {ok,[{directory, {Directory, [{auth_access_password, AuthAccessPassword}|DirData]}} | Rest]}; load("AuthDBType " ++ Type, [{directory, {Dir, DirData}}|Rest]) -> - case httpd_conf:clean(Type) of + case string:strip(Type) of "plain" -> {ok, [{directory, {Dir, [{auth_type, plain}|DirData]}} | Rest ]}; "mnesia" -> @@ -163,7 +163,7 @@ load("AuthDBType " ++ Type, "dets" -> {ok, [{directory, {Dir, [{auth_type, dets}|DirData]}} | Rest ]}; _ -> - {error, ?NICE(httpd_conf:clean(Type)++" is an invalid AuthDBType")} + {error, ?NICE(string:strip(Type)++" is an invalid AuthDBType")} end; load("require " ++ Require,[{directory, {Directory, DirData}}|Rest]) -> @@ -175,7 +175,7 @@ load("require " ++ Require,[{directory, {Directory, DirData}}|Rest]) -> {ok,[{directory, {Directory, [{require_group,Groups}|DirData]}} | Rest]}; {ok,_} -> - {error,?NICE(httpd_conf:clean(Require) ++" is an invalid require")} + {error,?NICE(string:strip(Require) ++" is an invalid require")} end; load("allow " ++ Allow,[{directory, {Directory, DirData}}|Rest]) -> @@ -187,7 +187,7 @@ load("allow " ++ Allow,[{directory, {Directory, DirData}}|Rest]) -> {ok,[{directory, {Directory, [{allow_from,Hosts}|DirData]}} | Rest]}; {ok,_} -> - {error,?NICE(httpd_conf:clean(Allow) ++" is an invalid allow")} + {error,?NICE(string:strip(Allow) ++" is an invalid allow")} end; load("deny " ++ Deny,[{directory, {Directory, DirData}}|Rest]) -> @@ -199,7 +199,7 @@ load("deny " ++ Deny,[{directory, {Directory, DirData}}|Rest]) -> {ok,[{{directory, Directory, [{deny_from, Hosts}|DirData]}} | Rest]}; {ok, _} -> - {error,?NICE(httpd_conf:clean(Deny) ++" is an invalid deny")} + {error,?NICE(string:strip(Deny) ++" is an invalid deny")} end; load("</Directory>",[{directory, {Directory, DirData}}|Rest]) -> @@ -207,14 +207,14 @@ load("</Directory>",[{directory, {Directory, DirData}}|Rest]) -> load("AuthMnesiaDB " ++ AuthMnesiaDB, [{directory, {Dir, DirData}}|Rest]) -> - case httpd_conf:clean(AuthMnesiaDB) of + case string:strip(AuthMnesiaDB) of "On" -> {ok,[{directory, {Dir,[{auth_type,mnesia}|DirData]}}|Rest]}; "Off" -> {ok,[{directory, {Dir,[{auth_type,plain}|DirData]}}|Rest]}; _ -> - {error, ?NICE(httpd_conf:clean(AuthMnesiaDB) ++ - " is an invalid AuthMnesiaDB")} + {error, ?NICE(string:strip(AuthMnesiaDB) ++ + " is an invalid AuthMnesiaDB")} end. store({directory, {Directory, DirData}}, ConfigList) diff --git a/lib/inets/src/http_server/mod_auth_plain.erl b/lib/inets/src/http_server/mod_auth_plain.erl index 7bb86fc812..b411202efc 100644 --- a/lib/inets/src/http_server/mod_auth_plain.erl +++ b/lib/inets/src/http_server/mod_auth_plain.erl @@ -231,7 +231,7 @@ parse_group(Stream, GroupList) -> eof -> eof; String -> - httpd_conf:clean(String) + httpd_conf:white_space_clean(String) end, parse_group(Stream, GroupList, Line). @@ -265,7 +265,7 @@ parse_passwd(Stream, PasswdList) -> eof -> eof; String -> - httpd_conf:clean(String) + httpd_conf:white_space_clean(String) end, parse_passwd(Stream, PasswdList, Line). diff --git a/lib/inets/src/http_server/mod_cgi.erl b/lib/inets/src/http_server/mod_cgi.erl index d933b0a4ba..fbcfa78e5f 100644 --- a/lib/inets/src/http_server/mod_cgi.erl +++ b/lib/inets/src/http_server/mod_cgi.erl @@ -95,24 +95,24 @@ do(ModData) -> %% or cache %% load("ScriptNoCache " ++ CacheArg, [])-> - case catch list_to_atom(httpd_conf:clean(CacheArg)) of + case catch list_to_atom(string:strip(CacheArg)) of true -> {ok, [], {script_nocache, true}}; false -> {ok, [], {script_nocache, false}}; _ -> - {error, ?NICE(httpd_conf:clean(CacheArg)++ + {error, ?NICE(string:strip(CacheArg)++ " is an invalid ScriptNoCache directive")} end; %% ScriptTimeout Seconds, The number of seconds that the server %% maximum will wait for the script to %% generate a part of the document load("ScriptTimeout " ++ Timeout, [])-> - case catch list_to_integer(httpd_conf:clean(Timeout)) of + case catch list_to_integer(string:strip(Timeout)) of TimeoutSec when is_integer(TimeoutSec) -> {ok, [], {script_timeout,TimeoutSec*1000}}; _ -> - {error, ?NICE(httpd_conf:clean(Timeout)++ + {error, ?NICE(string:strip(Timeout)++ " is an invalid ScriptTimeout")} end. diff --git a/lib/inets/src/http_server/mod_disk_log.erl b/lib/inets/src/http_server/mod_disk_log.erl index 3f446843b2..89a3193aa3 100644 --- a/lib/inets/src/http_server/mod_disk_log.erl +++ b/lib/inets/src/http_server/mod_disk_log.erl @@ -147,16 +147,16 @@ load("TransferDiskLogSize " ++ TransferDiskLogSize, []) -> {MaxBytesInteger,MaxFilesInteger}}}; {error,_} -> {error, - ?NICE(httpd_conf:clean(TransferDiskLogSize)++ + ?NICE(string:strip(TransferDiskLogSize)++ " is an invalid TransferDiskLogSize")} end; {error,_} -> - {error,?NICE(httpd_conf:clean(TransferDiskLogSize)++ + {error,?NICE(string:strip(TransferDiskLogSize)++ " is an invalid TransferDiskLogSize")} end end; load("TransferDiskLog " ++ TransferDiskLog,[]) -> - {ok,[],{transfer_disk_log,httpd_conf:clean(TransferDiskLog)}}; + {ok,[],{transfer_disk_log,string:strip(TransferDiskLog)}}; load("ErrorDiskLogSize " ++ ErrorDiskLogSize, []) -> case inets_regexp:split(ErrorDiskLogSize," ") of @@ -168,16 +168,16 @@ load("ErrorDiskLogSize " ++ ErrorDiskLogSize, []) -> {ok,[],{error_disk_log_size, {MaxBytesInteger,MaxFilesInteger}}}; {error,_} -> - {error,?NICE(httpd_conf:clean(ErrorDiskLogSize)++ + {error,?NICE(string:strip(ErrorDiskLogSize)++ " is an invalid ErrorDiskLogSize")} end; {error,_} -> - {error,?NICE(httpd_conf:clean(ErrorDiskLogSize)++ + {error,?NICE(string:strip(ErrorDiskLogSize)++ " is an invalid ErrorDiskLogSize")} end end; load("ErrorDiskLog " ++ ErrorDiskLog, []) -> - {ok, [], {error_disk_log, httpd_conf:clean(ErrorDiskLog)}}; + {ok, [], {error_disk_log, string:strip(ErrorDiskLog)}}; load("SecurityDiskLogSize " ++ SecurityDiskLogSize, []) -> case inets_regexp:split(SecurityDiskLogSize, " ") of @@ -190,19 +190,19 @@ load("SecurityDiskLogSize " ++ SecurityDiskLogSize, []) -> {MaxBytesInteger, MaxFilesInteger}}}; {error,_} -> {error, - ?NICE(httpd_conf:clean(SecurityDiskLogSize) ++ + ?NICE(string:strip(SecurityDiskLogSize) ++ " is an invalid SecurityDiskLogSize")} end; {error, _} -> - {error, ?NICE(httpd_conf:clean(SecurityDiskLogSize) ++ + {error, ?NICE(string:strip(SecurityDiskLogSize) ++ " is an invalid SecurityDiskLogSize")} end end; load("SecurityDiskLog " ++ SecurityDiskLog, []) -> - {ok, [], {security_disk_log, httpd_conf:clean(SecurityDiskLog)}}; + {ok, [], {security_disk_log, string:strip(SecurityDiskLog)}}; load("DiskLogFormat " ++ Format, []) -> - case httpd_conf:clean(Format) of + case string:strip(Format) of "internal" -> {ok, [], {disk_log_format,internal}}; "external" -> @@ -314,7 +314,7 @@ log_size(ConfigList, Tag) -> proplists:get_value(Tag, ConfigList, {500*1024,8}). create_disk_log(LogFile, SizeTag, ConfigList) -> - Filename = httpd_conf:clean(LogFile), + Filename = string:strip(LogFile), {MaxBytes, MaxFiles} = log_size(ConfigList, SizeTag), case filename:pathtype(Filename) of absolute -> diff --git a/lib/inets/src/http_server/mod_esi.erl b/lib/inets/src/http_server/mod_esi.erl index b11df34f9e..d385afbd70 100644 --- a/lib/inets/src/http_server/mod_esi.erl +++ b/lib/inets/src/http_server/mod_esi.erl @@ -98,40 +98,40 @@ load("ErlScriptAlias " ++ ErlScriptAlias, []) -> case inets_regexp:split(ErlScriptAlias," ") of {ok, [ErlName | StrModules]} -> Modules = lists:map(fun(Str) -> - list_to_atom(httpd_conf:clean(Str)) + list_to_atom(string:strip(Str)) end, StrModules), {ok, [], {erl_script_alias, {ErlName, Modules}}}; {ok, _} -> - {error, ?NICE(httpd_conf:clean(ErlScriptAlias) ++ + {error, ?NICE(string:strip(ErlScriptAlias) ++ " is an invalid ErlScriptAlias")} end; load("EvalScriptAlias " ++ EvalScriptAlias, []) -> case inets_regexp:split(EvalScriptAlias, " ") of {ok, [EvalName | StrModules]} -> Modules = lists:map(fun(Str) -> - list_to_atom(httpd_conf:clean(Str)) + list_to_atom(string:strip(Str)) end, StrModules), {ok, [], {eval_script_alias, {EvalName, Modules}}}; {ok, _} -> - {error, ?NICE(httpd_conf:clean(EvalScriptAlias) ++ + {error, ?NICE(string:strip(EvalScriptAlias) ++ " is an invalid EvalScriptAlias")} end; load("ErlScriptTimeout " ++ Timeout, [])-> - case catch list_to_integer(httpd_conf:clean(Timeout)) of + case catch list_to_integer(string:strip(Timeout)) of TimeoutSec when is_integer(TimeoutSec) -> {ok, [], {erl_script_timeout, TimeoutSec * 1000}}; _ -> - {error, ?NICE(httpd_conf:clean(Timeout) ++ + {error, ?NICE(string:strip(Timeout) ++ " is an invalid ErlScriptTimeout")} end; load("ErlScriptNoCache " ++ CacheArg, [])-> - case catch list_to_atom(httpd_conf:clean(CacheArg)) of + case catch list_to_atom(string:strip(CacheArg)) of true -> {ok, [], {erl_script_nocache, true}}; false -> {ok, [], {erl_script_nocache, false}}; _ -> - {error, ?NICE(httpd_conf:clean(CacheArg)++ + {error, ?NICE(string:strip(CacheArg)++ " is an invalid ErlScriptNoCache directive")} end. diff --git a/lib/inets/src/http_server/mod_htaccess.erl b/lib/inets/src/http_server/mod_htaccess.erl index e1f66d01c8..d526fbe156 100644 --- a/lib/inets/src/http_server/mod_htaccess.erl +++ b/lib/inets/src/http_server/mod_htaccess.erl @@ -34,7 +34,7 @@ % Names on accessfiles %---------------------------------------------------------------------- load("AccessFileName" ++ FileNames, _Context)-> - CleanFileNames=httpd_conf:clean(FileNames), + CleanFileNames=string:strip(FileNames), {ok,[],{access_files,string:tokens(CleanFileNames," ")}}. store({access_files, Files} = Conf, _) when is_list(Files)-> diff --git a/lib/inets/src/http_server/mod_log.erl b/lib/inets/src/http_server/mod_log.erl index a912f5616c..2367d9cfeb 100644 --- a/lib/inets/src/http_server/mod_log.erl +++ b/lib/inets/src/http_server/mod_log.erl @@ -127,11 +127,11 @@ do(Info) -> %% Description: See httpd(3) ESWAPI CALLBACK FUNCTIONS %%------------------------------------------------------------------------- load("TransferLog " ++ TransferLog, []) -> - {ok,[],{transfer_log,httpd_conf:clean(TransferLog)}}; + {ok,[],{transfer_log,string:strip(TransferLog)}}; load("ErrorLog " ++ ErrorLog, []) -> - {ok,[],{error_log,httpd_conf:clean(ErrorLog)}}; + {ok,[],{error_log,string:strip(ErrorLog)}}; load("SecurityLog " ++ SecurityLog, []) -> - {ok, [], {security_log, httpd_conf:clean(SecurityLog)}}. + {ok, [], {security_log, string:strip(SecurityLog)}}. %%-------------------------------------------------------------------------- %% store(Directive, DirectiveList) -> {ok, NewDirective} | @@ -200,7 +200,7 @@ transfer_log(Info,RFC931,AuthUser,Date,StatusCode,Bytes) -> end. create_log(LogFile, ConfigList) -> - Filename = httpd_conf:clean(LogFile), + Filename = string:strip(LogFile), case filename:pathtype(Filename) of absolute -> case file:open(Filename, [read, write]) of diff --git a/lib/inets/src/http_server/mod_security.erl b/lib/inets/src/http_server/mod_security.erl index a85383a921..b09bd5e008 100644 --- a/lib/inets/src/http_server/mod_security.erl +++ b/lib/inets/src/http_server/mod_security.erl @@ -101,38 +101,38 @@ do(Info) -> end. load("<Directory " ++ Directory, []) -> - Dir = httpd_conf:custom_clean(Directory,"",">"), + Dir = string:strip(string:strip(Directory),right, $>), {ok, [{security_directory, {Dir, [{path, Dir}]}}]}; load(eof,[{security_directory, {Directory, _DirData}}|_]) -> {error, ?NICE("Premature end-of-file in "++Directory)}; load("SecurityDataFile " ++ FileName, [{security_directory, {Dir, DirData}}]) -> - File = httpd_conf:clean(FileName), + File = string:strip(FileName), {ok, [{security_directory, {Dir, [{data_file, File}|DirData]}}]}; load("SecurityCallbackModule " ++ ModuleName, [{security_directory, {Dir, DirData}}]) -> - Mod = list_to_atom(httpd_conf:clean(ModuleName)), + Mod = list_to_atom(string:strip(ModuleName)), {ok, [{security_directory, {Dir, [{callback_module, Mod}|DirData]}}]}; load("SecurityMaxRetries " ++ Retries, [{security_directory, {Dir, DirData}}]) -> load_return_int_tag("SecurityMaxRetries", max_retries, - httpd_conf:clean(Retries), Dir, DirData); + string:strip(Retries), Dir, DirData); load("SecurityBlockTime " ++ Time, [{security_directory, {Dir, DirData}}]) -> load_return_int_tag("SecurityBlockTime", block_time, - httpd_conf:clean(Time), Dir, DirData); + string:strip(Time), Dir, DirData); load("SecurityFailExpireTime " ++ Time, [{security_directory, {Dir, DirData}}]) -> load_return_int_tag("SecurityFailExpireTime", fail_expire_time, - httpd_conf:clean(Time), Dir, DirData); + string:strip(Time), Dir, DirData); load("SecurityAuthTimeout " ++ Time0, [{security_directory, {Dir, DirData}}]) -> - Time = httpd_conf:clean(Time0), + Time = string:strip(Time0), load_return_int_tag("SecurityAuthTimeout", auth_timeout, - httpd_conf:clean(Time), Dir, DirData); + string:strip(Time), Dir, DirData); load("AuthName " ++ Name0, [{security_directory, {Dir, DirData}}]) -> - Name = httpd_conf:clean(Name0), + Name = string:strip(Name0), {ok, [{security_directory, {Dir, [{auth_name, Name}|DirData]}}]}; load("</Directory>",[{security_directory, {Dir, DirData}}]) -> {ok, [], {security_directory, {Dir, DirData}}}. |