----------------------------------------------------------------------------- -- -- libwww-ada95 : A World Wide Web client library for Ada95 -- -- W W W . S T A T U S _ C O D E S -- -- B o d y -- -- Copyright (C) 1997-1998 Regents of the University of California -- -- libwww-ada95 is free software; you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published by the Free -- Software Foundation, with or without the single exception listed below; -- either version 2, or (at your option) any later version. libwww-ada95 is -- distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; -- without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -- PARTICULAR PURPOSE. See the GNU General Public License for more details. -- You should have received a copy of the GNU General Public License -- distributed with libwww-ada95; see the file COPYING. If not, write to the -- Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA -- 02111-1307, USA. -- -- As a special exception, if other files instantiate generics from this -- library, or you link this library with other files to produce an -- executable, this library does not by itself cause the resulting -- executable to be covered by the GNU General Public License. This -- exception does not however invalidate any other reasons why the -- executable file might be covered by the GNU General Public License. -- -- Created in 1997 by Kari Nies ----------------------------------------------------------------------------- package body WWW.Status_Codes is type Reason_Phrase_Array is array (Known_Status_Code_Range) of UB_String; Reason_Phrases : Reason_Phrase_Array; -- required by style-checker procedure Set_Reason (Status : Status_Code; Reason_Phrase : STRING); use UB_Strings; function Get_Reason_Phrase (Status : Status_Code) return UB_String is Reason_Phrase : UB_String; begin if Status not in Known_Status_Code_Range then raise Unknown_Status_Code; end if; Reason_Phrase := Reason_Phrases (Status); if Reason_Phrase = UB_Strings.Null_Unbounded_String then raise Unknown_Status_Code; end if; return Reason_Phrase; end Get_Reason_Phrase; procedure Set_Reason (Status : Status_Code; Reason_Phrase : STRING) is begin Reason_Phrases (Status) := UB_Strings.To_Unbounded_String (Reason_Phrase); end Set_Reason; begin Set_Reason (100, "Continue"); Set_Reason (101, "Switching Protocols"); Set_Reason (200, "OK"); Set_Reason (201, "Created"); Set_Reason (202, "Accepted"); Set_Reason (203, "Non-Authorative Information"); Set_Reason (204, "No Content"); Set_Reason (205, "Reset Content"); Set_Reason (206, "Partial Content"); Set_Reason (300, "Multiple Choice"); Set_Reason (301, "Moved Permanently"); Set_Reason (302, "Moved Temporarily"); Set_Reason (303, "See Other"); Set_Reason (304, "Not Modified"); Set_Reason (305, "Use Proxy"); Set_Reason (400, "Bad Request"); Set_Reason (401, "Unauthorized"); Set_Reason (402, "Payment Required"); Set_Reason (403, "Forbidden"); Set_Reason (404, "Not Found"); Set_Reason (405, "Method Not Allowed"); Set_Reason (406, "Not Acceptable"); Set_Reason (407, "Proxy Authentication Required"); Set_Reason (408, "Request Time-out"); Set_Reason (409, "Conflict"); Set_Reason (410, "Gone"); Set_Reason (411, "Length Required"); Set_Reason (412, "Precondition Failed"); Set_Reason (413, "Request Entity Too Large"); Set_Reason (414, "Request-URI Too Large"); Set_Reason (415, "Unsupported Media Type"); Set_Reason (500, "Internal Server Error"); Set_Reason (501, "Not Implemented"); Set_Reason (502, "Bad Gateway"); Set_Reason (503, "Service Unavailable"); Set_Reason (504, "Gateway Time-out"); Set_Reason (505, "HTTP Version not supported"); end WWW.Status_Codes;