Commit 9211529b authored by Josh Kunz's avatar Josh Kunz

Adds listing of HTTP status codes.

parent 397bbeb1
......@@ -125,7 +125,8 @@ module Response : sig
headers: headers;
body: string};;
include HTTP_COMMON with type t := t
val make : int -> string -> string -> t
val make : int -> string -> t
val reason_for_code : int -> string
end = struct
type t = { version: string;
code: int;
......@@ -133,8 +134,51 @@ end = struct
headers: headers;
body: string};;
let make code reason body =
{ code = code; reason = reason; version = http_1_1;
let codes = [
(101, "Switching Protocols")
; (200, "OK")
; (201, "Created")
; (202, "Accepted")
; (203, "Non-Authoritative Information")
; (204, "No Content")
; (205, "Reset Content")
; (206, "Partial Content")
; (300, "Multiple Choices")
; (301, "Moved Permanently")
; (302, "Found")
; (303, "See Other")
; (304, "Not Modified")
; (305, "Use Proxy")
; (307, "Temporary Redirect")
; (400, "Bad Request")
; (401, "Unauthorized")
; (402, "Payment Required")
; (403, "Forbidden")
; (404, "Not Found")
; (405, "Method Not Allowed")
; (406, "Not Acceptable")
; (407, "Proxy Authentication Required")
; (408, "Request Timeout")
; (409, "Conflict")
; (410, "Gone")
; (411, "Length Required")
; (412, "Precondition Failed")
; (413, "Request Entity Too Large")
; (414, "Request-URI Too Long")
; (415, "Unsupported Media Type")
; (416, "Requested Range Not Satisfiable")
; (417, "Expectation Failed")
; (500, "Internal Server Error")
; (501, "Not Implemented")
; (502, "Bad Gateway")
; (503, "Service Unavailable")
; (504, "Gateway Timeout")
; (505, "HTTP Version Not Supported") ];;
let reason_for_code c = List.assoc c codes;;
let make code body =
{ code = code; reason = reason_for_code code; version = http_1_1;
headers = []; body = body };;
let sheaders r h =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment