-
Notifications
You must be signed in to change notification settings - Fork 951
Expand file tree
/
Copy pathhttp_pipe.cpp
More file actions
69 lines (57 loc) · 1.12 KB
/
Copy pathhttp_pipe.cpp
File metadata and controls
69 lines (57 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include "acl_stdafx.hpp"
#ifndef ACL_PREPARE_COMPILE
#include "acl_cpp/stdlib/charset_conv.hpp"
#include "acl_cpp/stdlib/pipe_stream.hpp"
#include "acl_cpp/http/http_pipe.hpp"
#endif
namespace acl
{
http_pipe::http_pipe(void)
: conv_(NULL)
{
}
http_pipe::~http_pipe(void)
{
delete conv_;
}
void http_pipe::set_charset(charset_conv* conv)
{
manager_.push_back(conv);
}
bool http_pipe::set_charset(const char* from, const char* to)
{
if (from == NULL || to == NULL || strcasecmp(from, to) == 0) {
return false;
}
if (conv_ == NULL) {
conv_ = NEW charset_conv();
}
if (!conv_->update_begin(from, to)) {
delete conv_;
conv_ = NULL;
return false;
}
set_charset(conv_);
return true;
}
void http_pipe::append(pipe_stream* ps)
{
manager_.push_back(ps);
}
void http_pipe::reset(void)
{
manager_.clear();
}
bool http_pipe::update(const char* in, size_t len)
{
return manager_.update(in, len);
}
bool http_pipe::update_end(void)
{
return manager_.update_end();
}
pipe_manager& http_pipe::get_manager(void)
{
return manager_;
}
} // namespace acl