Menu

[r2350]: / framework / trunk / cppcms / http_content_filter.h  Maximize  Restore  History

Download this file

119 lines (94 with data), 2.9 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
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2008-2015 Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com>
//
// See accompanying file COPYING.TXT file for licensing details.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef CPPCMS_HTTP_CONTENT_FILTER_H
#define CPPCMS_HTTP_CONTENT_FILTER_H
#include <cppcms/defs.h>
#include <cppcms/cppcms_error.h>
#include <booster/hold_ptr.h>
#include <booster/noncopyable.h>
#include <string>
namespace cppcms {
namespace impl {
class cached_settings;
}
namespace http {
class file;
class context;
///
/// Exceptions that is thrown to abort content upload progress indicating an error
///
class CPPCMS_API abort_upload : public cppcms_error {
public:
///
/// Abort
///
abort_upload(int status_code);
abort_upload(int status_code,std::string const &message);
virtual ~abort_upload() throw();
int code() const;
std::string message() const;
private:
int code_;
std::string message_;
};
class CPPCMS_API content_limits : public booster::noncopyable {
friend class request;
content_limits(impl::cached_settings const &);
public:
content_limits();
~content_limits();
size_t content_length_limit() const;
void content_length_limit(size_t size);
long long multipart_form_data_limit() const;
void multipart_form_data_limit(long long size);
size_t file_in_memory_limit() const;
void file_in_memory_limit(size_t size);
std::string uploads_path() const;
void uploads_path(std::string const &path);
private:
size_t content_length_limit_;
size_t file_in_memory_limit_;
long long multipart_form_data_limit_;
std::string uploads_path_;
struct _data;
booster::hold_ptr<_data> d;
};
class CPPCMS_API basic_content_filter {
basic_content_filter(basic_content_filter const &);
void operator=(basic_content_filter const &);
public:
basic_content_filter();
virtual ~basic_content_filter();
virtual void on_end_of_content();
virtual void on_error();
private:
struct _data;
booster::hold_ptr<_data> d;
};
class CPPCMS_API raw_content_filter : basic_content_filter {
public:
virtual void on_data_chunk(void const *data,size_t data_size) = 0;
virtual ~raw_content_filter();
private:
struct _raw_data;
booster::hold_ptr<_raw_data> d;
};
class CPPCMS_API multipart_filter : public basic_content_filter {
public:
multipart_filter();
virtual ~multipart_filter();
virtual void on_new_file(http::file &input_file);
virtual void on_upload_progress(http::file &input_file);
virtual void on_data_ready(http::file &input_file);
private:
struct _mp_data;
booster::hold_ptr<_mp_data> d;
};
} // http
} // cppcms
#endif
MongoDB Logo MongoDB