]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/DEVEL/ocaml-http/http_daemon.mli
bumped copyright years
[helm.git] / helm / DEVEL / ocaml-http / http_daemon.mli
index 784cc8eb982ad3a4d6db3915b8df535af4dd93c9..6d31097d5d0276606ccb11ec8b720ece14fc9921 100644 (file)
@@ -2,7 +2,7 @@
 (*
   OCaml HTTP - do it yourself (fully OCaml) HTTP daemon
 
-  Copyright (C) <2002> Stefano Zacchiroli <zack@cs.unibo.it>
+  Copyright (C) <2002-2004> Stefano Zacchiroli <zack@cs.unibo.it>
 
   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
@@ -32,14 +32,14 @@ val send_CRLF: out_channel -> unit
   either code or status must be given (not both, not none) which represent the
   HTTP response code, outchan is the output channel to which send status line *)
 val send_status_line:
-  ?version: Http_types.version -> ?code: int -> ?status: Http_types.status ->
+  ?version:Http_types.version -> code:Http_types.status_code ->
   out_channel ->
     unit
 
   (** like send_status_line but additionally will also send "Date" and "Server"
   standard headers *)
 val send_basic_headers:
-  ?version: Http_types.version -> ?code: int -> ?status: Http_types.status ->
+  ?version: Http_types.version -> code:Http_types.status_code ->
   out_channel ->
     unit
 
@@ -49,9 +49,13 @@ val send_header: header: string -> value: string -> out_channel -> unit
   (** as send_header, but for a list of pairs <header, value> *)
 val send_headers: headers:(string * string) list -> out_channel -> unit
 
+(*
   (** send a file through an out_channel, file can be passed as an in_channel
   (if 'file' is given) or as a file name (if 'name' is given) *)
 val send_file: ?name:string -> ?file:in_channel -> out_channel -> unit
+*)
+  (** send a file through an out_channel *)
+val send_file: src:Http_types.file_source -> out_channel -> unit
 
   (** high level response function, respond on outchan sending: basic headers
   (including Content-Length computed using 'body' argument), headers probided
@@ -59,7 +63,7 @@ val send_file: ?name:string -> ?file:in_channel -> out_channel -> unit
   status is 200, default response HTTP version is Http_common.http_version *)
 val respond:
   ?body:string -> ?headers:(string * string) list ->
-  ?version:Http_types.version -> ?code:int -> ?status:Http_types.status ->
+  ?version:Http_types.version -> ?code:Http_types.status_code ->
   out_channel ->
     unit
 
@@ -73,23 +77,26 @@ val respond_forbidden:
 
   (** send a "redirection" class response, optional body argument contains data
   that will be displayed in the body of the response, default response status is
-  302 (moved permanently), only redirection status are accepted by this
+  301 (moved permanently), only redirection status are accepted by this
   function, other values will raise Failure *)
 val respond_redirect:
   location:string -> ?body:string ->
-  ?version: Http_types.version ->
-  ?code: int -> ?status: Http_types.redirection_status ->
+  ?version: Http_types.version -> ?code:Http_types.status_code ->
   out_channel ->
     unit
 
+  (** respond with a 401 (Unauthorized) response asking for authentication
+  * against given realm (default is the server name) *)
+val respond_unauthorized:
+  ?version: Http_types.version -> ?realm:string -> out_channel -> unit
+
   (** send an "error" response (i.e. 400 <= status < 600), optional body
   argument as per send_redirect, default response status is 400 (bad request),
   only error status are accepted by this function, other values will
   raise Failure *)
 val respond_error:
   ?body:string ->
-  ?version: Http_types.version ->
-  ?code: int -> ?status: Http_types.error_status ->
+  ?version: Http_types.version -> ?code:Http_types.status_code ->
   out_channel ->
     unit