X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2FDEVEL%2Focaml-http%2Fhttp_types.ml;h=34c8481a7df72109d811a14bc25fdd34232e25f3;hb=a4df9661e15509e5da6ed9c57e3ab6a27a440c3f;hp=276d2e3aa47048651660c5093546667a30bcddd2;hpb=ca9cd0aeee0ce78a891f7f6091ca8704231a446d;p=helm.git diff --git a/helm/DEVEL/ocaml-http/http_types.ml b/helm/DEVEL/ocaml-http/http_types.ml index 276d2e3aa..34c8481a7 100644 --- a/helm/DEVEL/ocaml-http/http_types.ml +++ b/helm/DEVEL/ocaml-http/http_types.ml @@ -19,16 +19,26 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *) + (** HTTP version, actually only 1.0 and 1.1 are supported. Note that + 'supported' here means only 'accepted inside a HTTP request line', no + different behaviours are actually implemented depending on HTTP version *) type version = [ `HTTP_1_0 | `HTTP_1_1 ] + (** HTTP method, actually only GET and POST methods are supported *) type meth = [ `GET | `POST ] + (** Daemon behaviour wrt request handling. `Single mode use a single process + to handle all requests, no request is served until a previous one has been + fully served. `Fork mode fork a new process for each request, the new process + will execute the callback function and then exit. `Thread mode create a new + thread for each request, the new thread will execute the callback function and + then exit, threads can communicate using standard OCaml Thread library. *) type daemon_mode = [ `Single | `Fork | `Thread ] type tcp_server = @@ -118,6 +128,7 @@ exception Invalid_HTTP_method of string exception Invalid_code of int exception Invalid_status of status +exception Malformed_URL of string exception Malformed_query of string exception Malformed_query_part of string * string exception Unsupported_method of string @@ -130,9 +141,13 @@ exception Param_not_found of string exception Invalid_status_line of string exception Header_not_found of string + (** raisable by callback functions to make main daemon quit, this is the only + 'clean' way to make start functions return *) +exception Quit + class type message = object - method version: version + method version: version option method setVersion: version -> unit method body: string @@ -142,6 +157,10 @@ class type message = object method addBody: string -> unit method addBodyBuf: Buffer.t -> unit + (** header name comparison are performed in a case-insensitive manner as + required by RFC2616, actually the implementation works converting all header + names in lowercase *) + method addHeader: name:string -> value:string -> unit method addHeaders: (string * string) list -> unit method replaceHeader: name:string -> value:string -> unit