Permalink
Browse files

[doc] review: Review of stdlib.core.web.core

  • Loading branch information...
1 parent e1b0998 commit 6714f1aa18189726541f7907fb61a4152b1903b9 Guillem Rieu committed Jun 24, 2011
@@ -16,6 +16,10 @@
along with OPA. If not, see <http://www.gnu.org/licenses/>.
*/
+/**
+ * {1 Types defined in this module}
+ */
+
@abstract type user_id = string
/**
@@ -46,6 +50,9 @@ type simple_url_handler('result) = Parser.general_parser('result)
*/
type url_handler('result) = Parser.general_parser(HttpRequest.request -> 'result)
+/**
+ * {1 Functions exported to the global namespace}
+ */
user_id_of_string(s : string) : user_id = s
@@ -15,6 +15,7 @@
You should have received a copy of the GNU Affero General Public License
along with OPA. If not, see <http://www.gnu.org/licenses/>.
*/
+
/*
@author David Rajchenbach-Teller
**/
@@ -17,13 +17,6 @@
*/
/**
- * The type of an IP address or a Netmask.
- */
-@opacapi
-type ip = IPv4.ip
-
-type IPv4.ip = { a : int ; b : int ; c : int ; d : int }
-/**
*
* @author Hugo Venturini, Hugo Heuzard
* @creation 12/2010
@@ -38,6 +31,25 @@ type IPv4.ip = { a : int ; b : int ; c : int ; d : int }
*
* This module is an IPv4 tool-box.
*
+ * {1 Where should I start?}
+ *
+ * {1 What if I need more?}
+ */
+
+/**
+ * {1 Types defined in this module}
+ */
+
+/**
+ * The type of an IP address or a Netmask.
+ */
+@opacapi
+type ip = IPv4.ip
+
+type IPv4.ip = { a : int ; b : int ; c : int ; d : int }
+
+/**
+ * {1 Interface}
*/
IPv4 =
@@ -15,10 +15,19 @@
You should have received a copy of the GNU Affero General Public License
along with OPA. If not, see <http://www.gnu.org/licenses/>.
*/
+
import stdlib.core.{date}
/**
- * {1 Exporting stuff}
+ * {1 About this module}
+ *
+ * {1 Where should I start?}
+ *
+ * {1 What if I need more?}
+ */
+
+/**
+ * {1 Types defined in this module}
*/
/**
@@ -108,6 +117,10 @@ type web_cache_control = {volatile} /** The resource changes at each request
type web_server_status = external
+/**
+ * {1 Interface}
+ */
+
WebCoreExport =
{{
@@ -141,7 +154,7 @@ default_make_response(cache_control: web_cache_control, request: WebInfo.private
)
/**
- * {1 Manipulating status}
+ * {2 Manipulating status}
*/
web_err_num_of_web_response =
@@ -15,6 +15,7 @@
You should have received a copy of the GNU Affero General Public License
along with OPA. If not, see <http://www.gnu.org/licenses/>.
*/
+
/**
* @author Adam Koprowski, February 2010
* @author David Rajchenbach-Teller (packaging), December 2010
@@ -34,6 +35,8 @@ import stdlib.core.{parser}
*
* See type {!Uri.uri} for a datatype representing an URI. See module
* {!Uri} for some functions for manipulating URIs.
+ *
+ * {1 What if I need more?}
*/
/**
@@ -91,13 +94,18 @@ type Uri.mailto =
{ address : string
; query : list((string, string))
}
+
/**
* For most purposes we treat URLs as synonyms to URIs, so [Url.url] is a synonym of {!Uri.uri}.
*/
type Url.url = Uri.uri
/**
- * {1 A module with parsing rules for URIs}
+ * {1 Parsing rules for URIs}
+ */
+
+/**
+ * A module with parsing rules for URIs.
*/
UriParser =
{{
@@ -283,6 +291,7 @@ Uri =
default_absolute_domain(domain,path) =
{default_absolute
with ~domain ~path}
+
/**
* Convert a string into a URI.
*
@@ -292,7 +301,7 @@ Uri =
of_string = Parser.try_parse(uri_parser, _)
/**
- * Encode a string meant to be injected in a URI to ensore that it does not contain any reserved character
+ * Encode a string meant to be injected in a URI to ensure that it does not contain any reserved character
*/
encode_string: string -> string = %% BslString.encode_uri_component %%
@@ -15,15 +15,26 @@
You should have received a copy of the GNU Affero General Public License
along with OPA. If not, see <http://www.gnu.org/licenses/>.
*/
+
import stdlib.core.{parser}
/**
+ * {1 About this module}
+ *
* Type URL ; savagely extracted from css.opa
*/
// ***** TODO: this should be either merged or replaced by uri.opa *****
+/**
+ * {1 Types defined in this module}
+ */
+
@abstract type url = string
+/**
+ * {1 Interface}
+ */
+
Url = {{
/*
decode(url) =
@@ -16,6 +16,18 @@
along with OPA. If not, see <http://www.gnu.org/licenses/>.
*/
+/**
+ * {1 About this module}
+ *
+ * {1 Where should I start?}
+ *
+ * {1 What if I need more?}
+ */
+
+/**
+ * {1 Types defined in this module}
+ */
+
type HttpRequest.request =
{ request : WebInfo.private.native_request;
connexion : WebInfo.private.native_connection;
@@ -35,27 +47,30 @@ type web_info = {
@abstract type WebInfo.private.native_response = external
@abstract type WebInfo.private.native_ip = external
+/**
+ * {1 Interface}
+ */
WebInfo = {{
-
+
@private web_info_cont = %%BslNet.Http_server.web_info_cont%% : WebInfo.private.native -> (WebInfo.private.native_response -> void)
@private web_info_request = %% BslNet.Http_server.web_info_request %% : WebInfo.private.native -> WebInfo.private.native_request
@private web_info_conn = %% BslNet.Http_server.web_info_conn %% : WebInfo.private.native -> WebInfo.private.native_connection
@private web_info_ip = %%BslNet.Http_server.ip_of_web_info%%
-
+
of_native_web_info(winfo:WebInfo.private.native) =
- req : HttpRequest.request =
+ req : HttpRequest.request =
{ request = web_info_request(winfo);
connexion = web_info_conn(winfo);
}
{ cont = web_info_cont(winfo)
- http_request = req
+ http_request = req
} : web_info
-
+
to_native_web_info(winfo:web_info) =
reconstruct = %% BslNet.Http_server.web_info_reconstruct %%
reconstruct(winfo.cont, winfo.http_request.request, winfo.http_request.connexion)
-
+
get_conn_ip(conn) =
IPv4.ip_of_string(web_info_ip(conn))
}}
@@ -17,11 +17,25 @@
*/
/**
- * {1 Actual utilities}
+ * {1 About this module}
+ *
+ * Actual utilities
+ *
+ * {1 Where should I start?}
+ *
+ * {1 What if I need more?}
+ */
+
+/**
+ * {1 Types defined in this module}
*/
type web_side = {client} / {server}
+/**
+ * {1 Interface}
+ */
+
@both WebUtils = {{
/**
* Determine if the code is executed on the client or the server.

0 comments on commit 6714f1a

Please sign in to comment.