X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2FDEVEL%2Focaml-http%2Fhttp_types.ml;h=2175576b77c0507c05406621506c82080cd7a855;hb=0c6a5aadb1a7746681a8e26fc0b009f847c10557;hp=40015e6831cd2d4d650fcc856a16935d3f62eb46;hpb=af6c0cdc6313be8c1fbdebee9e61ce700951f101;p=helm.git diff --git a/helm/DEVEL/ocaml-http/http_types.ml b/helm/DEVEL/ocaml-http/http_types.ml index 40015e683..2175576b7 100644 --- a/helm/DEVEL/ocaml-http/http_types.ml +++ b/helm/DEVEL/ocaml-http/http_types.ml @@ -2,7 +2,7 @@ (* OCaml HTTP - do it yourself (fully OCaml) HTTP daemon - Copyright (C) <2002> Stefano Zacchiroli + Copyright (C) <2002-2004> Stefano Zacchiroli This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -54,6 +54,12 @@ type tcp_server = (in_channel -> out_channel -> unit) -> unit + (** authentication information *) +type auth_info = + [ `Basic of string * string (* username, password *) +(* | `Digest of ... (* TODO digest authentication *) *) + ] + (** informational HTTP status, see RFC2616 *) type informational_substatus = [ `Continue @@ -134,6 +140,8 @@ type status = | server_error_status ] +type status_code = [ `Code of int | `Status of status ] + (** File sources *) type file_source = | FileSrc of string (** filename *) @@ -175,6 +183,9 @@ exception Malformed_request_URI of string (** malformed request received *) exception Malformed_request of string + (** malformed response received, argument is response's first line *) +exception Malformed_response of string + (** a parameter you were looking for was not found *) exception Param_not_found of string @@ -184,10 +195,16 @@ exception Invalid_status_line of string (** an header you were looking for was not found *) exception Header_not_found of string - (** raisable by callback functions to make main daemon quit, this is the only + (** raisable by callbacks to make main daemon quit, this is the only 'clean' way to make start functions return *) exception Quit + (** raisable by callbacks to force a 401 (unauthorized) HTTP answer. + * This exception should be raised _before_ sending any data over given out + * channel. + * @param realm authentication realm (usually needed to prompt user) *) +exception Unauthorized of string + (** {2 OO representation of HTTP messages} *) (** HTTP generic messages. See {! Http_message.message} *) @@ -266,6 +283,9 @@ class type request = object (** @return the list of all parameter received via POST *) method params_POST: (string * string) list + (** @return authorization information, if given by the client *) + method authorization: auth_info option + end (** HTTP responses *)