libiqxmlrpc  0.12.4
 All Classes Namespaces Files Functions Typedefs Enumerations
http_errors.h
1 // Libiqxmlrpc - an object-oriented XML-RPC solution.
2 // Copyright (C) 2011 Anton Dedov
3 
4 #ifndef _libiqxmlrpc_http_errors_h_
5 #define _libiqxmlrpc_http_errors_h_
6 
7 #include "http.h"
8 
9 namespace iqxmlrpc {
10 namespace http {
11 
13 class LIBIQXMLRPC_API Bad_request: public Error_response {
14 public:
15  Bad_request():
16  Error_response( "Bad request", 400 ) {}
17 };
18 
20 class LIBIQXMLRPC_API Unauthorized: public Error_response {
21 public:
22  Unauthorized():
23  Error_response( "Unauthorized", 401 )
24  {
25  header_->set_option( "www-authenticate", "Basic realm=\"\"" );
26  }
27 };
28 
30 class LIBIQXMLRPC_API Method_not_allowed: public Error_response {
31 public:
33  Error_response( "Method not allowed", 405 )
34  {
35  header_->set_option( "allowed:", "POST" );
36  }
37 };
38 
40 class LIBIQXMLRPC_API Length_required: public Error_response {
41 public:
43  Error_response( "Content-Length Required", 411 ) {}
44 };
45 
47 class LIBIQXMLRPC_API Request_too_large: public Error_response {
48 public:
50  Error_response( "Request Entity Too Large", 413 ) {}
51 };
52 
54 class LIBIQXMLRPC_API Unsupported_content_type: public Error_response {
55 public:
56  Unsupported_content_type(const std::string& wrong):
57  Error_response( "Unsupported media type '" + wrong + "'", 415 ) {}
58 };
59 
61 class LIBIQXMLRPC_API Expectation_failed: public Error_response {
62 public:
64  Error_response( "Expectation Failed", 417 ) {}
65 };
66 
67 } // namespace http
68 } // namespace iqxmlrpc
69 
70 #endif
71 // vim:ts=2:sw=2:et