DCL 4.0
Loading...
Searching...
No Matches
HttpSetCookie Class Reference

#include <HttpHeader.h>

Inheritance diagram for HttpSetCookie:
HttpHeader

Public Member Functions

 HttpSetCookie (const wchar_t *_name, const wchar_t *_value=NULL, time_t _expires=0, const wchar_t *_path=NULL, const wchar_t *_domain=NULL, bool _secure=false)
Public Member Functions inherited from HttpHeader
 HttpHeader ()
 HttpHeader (const HttpHeader &src)
 HttpHeader (const wchar_t *_name, const wchar_t *_content=NULL)
const String & name () const
const String & content () const
String toString () const

Additional Inherited Members

Protected Attributes inherited from HttpHeader
String __name
String __content

Detailed Description

Definition at line 34 of file HttpHeader.h.

Constructor & Destructor Documentation

◆ HttpSetCookie()

HttpSetCookie::HttpSetCookie ( const wchar_t * _name,
const wchar_t * _value = NULL,
time_t _expires = 0,
const wchar_t * _path = NULL,
const wchar_t * _domain = NULL,
bool _secure = false )

Definition at line 100 of file HttpHeader.cpp.

107 : HttpHeader(L"Set-Cookie")
108{
109 __DCL_ASSERT(_name != NULL);
110
111 StringBuilder sb = _name;
112 sb += L"=";
113 if (_value == NULL) {
114 // MSIE에서 null-value를 가지는 쿠키를 지우지 못한다
115 // 1년 1초 전의 시간을 할당하여 쿠키를 삭제한다.
116 sb += L"deleted";
117 sb += L"; Expires=";
118 sb += __GetGmtStr(time(NULL) - 31536001);
119 }
120 else {
121 sb += _value;
122
123 if (_expires > 0) {
124 sb += L"; Expires=";
125 sb += __GetGmtStr(_expires);
126 }
127 if (_path) {
128 sb += L"; Path=";
129 sb += _path;
130 }
131 if (_domain) {
132 sb += L"; Domain=";
133 sb += _domain;
134 }
135 if (_secure) {
136 sb += L"; Secure";
137 }
138 }
139
140 __content = sb.toString();
141}
#define NULL
Definition Config.h:340
#define __DCL_ASSERT(expr)
Definition Object.h:371
String __content
Definition HttpHeader.h:24

The documentation for this class was generated from the following files: