Mercurial > hg > orthanc
comparison Core/HttpServer/HttpOutput.cpp @ 324:64925c94825c
api improvement
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 08 Jan 2013 09:29:56 +0100 |
parents | 1ac3aacd10a5 |
children | 78a8eaa5f30b |
comparison
equal
deleted
inserted
replaced
323:052dede32761 | 324:64925c94825c |
---|---|
30 **/ | 30 **/ |
31 | 31 |
32 | 32 |
33 #include "HttpOutput.h" | 33 #include "HttpOutput.h" |
34 | 34 |
35 #include <iostream> | |
35 #include <vector> | 36 #include <vector> |
36 #include <stdio.h> | 37 #include <stdio.h> |
37 #include <boost/lexical_cast.hpp> | 38 #include <boost/lexical_cast.hpp> |
38 #include "../OrthancException.h" | 39 #include "../OrthancException.h" |
39 #include "../Toolbox.h" | 40 #include "../Toolbox.h" |
74 s += "\r\n"; | 75 s += "\r\n"; |
75 | 76 |
76 Send(&s[0], s.size()); | 77 Send(&s[0], s.size()); |
77 } | 78 } |
78 | 79 |
80 void HttpOutput::SendOkHeader(const HttpHandler::Arguments& header) | |
81 { | |
82 std::string s = "HTTP/1.1 200 OK\r\n"; | |
79 | 83 |
80 void HttpOutput::SendCustomOkHeader(const std::string& customHeader) | 84 for (HttpHandler::Arguments::const_iterator |
81 { | 85 it = header.begin(); it != header.end(); it++) |
82 std::string s = "HTTP/1.1 200 OK\r\n" + customHeader + "\r\n"; | 86 { |
87 s += it->first + ": " + it->second + "\r\n"; | |
88 } | |
89 | |
90 s += "\r\n"; | |
91 | |
83 Send(&s[0], s.size()); | 92 Send(&s[0], s.size()); |
84 } | 93 } |
85 | 94 |
86 | 95 |
87 void HttpOutput::SendMethodNotAllowedError(const std::string& allowed) | 96 void HttpOutput::SendMethodNotAllowedError(const std::string& allowed) |