2
Copyright (C) 2000-2005 SKYRIX Software AG
4
This file is part of SOPE.
6
SOPE 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
SOPE 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 SOPE; see the file COPYING. If not, write to the
18
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22
#ifndef __NGHttp_NGHttpResponse_H__
23
#define __NGHttp_NGHttpResponse_H__
25
#import "NGHttpMessage.h"
28
@class NGHttpRequest, NGHttpChallenge;
31
NGHttpStatusCode_unknown = 0,
34
NGHttpStatusCode_Continue = 100,
35
NGHttpStatusCode_SwitchingProtocols = 101,
38
NGHttpStatusCode_OK = 200,
39
NGHttpStatusCode_Created = 201,
40
NGHttpStatusCode_Accepted = 202,
41
NGHttpStatusCode_NonAuthoritativeInformation = 203,
42
NGHttpStatusCode_NoContent = 204,
43
NGHttpStatusCode_ResetContent = 205,
44
NGHttpStatusCode_PartialContent = 206,
47
NGHttpStatusCode_MultipleChoices = 300,
48
NGHttpStatusCode_MovedPermanently = 301,
49
NGHttpStatusCode_MovedTemporarily = 302,
50
NGHttpStatusCode_SeeOther = 303,
51
NGHttpStatusCode_NotModified = 304,
52
NGHttpStatusCode_UseProxy = 305,
55
NGHttpStatusCode_BadRequest = 400,
56
NGHttpStatusCode_Unauthorized = 401,
57
NGHttpStatusCode_PaymentRequired = 402,
58
NGHttpStatusCode_Forbidden = 403,
59
NGHttpStatusCode_NotFound = 404,
60
NGHttpStatusCode_MethodNotAllowed = 405,
61
NGHttpStatusCode_NoneAcceptable = 406,
62
NGHttpStatusCode_ProxyAuthenticationRequired = 407,
63
NGHttpStatusCode_RequestTimeout = 408,
64
NGHttpStatusCode_Conflict = 409,
65
NGHttpStatusCode_Gone = 410,
66
NGHttpStatusCode_LengthRequired = 411,
67
NGHttpStatusCode_UnlessTrue = 412,
70
NGHttpStatusCode_InternalServerError = 500,
71
NGHttpStatusCode_NotImplemented = 501,
72
NGHttpStatusCode_BadGateway = 502,
73
NGHttpStatusCode_ServiceUnavailable = 503,
74
NGHttpStatusCode_GatewayTimeout = 504,
79
@interface NGHttpResponse : NGHttpMessage
81
NGHttpStatusCode statusCode;
84
NGHttpRequest *request;
87
- (id)initWithRequest:(NGHttpRequest *)_request;
89
- (id)initWithStatus:(int)_status reason:(NSString *)_reason
90
header:(NGHashMap *)_header version:(NSString *)_version;
94
- (void)setStatusCode:(NGHttpStatusCode)_code;
95
- (NGHttpStatusCode)statusCode;
97
- (void)setReason:(NSString *)_text;
100
- (void)setRequest:(NGHttpRequest *)_request;
101
- (NGHttpRequest *)request;
105
@interface NGHttpResponse(CommonHeaders)
107
- (void)setWWWAuthenticate:(NGHttpChallenge *)_challenge;
108
- (NGHttpChallenge *)wwwAuthenticate;
112
static inline BOOL NGIsInformationalHttpStatusCode(NGHttpStatusCode _code) {
113
return ((_code >= 100) && (_code < 200)) ? YES : NO;
115
static inline BOOL NGIsSuccessfulHttpStatusCode(NGHttpStatusCode _code) {
116
return ((_code >= 200) && (_code < 300)) ? YES : NO;
118
static inline BOOL NGIsRedirectionHttpStatusCode(NGHttpStatusCode _code) {
119
return ((_code >= 300) && (_code < 400)) ? YES : NO;
121
static inline BOOL NGIsClientErrorHttpStatusCode(NGHttpStatusCode _code) {
122
return ((_code >= 400) && (_code < 500)) ? YES : NO;
124
static inline BOOL NGIsServerErrorHttpStatusCode(NGHttpStatusCode _code) {
125
return ((_code >= 500) && (_code < 600)) ? YES : NO;
128
#endif /* __NGHttp_NGHttpResponse_H__ */