Skylark.diff
| uppsrc/Skylark/Dispatch.cpp (working copy) | ||
|---|---|---|
| 390 | 390 |
} |
| 391 | 391 |
else {
|
| 392 | 392 |
r << |
| 393 |
"HTTP/1.0 " << code << ' ' << code_text << "\r\n"
|
|
| 393 |
"HTTP/1.1 " << code << ' ' << code_text << "\r\n"
|
|
| 394 | 394 |
"Date: " << WwwFormat(GetUtcTime()) << "\r\n" |
| 395 |
"Server: U++\r\n" |
|
| 396 | 395 |
"Content-Length: " << response.GetCount() << "\r\n" |
| 397 |
"Connection: close\r\n" |
|
| 398 |
"Cache-Control: no-cache\r\n" |
|
| 399 | 396 |
"Content-Type: " << content_type << "\r\n"; |
| 397 |
for(int i = 0; i < headers.GetCount(); i++) |
|
| 398 |
r << headers.GetKey(i) << ": " << headers[i] << "\r\n"; |
|
| 400 | 399 |
for(int i = 0; i < cookies.GetCount(); i++) |
| 401 | 400 |
r << cookies[i]; |
| 402 | 401 |
r << "\r\n"; |
| uppsrc/Skylark/Http.cpp (working copy) | ||
|---|---|---|
| 12 | 12 |
content_type = "text/html; charset=UTF-8"; |
| 13 | 13 |
session_dirty = false; |
| 14 | 14 |
lang = LNG_ENGLISH; |
| 15 |
headers.Add("Server","U++");
|
|
| 16 |
headers.Add("Connection","close");
|
|
| 17 |
headers.Add("Cache-Control","no-cache");
|
|
| 15 | 18 |
} |
| 16 | 19 |
|
| 17 | 20 |
void Http::ParseRequest(const char *p) |
| ... | ... | |
| 121 | 124 |
return SetRawCookie(id, UrlEncode(value), expires, path, domain, secure); |
| 122 | 125 |
} |
| 123 | 126 |
|
| 127 |
Http& Http::SetHeader(const char *header, const char *data) |
|
| 128 |
{
|
|
| 129 |
headers.GetAdd(header) = data; |
|
| 130 |
} |
|
| 131 |
|
|
| 132 |
Http& Http::ClearHeader(const char *header) |
|
| 133 |
{
|
|
| 134 |
headers.RemoveKey(header); |
|
| 135 |
} |
|
| 136 |
|
|
| 124 | 137 |
void Http::ReadMultiPart(const String& buffer) |
| 125 | 138 |
{
|
| 126 | 139 |
const char *p = buffer; |
| uppsrc/Skylark/Http.h (working copy) | ||
|---|---|---|
| 56 | 56 |
String request_content_type; |
| 57 | 57 |
|
| 58 | 58 |
VectorMap<String, String> cookies; |
| 59 |
VectorMap<String, String> headers; |
|
| 59 | 60 |
|
| 60 | 61 |
void ParseRequest(const char *s); |
| 61 | 62 |
void ReadMultiPart(const String& content); |
| ... | ... | |
| 103 | 104 |
Http& SetCookie(const char *id, const String& value, |
| 104 | 105 |
Time expires = Null, const char *path = NULL, |
| 105 | 106 |
const char *domain = NULL, bool secure = false, bool httponly = false); |
| 107 |
Http& SetHeader(const char *header, const char *data); |
|
| 108 |
Http& ClearHeader(const char *header); |
|
| 106 | 109 |
|
| 107 | 110 |
Http& ClearSession(); |
| 108 | 111 |
Http& SessionSet(const char *id, const Value& value); |