anewt-developers team mailing list archive
-
anewt-developers team
-
Mailing list archive
-
Message #00253
[Branch ~uws/anewt/anewt.uws] Rev 1776: [core] Cleanup HTTP status constants
------------------------------------------------------------
revno: 1776
committer: Wouter Bolsterlee <uws@xxxxxxxxx>
branch nick: anewt.uws
timestamp: Fri 2010-03-26 22:36:52 +0100
message:
[core] Cleanup HTTP status constants
There is no reason to define constants like HTTP_STATUS_200
(since its just the number 200). The HTTP_STATUS_OK code is
useful though since it actually means something.
Also extended the list of constants to include several less
common HTTP status codes.
modified:
core/constants.lib.php
--
lp:anewt
https://code.launchpad.net/~uws/anewt/anewt.uws
Your team Anewt developers is subscribed to branch lp:anewt.
To unsubscribe from this branch go to https://code.launchpad.net/~uws/anewt/anewt.uws/+edit-subscription.
=== modified file 'core/constants.lib.php'
--- core/constants.lib.php 2008-11-13 17:42:04 +0000
+++ core/constants.lib.php 2010-03-26 21:36:52 +0000
@@ -38,54 +38,22 @@
/* HTTP Status Codes. See http://www.w3.org/Protocols/rfc2616/rfc2616.html */
-/** HTTP Status OK */
-define('HTTP_STATUS_200', 200);
-/** HTTP Status OK */
-define('HTTP_STATUS_OK', 200);
-
-/** HTTP Status Moved */
-define('HTTP_STATUS_301', 301);
-/** HTTP Status Moved */
-define('HTTP_STATUS_MOVED_PERMANENTLY', 301);
-/** HTTP Status Moved */
-define('HTTP_STATUS_MOVED', 301);
-
-/** HTTP Status Found */
-define('HTTP_STATUS_302', 302);
-/** HTTP Status Found */
-define('HTTP_STATUS_FOUND', 302);
-
-/** HTTP Status Not Modified */
-define('HTTP_STATUS_304', 304);
-/** HTTP Status Not Modified */
-define('HTTP_STATUS_NOT_MODIFIED', 304);
-
-/** HTTP Status Unauthorized */
-define('HTTP_STATUS_401', 401);
-/** HTTP Status Unauthorized */
-define('HTTP_STATUS_UNAUTHORIZED', 401);
-
-/** HTTP Status Forbidden */
-define('HTTP_STATUS_403', 403);
-/** HTTP Status Forbidden */
-define('HTTP_STATUS_FORBIDDEN', 403);
-
-/** HTTP Status Not Found */
-define('HTTP_STATUS_404', 404);
-/** HTTP Status Not Found */
-define('HTTP_STATUS_NOT_FOUND', 404);
-
-/** HTTP Status Internal Server Error */
-define('HTTP_STATUS_500', 500);
-/** HTTP Status Internal Server Error */
-define('HTTP_STATUS_INTERNAL_SERVER_ERROR', 500);
-/** HTTP Status Internal Server Error */
-define('HTTP_STATUS_SERVER_ERROR', 500);
-
-/** HTTP Status Not Implemented */
-define('HTTP_STATUS_501', 501);
-/** HTTP Status Not Implemented */
-define('HTTP_STATUS_NOT_IMPLEMENTED', 501);
+define('HTTP_STATUS_OK', 200); /**< HTTP Status 200 OK */
+define('HTTP_STATUS_CREATED', 201); /**< HTTP Status 201 Created */
+define('HTTP_STATUS_ACCEPTED', 202); /**< HTTP Status 202 Accepted */
+define('HTTP_STATUS_MOVED_PERMANENTLY', 301); /**< HTTP Status 301 Moved */
+define('HTTP_STATUS_MOVED', 301); /**< HTTP Status 301 Moved */
+define('HTTP_STATUS_FOUND', 302); /**< HTTP Status 302 Found */
+define('HTTP_STATUS_NOT_MODIFIED', 304); /**< HTTP Status 304 Not Modified */
+define('HTTP_STATUS_BAD_REQUEST', 400); /**< HTTP Status 400 Bad Request */
+define('HTTP_STATUS_UNAUTHORIZED', 401); /**< HTTP Status 401 Unauthorized */
+define('HTTP_STATUS_FORBIDDEN', 403); /**< HTTP Status 403 Forbidden */
+define('HTTP_STATUS_NOT_FOUND', 404); /**< HTTP Status 404 Not Found */
+define('HTTP_STATUS_INTERNAL_SERVER_ERROR', 500); /**< HTTP Status 500 Internal Server Error */
+define('HTTP_STATUS_SERVER_ERROR', 500); /**< HTTP Status 500 Internal Server Error */
+define('HTTP_STATUS_NOT_IMPLEMENTED', 501); /**< HTTP Status 501 Not Implemented */
+define('HTTP_STATUS_BAD_GATEWAY', 502); /**< HTTP Status 502 Bad Gateway */
+define('HTTP_STATUS_SERVICE_UNAVAILABLE', 503); /**< HTTP Status 503 Service Unavailable */
global $__anewt_http_status_strings;
/**
@@ -94,14 +62,20 @@
* HTTP status code to string mapping.
*/
$__anewt_http_status_strings = array(
- HTTP_STATUS_200 => 'OK',
- HTTP_STATUS_301 => 'Moved Permanently',
- HTTP_STATUS_302 => 'Found',
- HTTP_STATUS_401 => 'Unauthorized',
- HTTP_STATUS_403 => 'Forbidden',
- HTTP_STATUS_404 => 'Not Found',
- HTTP_STATUS_500 => 'Internal Server Error',
- HTTP_STATUS_501 => 'Not Implemented',
+ HTTP_STATUS_OK => 'OK',
+ HTTP_STATUS_CREATED => 'Created',
+ HTTP_STATUS_ACCEPTED => 'Accepted',
+ HTTP_STATUS_MOVED_PERMANENTLY => 'Moved Permanently',
+ HTTP_STATUS_FOUND => 'Found',
+ HTTP_STATUS_NOT_MODIFIED => 'Not Modified',
+ HTTP_STATUS_BAD_REQUEST => 'Bad Request',
+ HTTP_STATUS_UNAUTHORIZED => 'Unauthorized',
+ HTTP_STATUS_FORBIDDEN => 'Forbidden',
+ HTTP_STATUS_NOT_FOUND => 'Not Found',
+ HTTP_STATUS_INTERNAL_SERVER_ERROR => 'Internal Server Error',
+ HTTP_STATUS_NOT_IMPLEMENTED => 'Not Implemented',
+ HTTP_STATUS_BAD_GATEWAY => 'Bad Gateway',
+ HTTP_STATUS_SERVICE_UNAVAILABLE => 'Service Unavailable',
);
/**