comparison OrthancFramework/Sources/HttpServer/IHttpHandler.cpp @ 4330:a01b1c9cbef4

moving generic type definitions from IHttpHandler to HttpToolbox
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 25 Nov 2020 14:39:10 +0100
parents 9dc0e42f868b
children d9473bd5ed43
comparison
equal deleted inserted replaced
4329:9dc0e42f868b 4330:a01b1c9cbef4
34 { 34 {
35 bool IHttpHandler::SimpleGet(std::string& result, 35 bool IHttpHandler::SimpleGet(std::string& result,
36 IHttpHandler& handler, 36 IHttpHandler& handler,
37 RequestOrigin origin, 37 RequestOrigin origin,
38 const std::string& uri, 38 const std::string& uri,
39 const IHttpHandler::Arguments& httpHeaders) 39 const HttpToolbox::Arguments& httpHeaders)
40 { 40 {
41 UriComponents curi; 41 UriComponents curi;
42 IHttpHandler::GetArguments getArguments; 42 HttpToolbox::GetArguments getArguments;
43 HttpToolbox::ParseGetQuery(curi, getArguments, uri.c_str()); 43 HttpToolbox::ParseGetQuery(curi, getArguments, uri.c_str());
44 44
45 StringHttpOutput stream; 45 StringHttpOutput stream;
46 HttpOutput http(stream, false /* no keep alive */); 46 HttpOutput http(stream, false /* no keep alive */);
47 47
63 RequestOrigin origin, 63 RequestOrigin origin,
64 HttpMethod method, 64 HttpMethod method,
65 const std::string& uri, 65 const std::string& uri,
66 const void* bodyData, 66 const void* bodyData,
67 size_t bodySize, 67 size_t bodySize,
68 const IHttpHandler::Arguments& httpHeaders) 68 const HttpToolbox::Arguments& httpHeaders)
69 { 69 {
70 IHttpHandler::GetArguments getArguments; // No GET argument for POST/PUT 70 HttpToolbox::GetArguments getArguments; // No GET argument for POST/PUT
71 71
72 UriComponents curi; 72 UriComponents curi;
73 Toolbox::SplitUriComponents(curi, uri); 73 Toolbox::SplitUriComponents(curi, uri);
74 74
75 StringHttpOutput stream; 75 StringHttpOutput stream;
92 IHttpHandler& handler, 92 IHttpHandler& handler,
93 RequestOrigin origin, 93 RequestOrigin origin,
94 const std::string& uri, 94 const std::string& uri,
95 const void* bodyData, 95 const void* bodyData,
96 size_t bodySize, 96 size_t bodySize,
97 const IHttpHandler::Arguments& httpHeaders) 97 const HttpToolbox::Arguments& httpHeaders)
98 { 98 {
99 return SimplePostOrPut(result, handler, origin, HttpMethod_Post, uri, bodyData, bodySize, httpHeaders); 99 return SimplePostOrPut(result, handler, origin, HttpMethod_Post, uri, bodyData, bodySize, httpHeaders);
100 } 100 }
101 101
102 102
104 IHttpHandler& handler, 104 IHttpHandler& handler,
105 RequestOrigin origin, 105 RequestOrigin origin,
106 const std::string& uri, 106 const std::string& uri,
107 const void* bodyData, 107 const void* bodyData,
108 size_t bodySize, 108 size_t bodySize,
109 const IHttpHandler::Arguments& httpHeaders) 109 const HttpToolbox::Arguments& httpHeaders)
110 { 110 {
111 return SimplePostOrPut(result, handler, origin, HttpMethod_Put, uri, bodyData, bodySize, httpHeaders); 111 return SimplePostOrPut(result, handler, origin, HttpMethod_Put, uri, bodyData, bodySize, httpHeaders);
112 } 112 }
113 113
114 114
115 bool IHttpHandler::SimpleDelete(IHttpHandler& handler, 115 bool IHttpHandler::SimpleDelete(IHttpHandler& handler,
116 RequestOrigin origin, 116 RequestOrigin origin,
117 const std::string& uri, 117 const std::string& uri,
118 const IHttpHandler::Arguments& httpHeaders) 118 const HttpToolbox::Arguments& httpHeaders)
119 { 119 {
120 UriComponents curi; 120 UriComponents curi;
121 Toolbox::SplitUriComponents(curi, uri); 121 Toolbox::SplitUriComponents(curi, uri);
122 122
123 IHttpHandler::GetArguments getArguments; // No GET argument for DELETE 123 HttpToolbox::GetArguments getArguments; // No GET argument for DELETE
124 124
125 StringHttpOutput stream; 125 StringHttpOutput stream;
126 HttpOutput http(stream, false /* no keep alive */); 126 HttpOutput http(stream, false /* no keep alive */);
127 127
128 return handler.Handle(http, origin, LOCALHOST, "", HttpMethod_Delete, curi, 128 return handler.Handle(http, origin, LOCALHOST, "", HttpMethod_Delete, curi,