HTTPResponse.h
Go to the documentation of this file.
00001 /* 00002 * Copyright 2006-2009 Savarese Software Research Corporation 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * https://www.savarese.com/software/ApacheLicense-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00022 #ifndef __SSRC_WSPR_FCGI_HTTP_RESPONSE_H 00023 #define __SSRC_WSPR_FCGI_HTTP_RESPONSE_H 00024 00025 #include <string> 00026 #include <boost/filesystem/path.hpp> 00027 00028 #include <ssrc/wispers-packages.h> 00029 00030 __BEGIN_NS_SSRC_WSPR_FCGI 00031 00032 using std::string; 00033 00037 enum HTTPStatusCode { 00038 StatusOK = 200, 00039 StatusFound = 302, 00040 StatusBadRequest = 400, 00041 StatusUnauthorized = 401, 00042 StatusPaymentRequired = 402, 00043 StatusForbidden = 403, 00044 StatusNotFound = 404, 00045 StatusMethodNotAllowed = 405, 00046 StatusNotAcceptable = 406, 00047 StatusProxyAuthenticationRequired = 407, 00048 StatusRequestTimeout = 408, 00049 StatusConflict = 409, 00050 StatusGone = 410, 00051 StatusLengthRequired = 411, 00052 StatusPreconditionFailed = 412, 00053 StatusRequestEntityTooLarge = 413, 00054 StatusRequestURITooLong = 414, 00055 StatusInternalServerError = 500, 00056 StatusMethodNotImplemented = 501, 00057 StatusBadGateway = 502, 00058 StatusServiceUnavailable = 503, 00059 StatusGatewayTimeout = 504 00060 }; 00061 00062 const bool CacheDisable = true; 00063 const bool CacheEnable = false; 00064 00068 struct HTTPResponse { 00069 00070 virtual ~HTTPResponse() { } 00071 00081 virtual void complete(const char *content = 0, 00082 const unsigned int content_length = 0, 00083 bool cache_disable = CacheEnable) = 0; 00084 00090 virtual bool completed() const = 0; 00091 00096 virtual void suspend() = 0; 00097 00102 virtual void resume() = 0; 00103 00111 virtual bool suspended() const = 0; 00112 00118 virtual void send_error(const HTTPStatusCode status) = 0; 00119 00132 virtual void send_redirect(const string & redirect) = 0; 00133 00140 virtual void set_content_type(const string & type) = 0; 00141 00149 virtual const string & content_type() const = 0; 00150 00159 virtual void set_status(const HTTPStatusCode status) = 0; 00160 00168 virtual HTTPStatusCode status() const = 0; 00169 00170 /* 00171 typedef HTTPRequest::parameter_map header_map; 00172 virtual void set_header(const header_map::value_type & header_value) = 0; 00173 virtual void add_header(const header_map::value_type & header_value) = 0; 00174 */ 00175 00176 // TODO: Add domain support. 00185 virtual void set_session_id(const string & session_id, 00186 const unsigned int max_age = 1, 00187 const bool secure = false) = 0; 00188 00192 virtual void clear_session_id() = 0; 00193 00206 virtual const string & session_id() const = 0; 00207 }; 00208 00209 00210 __END_NS_SSRC_WSPR_FCGI 00211 00212 #endif
Copyright © 2006-2011 Savarese Software Research Corporation. All rights reserved.