2 Copyright (C) 2000-2003 SKYRIX Software AG
4 This file is part of OGo
6 OGo is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 #ifndef __NGHttp_NGHttpResponse_H__
24 #define __NGHttp_NGHttpResponse_H__
26 #import "NGHttpMessage.h"
29 @class NGHttpRequest, NGHttpChallenge;
32 NGHttpStatusCode_unknown = 0,
35 NGHttpStatusCode_Continue = 100,
36 NGHttpStatusCode_SwitchingProtocols = 101,
39 NGHttpStatusCode_OK = 200,
40 NGHttpStatusCode_Created = 201,
41 NGHttpStatusCode_Accepted = 202,
42 NGHttpStatusCode_NonAuthoritativeInformation = 203,
43 NGHttpStatusCode_NoContent = 204,
44 NGHttpStatusCode_ResetContent = 205,
45 NGHttpStatusCode_PartialContent = 206,
48 NGHttpStatusCode_MultipleChoices = 300,
49 NGHttpStatusCode_MovedPermanently = 301,
50 NGHttpStatusCode_MovedTemporarily = 302,
51 NGHttpStatusCode_SeeOther = 303,
52 NGHttpStatusCode_NotModified = 304,
53 NGHttpStatusCode_UseProxy = 305,
56 NGHttpStatusCode_BadRequest = 400,
57 NGHttpStatusCode_Unauthorized = 401,
58 NGHttpStatusCode_PaymentRequired = 402,
59 NGHttpStatusCode_Forbidden = 403,
60 NGHttpStatusCode_NotFound = 404,
61 NGHttpStatusCode_MethodNotAllowed = 405,
62 NGHttpStatusCode_NoneAcceptable = 406,
63 NGHttpStatusCode_ProxyAuthenticationRequired = 407,
64 NGHttpStatusCode_RequestTimeout = 408,
65 NGHttpStatusCode_Conflict = 409,
66 NGHttpStatusCode_Gone = 410,
67 NGHttpStatusCode_LengthRequired = 411,
68 NGHttpStatusCode_UnlessTrue = 412,
71 NGHttpStatusCode_InternalServerError = 500,
72 NGHttpStatusCode_NotImplemented = 501,
73 NGHttpStatusCode_BadGateway = 502,
74 NGHttpStatusCode_ServiceUnavailable = 503,
75 NGHttpStatusCode_GatewayTimeout = 504,
80 @interface NGHttpResponse : NGHttpMessage
82 NGHttpStatusCode statusCode;
85 NGHttpRequest *request;
88 - (id)initWithRequest:(NGHttpRequest *)_request;
90 - (id)initWithStatus:(int)_status reason:(NSString *)_reason
91 header:(NGHashMap *)_header version:(NSString *)_version;
95 - (void)setStatusCode:(NGHttpStatusCode)_code;
96 - (NGHttpStatusCode)statusCode;
98 - (void)setReason:(NSString *)_text;
101 - (void)setRequest:(NGHttpRequest *)_request;
102 - (NGHttpRequest *)request;
106 @interface NGHttpResponse(CommonHeaders)
108 - (void)setWWWAuthenticate:(NGHttpChallenge *)_challenge;
109 - (NGHttpChallenge *)wwwAuthenticate;
113 static inline BOOL NGIsInformationalHttpStatusCode(NGHttpStatusCode _code) {
114 return ((_code >= 100) && (_code < 200)) ? YES : NO;
116 static inline BOOL NGIsSuccessfulHttpStatusCode(NGHttpStatusCode _code) {
117 return ((_code >= 200) && (_code < 300)) ? YES : NO;
119 static inline BOOL NGIsRedirectionHttpStatusCode(NGHttpStatusCode _code) {
120 return ((_code >= 300) && (_code < 400)) ? YES : NO;
122 static inline BOOL NGIsClientErrorHttpStatusCode(NGHttpStatusCode _code) {
123 return ((_code >= 400) && (_code < 500)) ? YES : NO;
125 static inline BOOL NGIsServerErrorHttpStatusCode(NGHttpStatusCode _code) {
126 return ((_code >= 500) && (_code < 600)) ? YES : NO;
129 #endif /* __NGHttp_NGHttpResponse_H__ */