You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(52) |
Jun
(30) |
Jul
(17) |
Aug
(9) |
Sep
(4) |
Oct
(7) |
Nov
(11) |
Dec
(19) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
|
Feb
(1) |
Mar
(37) |
Apr
(28) |
May
(15) |
Jun
(28) |
Jul
(7) |
Aug
(125) |
Sep
(116) |
Oct
(85) |
Nov
(14) |
Dec
(6) |
2009 |
Jan
(11) |
Feb
(4) |
Mar
(5) |
Apr
|
May
(9) |
Jun
(5) |
Jul
(4) |
Aug
(40) |
Sep
(1) |
Oct
(19) |
Nov
(43) |
Dec
(45) |
2010 |
Jan
(76) |
Feb
(95) |
Mar
(3) |
Apr
(23) |
May
(39) |
Jun
(54) |
Jul
(6) |
Aug
(13) |
Sep
(12) |
Oct
(59) |
Nov
(53) |
Dec
(43) |
2011 |
Jan
(43) |
Feb
(44) |
Mar
(25) |
Apr
(23) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(5) |
Oct
(1) |
Nov
(2) |
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(6) |
Oct
|
Nov
|
Dec
|
From: Max M. <ma...@kt...> - 2011-01-17 16:11:43
|
Hey everybody. I have a problem using the asynchronous server version of the cpp-netlib. As soon as I make a request a bad_cast exception is cast on the thread that ran .run(). I am making a request to "http://localhost:11200/proxy/?url=http://www.google.se", but all other requests seem to fail aswell. This is working fine for the synchronous version of the server. I am making this request from firefox. Also, I am using v0.8 of the library. Any ideas? Checking the documentation for using the async-server, it seems to be pretty identical to what I am doing. //asyncproxy.cpp #include <string> #include "asyncproxy.h" namespace proxy { void ASyncProxy::startProxy(std::string url, std::string port) { boost::network::utils::thread_pool thread_pool(2); http_server server(url, port, *this, thread_pool); server.run(); } ASyncProxy::ASyncProxy(void (*callback)(std::string)) { this->callback = callback; } void ASyncProxy::operator()(http_server::request const & req, http_server::connection_ptr connection) { connection->set_status(http_server::connection::ok); } } int main() { proxy::ASyncProxy prox(&writeQueue); prox.startProxy("localhost", 11200); } //asyncproxy.h #include <boost\network\protocol\http\server.hpp> #include <boost\network\utils\thread_pool.hpp> namespace proxy { struct ASyncProxy { typedef boost::network::http::async_server<ASyncProxy> http_server; public: void startProxy(std::string url, std::string port); ASyncProxy(void (*callback)(std::string)); void operator()(http_server::request const & req, http_server::connection_ptr connection); private: void (*callback)(std::string); }; } #endif |
From: Dean M. B. <mik...@gm...> - 2011-01-17 15:39:17
|
Hi Max! Please see my response in-lined below. On Mon, Jan 17, 2011 at 11:27 PM, Max Malmgren <ma...@kt...> wrote: > Hi, > > First off, let me say thanks for a very useful library. I've only been using > it for a few days but it is very simple to use most of the time. > You're welcome, I'm glad it's been useful to you. :) > I've managed to use your library to implement a HTTP proxy, which was very > simple. I did this using the synchronous server and synchronous client. > > However, since I'd like to use this in a streaming capacity, I'd like to use > asynchronous reads and writes. > > I have tried setting up a simple async server, using the same model I did > for the synchronous server. However, at runtime I get a bad_cast exception > when I use my browser to make a request. It does not even enter the operator > overload method body. > > I'm sorry if this is the wrong place for this type of question, but I would > very much appreciate some help to understand what I'm doing wrong. As you > can see, it is simply a definition of a class, which I use as input to the > server method. > Actually, it's better if you ask on the cpp-netlib-devel mailing list. It's where the developers and users get together to ask questions and help each other out. :) What version of the library are you using? > Source: > > #include <string> > #include "asyncproxy.h" > > namespace proxy { > void ASyncProxy::startProxy(std::string url, std::string port) > { > boost::network::utils::thread_pool thread_pool(2); > http_server server(url, port, *this, thread_pool); > server.run(); > } > ASyncProxy::ASyncProxy(void (*callback)(std::string)) > { > this->callback = callback; > } > void ASyncProxy::operator()(http_server::request const & req, > http_server::connection_ptr connection) > { > connection->set_status(http_server::connection::ok); > } > } > > int main() > { > proxy::ASyncProxy prox(&writeQueue); > prox.startProxy(url, port); > } > Can you show the exact request that makes the server fail? There may be a bug somewhere in the implementation that has something to do with converting strings into numbers. What browser are you using and can you send in your raw request data? Thanks in advance and I hope to hear from you again soon (hopefully this time on the developers mailing list). :) Also, there's documentation on how to use the HTTP asynchronous server from here: http://cpp-netlib.github.com/ -- let me know if you run into any issues that you need further clarification about. -- Dean Michael Berris about.me/deanberris |
From: Dean M. B. <mik...@gm...> - 2011-01-16 14:18:38
|
Hi Martin, I apologize for the delay in the response, I've been offline for most of the weekend. I just got back to my home office though now. That said, please see my thoughts below: On Sat, Jan 15, 2011 at 9:09 PM, koso <kos...@gm...> wrote: > Hello, > > is there available any roadplan for future library implementation? We > have planed using your library, but it seems it's missing some (for us) > key features (HTTPS server, request pipelining, ...). > There isn't a roadmap out there yet, but I have posted that I really want to be able to implement these things in the 1.0 release -- which should be after the 0.9 release, the release that pretty much will be made part of a Boost review. I am going to start working on these as soon as I get enough time to dedicate to the effort -- but I would also welcome contributions from other developers who do have the time to make it happen. One thing I would encourage is if you -- and others on the list -- can go to the issue tracker for the cpp-netlib project and vote on the issues you want me to fix sooner than later. Here's a link to the issues page for the project: https://github.com/cpp-netlib/cpp-netlib/issues -- please log in and vote or put what features you want to see appropriately in the tracker. > Thanks for reply, > Thank you too for asking -- I think a roadmap would really be interesting to work on. I'll see if I can get something up on a Wiki page too. Have a good weekend and I hope this helps. -- Dean Michael Berris about.me/deanberris |
From: koso <kos...@gm...> - 2011-01-15 13:10:22
|
Hello, is there available any roadplan for future library implementation? We have planed using your library, but it seems it's missing some (for us) key features (HTTPS server, request pipelining, ...). Thanks for reply, Martin Kosorinsky |
From: Dean M. B. <mik...@gm...> - 2011-01-13 02:10:49
|
On Wed, Jan 12, 2011 at 12:24 PM, Oleg Malashenko <ole...@gm...> wrote: > Hello, Dean, > > Here is my implementation of async_connection::write_vec(). Before any > pull requests I want you to check it to see if you like the idea. > > First of all, current write_impl() introduces race on user data. If > execution flow falls in one of conditions when we need to wait for > headers being sent than we schedule an operation and return control to > user _without_ copying the data. The actual copying will occur after > continue_write(). > Hmmm... So the current implementation has a bug? I don't see how the patch addresses that. > Being not hardcore-templating-guru I don't know how to make specific > write() overload with ConstBufferSequence model as a first argument > (because it overlaps with <Range, Callback>) so I introduced write_vec > interface. > That should be the reverse, you can use SFINAE to choose which implementation to take. Just enable the <Range,Callback> version if the Range is a Boost.Range type, enable your implementation if the parameter is a Boost.Asio buffer sequence. Later on we can add a lot more overloads on the user-facing interface. Although there is no way (yet) to do concept-based dispatch, SFINAE on specific template instances (using special metafunctions) is the best way to achieve it. > BTW, I think it is a good idea to explicitly specify that write() makes > a copy of supplied data and rename it to write_copy() (see > to_lower_copy, to_upper_copy, etc. in boost::algorithm) > Or, just document the behavior. ;) > To maximise core reuse, write_impl now only prepares buffers and passes > them to write_vec_impl. > > Tested both write and write_vec on 'master' with valgrind on > linux/amd64: no memory leaks, no memory corruption. > > Patch provided applies cleanly to master and 0.9-devel. > Cool, please send in a pull request so that I can merge -- please send two, one for 0.8-devel and 0.9-devel -- so that I can package up a beta for 0.9, and release 0.8.1 later today. Thanks Oleg and I look forward to the pull requests! -- Dean Michael Berris about.me/deanberris |
From: Dean M. B. <mik...@gm...> - 2011-01-12 05:29:00
|
On Wed, Jan 12, 2011 at 12:51 PM, Oleg Malashenko <ole...@gm...> wrote: > Hello, Dean, > > Sorry for previous message, somehow it appears to be unreadable :( > Hi Oleg, I'll look at this later in my day. Thanks and I'll send feedback as soon as I get a chance to look at it. Have a good one! -- Dean Michael Berris about.me/deanberris |
From: Oleg M. <ole...@gm...> - 2011-01-12 04:51:51
|
Hello, Dean, Sorry for previous message, somehow it appears to be unreadable :( Here is my implementation of async_connection::write_vec(). Before any pull requests I want you to check it to see if you like the idea. First of all, current write_impl() introduces race on user data. If execution flow falls in one of conditions when we need to wait for headers being sent than we schedule an operation and return control to user _without_ copying the data. The actual copying will occur after continue_write(). Being not hardcore-templating-guru I don't know how to make specific write() overload with ConstBufferSequence model as a first argument (because it overlaps with <Range, Callback>) so I introduced write_vec interface. BTW, I think it is a good idea to explicitly specify that write() makes a copy of supplied data and rename it to write_copy() (see to_lower_copy, to_upper_copy, etc. in boost::algorithm) To maximise core reuse, write_impl now only prepares buffers and passes them to write_vec_impl. Tested both write and write_vec on 'master' with valgrind on linux/amd64: no memory leaks, no memory corruption. Patch provided applies cleanly to master and 0.9-devel. -- Best regards, Oleg Malashenko. |
From: Oleg M. <ole...@gm...> - 2011-01-12 04:24:35
|
Hello, Dean, Here is my implementation of async_connection::write_vec(). Before any pull requests I want you to check it to see if you like the idea. First of all, current write_impl() introduces race on user data. If execution flow falls in one of conditions when we need to wait for headers being sent than we schedule an operation and return control to user _without_ copying the data. The actual copying will occur after continue_write(). Being not hardcore-templating-guru I don't know how to make specific write() overload with ConstBufferSequence model as a first argument (because it overlaps with <Range, Callback>) so I introduced write_vec interface. BTW, I think it is a good idea to explicitly specify that write() makes a copy of supplied data and rename it to write_copy() (see to_lower_copy, to_upper_copy, etc. in boost::algorithm) To maximise core reuse, write_impl now only prepares buffers and passes them to write_vec_impl. Tested both write and write_vec on 'master' with valgrind on linux/amd64: no memory leaks, no memory corruption. Patch provided applies cleanly to master and 0.9-devel. -- Best regards, Oleg Malashenko. |
From: Nelson, E. - 2 <eri...@ba...> - 2011-01-11 17:02:29
|
> On Wed, Jan 12, 2011 at 12:26 AM, David Hite <dav...@gm...> > wrote: > > Hello, > > I am trying to parse the incoming query in a request to the > synchronous > > server. I see that there is a "query" method on the HTTP Normal > Client > > Request but not the Pod Server Request. I can't find any example of > the > > server request query parameters. > > > > Is there a simple way to pull out the "?" query portion of the uri? > > > > I am able to get the destination(request) method to work and could do > some > > string parsing but I figured there is a better way... > > We use something like this in a header ******************************************** #include "boost/spirit/include/qi.hpp" #include <string> #include <utility> template <typename Iterator, typename map_type> struct key_value_sequence : boost::spirit::qi::grammar<Iterator, map_type()> { key_value_sequence() : key_value_sequence::base_type(query) { query = pair >> *((boost::spirit::qi::lit(';') | '&') >> pair); pair = key >> -('=' >> value); key = boost::spirit::qi::char_("a-zA-Z_0-9%+") >> *boost::spirit::qi::char_("a-zA-Z_0-9%+"); value = +boost::spirit::qi::char_("a-zA-Z_0-9%+"); } boost::spirit::qi::rule<Iterator, map_type()> query; boost::spirit::qi::rule<Iterator, std::pair<std::string, std::string>()> pair; boost::spirit::qi::rule<Iterator, std::string()> key, value; }; template<typename map_type> inline map_type& parse_http_query(const std::string& uri, map_type& output) { std::string new_uri(uri); // this should go away when qi can parse const iterators key_value_sequence<std::string::iterator, map_type> p; const size_t query_pos = new_uri.find('?'); std::string::iterator begin = std::string::npos == query_pos ? new_uri.end() : new_uri.begin() + query_pos + 1; std::string::iterator end = new_uri.end(); if (!boost::spirit::qi::parse(begin, end, p, output)) { // throw an error here if non-parsing is considered erroneous } return output; } ********************************************** Used like this ********************************************************** string object; const size_t query_pos = request.uri.find('?'); if(not request.uri.empty()) // if we have a uri { object.assign(*request.uri.begin() == '/' ? ++request.uri.begin() : request.uri.begin(), std::string::npos == query_pos ? request.uri.end() : request.uri.begin() + query_pos); } std::map<std::string, std::string> args; parse_http_query(request.uri, args); ************************************************** I think it's mostly derived from some Spirit examples somebody found somewhere. Erik ---------------------------------------------------------------------- This message w/attachments (message) is intended solely for the use of the intended recipient(s) and may contain information that is privileged, confidential or proprietary. If you are not an intended recipient, please notify the sender, and then please delete and destroy all copies and attachments, and be advised that any review or dissemination of, or the taking of any action in reliance on, the information contained in or attached to this message is prohibited. Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Sender. Subject to applicable law, Sender may intercept, monitor, review and retain e-communications (EC) traveling through its networks/systems and may produce any such EC to regulators, law enforcement, in litigation and as required by law. The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be secure or free of errors or viruses. References to "Sender" are references to any subsidiary of Bank of America Corporation. Securities and Insurance Products: * Are Not FDIC Insured * Are Not Bank Guaranteed * May Lose Value * Are Not a Bank Deposit * Are Not a Condition to Any Banking Service or Activity * Are Not Insured by Any Federal Government Agency. Attachments that are part of this EC may have additional important disclosures and disclaimers, which you should read. This message is subject to terms available at the following link: http://www.bankofamerica.com/emaildisclaimer. By messaging with Sender you consent to the foregoing. |
From: David H. <dav...@gm...> - 2011-01-11 16:59:58
|
On Tue, Jan 11, 2011 at 9:51 AM, Dean Michael Berris <mik...@gm... > wrote: > On Wed, Jan 12, 2011 at 12:26 AM, David Hite <dav...@gm...> wrote: > > Hello, > > I am trying to parse the incoming query in a request to the synchronous > > server. I see that there is a "query" method on the HTTP Normal Client > > Request but not the Pod Server Request. I can't find any example of the > > server request query parameters. > > > > Is there a simple way to pull out the "?" query portion of the uri? > > > > I am able to get the destination(request) method to work and could do > some > > string parsing but I figured there is a better way... > > > > David, I'm afraid parsing the query string on your own would be the > way to go at the moment. It shouldn't be too hard to do with either > Boost.Regex or Boost.Xpressive (if you're adventurous using > Boost.Spirit would be a good exercise too). > > I was planning to work on some of these utilities to be made part of a > beginnings of a web library (note, not a framework) but I ran into > some time sucks (work, family, and contributing to larger open source > projects like Boost) preventing me from making progress in that front. > > I remember someone else in the list wanted this as a features, and if > you can file it in http://github.com/cpp-netlib/cpp-netlib/issues I > promise I'll get to it soon as I get time to do it. > > Thanks and I'm sorry I couldn't be much help on this one. > > -- > Dean Michael Berris > about.me/deanberris > > > ------------------------------------------------------------------------------ > Protect Your Site and Customers from Malware Attacks > Learn about various malware tactics and how to avoid them. Understand > malware threats, the impact they can have on your business, and how you > can protect your company and customers by using code signing. > http://p.sf.net/sfu/oracle-sfdevnl > _______________________________________________ > Cpp-netlib-devel mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cpp-netlib-devel > No problem! Good to know I wasn't missing something. -Dave |
From: Dean M. B. <mik...@gm...> - 2011-01-11 16:51:35
|
On Wed, Jan 12, 2011 at 12:26 AM, David Hite <dav...@gm...> wrote: > Hello, > I am trying to parse the incoming query in a request to the synchronous > server. I see that there is a "query" method on the HTTP Normal Client > Request but not the Pod Server Request. I can't find any example of the > server request query parameters. > > Is there a simple way to pull out the "?" query portion of the uri? > > I am able to get the destination(request) method to work and could do some > string parsing but I figured there is a better way... > David, I'm afraid parsing the query string on your own would be the way to go at the moment. It shouldn't be too hard to do with either Boost.Regex or Boost.Xpressive (if you're adventurous using Boost.Spirit would be a good exercise too). I was planning to work on some of these utilities to be made part of a beginnings of a web library (note, not a framework) but I ran into some time sucks (work, family, and contributing to larger open source projects like Boost) preventing me from making progress in that front. I remember someone else in the list wanted this as a features, and if you can file it in http://github.com/cpp-netlib/cpp-netlib/issues I promise I'll get to it soon as I get time to do it. Thanks and I'm sorry I couldn't be much help on this one. -- Dean Michael Berris about.me/deanberris |
From: David H. <dav...@gm...> - 2011-01-11 16:26:55
|
Hello, I am trying to parse the incoming query in a request to the synchronous server. I see that there is a "query" method on the HTTP Normal Client Request but not the Pod Server Request. I can't find any example of the server request query parameters. Is there a simple way to pull out the "?" query portion of the uri? I am able to get the destination(request) method to work and could do some string parsing but I figured there is a better way... Thanks, -Dave- |
From: Dean M. B. <mik...@gm...> - 2011-01-11 05:09:38
|
On Tue, Jan 11, 2011 at 1:05 PM, David Hite <dav...@gm...> wrote: > > Dean, > I got it to work! Cool! > Here's the code that works: > // These are my defs for namespace & server type > namespace http = boost::network::http; > typedef http::server<CgiServer> Server; > > http::request_header<http::tags::http_server> content_type = > {"Content-Type", "application/vnd.google-earth.kml+xml"}; > // set message in response > response = Server::response::stock_reply(Server::response::ok, kml_string); > response.headers.push_back( content_type ); Ah, yes, the tags are in the http namespace. I really should fix that with an example. :) > Thanks for your help! You're welcome! :) -- Dean Michael Berris about.me/deanberris |
From: David H. <dav...@gm...> - 2011-01-11 05:05:08
|
On Mon, Jan 10, 2011 at 8:35 PM, Dean Michael Berris <mik...@gm... > wrote: > On Tue, Jan 11, 2011 at 5:40 AM, David Hite <dav...@gm...> wrote: > > Hey Dean, > > Thanks for the quick reply. > > You're welcome. :) > > > I can't find the example you are talking about... i'm using 0.8 version. > > > > Ah, yes, the example is only in 0.9-devel at the moment and will be > coming out in 0.9 (beta coming within the week). > > > I'm also getting some compile errors when I try to push the content-type > > header on the response.headers > > > > Here's my code: > > > > Server::response_header content_type = {"Content-Type", > > "application/vnd.google-earth.kml+xml"}; > > > > // set message in response > > response = Server::response::stock_reply(Server::response::ok, > > kml_string); > > > > // set MIME type for response > > response.headers.push_back( content_type ); > > > > And here's my error: > > > > error: no matching function for call to > > > 'std::vector<boost::network::http::request_header<boost::network::http::tags::http_server>, > > > std::allocator<boost::network::http::request_header<boost::network::http::tags::http_server> > >> > > >>::push_back(boost::network::http::response_header<boost::network::http::tags::http_server>&)' > > /usr/include/c++/4.4/bits/stl_vector.h:733: note: candidates are: void > > std::vector<_Tp, _Alloc>::push_back(const _Tp&) [with _Tp = > > > boost::network::http::request_header<boost::network::http::tags::http_server>, > > _Alloc = > > > std::allocator<boost::network::http::request_header<boost::network::http::tags::http_server> > >>] > > > > These error messages are impossible to decipher... any ideas? > > Ah, it actually just says that you can't push a `response_header<...>` > into a vector of `request_header<...>`. I remember this being > something I fixed in the 0.9-devel branch and which is an oversight on > my part in 0.8. > > > The only candidate function it's listing is using > > boost::network::http::request_header. I tried that too and no dice. > > > > Code like this should work: > > boost::network::http::request_header<boost::network::tags::http_server> > content_type = {"Content-Type", > "application/vnd.google-earth.kml+xml"}; > response.push_back(content_type); > > If that still doesn't work, let me know because that would be a serious > problem. > > Have a good one and I hope this helps. > > (Also, please try not to top-post :D) > > -- > Dean Michael Berris > about.me/deanberris > > > ------------------------------------------------------------------------------ > Gaining the trust of online customers is vital for the success of any > company > that requires sensitive data to be transmitted over the Web. Learn how to > best implement a security strategy that keeps consumers' information secure > and instills the confidence they need to proceed with transactions. > http://p.sf.net/sfu/oracle-sfdevnl > _______________________________________________ > Cpp-netlib-devel mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cpp-netlib-devel > Dean, I got it to work! Here's the code that works: // These are my defs for namespace & server type namespace http = boost::network::http; typedef http::server<CgiServer> Server; http::request_header<http::tags::http_server> content_type = {"Content-Type", "application/vnd.google-earth.kml+xml"}; // set message in response response = Server::response::stock_reply(Server::response::ok, kml_string); response.headers.push_back( content_type ); Thanks for your help! -Dave- |
From: Dean M. B. <mik...@gm...> - 2011-01-11 03:36:02
|
On Tue, Jan 11, 2011 at 5:40 AM, David Hite <dav...@gm...> wrote: > Hey Dean, > Thanks for the quick reply. You're welcome. :) > I can't find the example you are talking about... i'm using 0.8 version. > Ah, yes, the example is only in 0.9-devel at the moment and will be coming out in 0.9 (beta coming within the week). > I'm also getting some compile errors when I try to push the content-type > header on the response.headers > > Here's my code: > > Server::response_header content_type = {"Content-Type", > "application/vnd.google-earth.kml+xml"}; > > // set message in response > response = Server::response::stock_reply(Server::response::ok, > kml_string); > > // set MIME type for response > response.headers.push_back( content_type ); > > And here's my error: > > error: no matching function for call to > 'std::vector<boost::network::http::request_header<boost::network::http::tags::http_server>, > std::allocator<boost::network::http::request_header<boost::network::http::tags::http_server> >> >>::push_back(boost::network::http::response_header<boost::network::http::tags::http_server>&)' > /usr/include/c++/4.4/bits/stl_vector.h:733: note: candidates are: void > std::vector<_Tp, _Alloc>::push_back(const _Tp&) [with _Tp = > boost::network::http::request_header<boost::network::http::tags::http_server>, > _Alloc = > std::allocator<boost::network::http::request_header<boost::network::http::tags::http_server> >>] > > These error messages are impossible to decipher... any ideas? Ah, it actually just says that you can't push a `response_header<...>` into a vector of `request_header<...>`. I remember this being something I fixed in the 0.9-devel branch and which is an oversight on my part in 0.8. > The only candidate function it's listing is using > boost::network::http::request_header. I tried that too and no dice. > Code like this should work: boost::network::http::request_header<boost::network::tags::http_server> content_type = {"Content-Type", "application/vnd.google-earth.kml+xml"}; response.push_back(content_type); If that still doesn't work, let me know because that would be a serious problem. Have a good one and I hope this helps. (Also, please try not to top-post :D) -- Dean Michael Berris about.me/deanberris |
From: David H. <dav...@gm...> - 2011-01-10 21:41:00
|
Hey Dean, Thanks for the quick reply. I can't find the example you are talking about... i'm using 0.8 version. I'm also getting some compile errors when I try to push the content-type header on the response.headers Here's my code: Server::response_header content_type = {"Content-Type", "application/vnd.google-earth.kml+xml"}; // set message in response response = Server::response::stock_reply(Server::response::ok, kml_string); // set MIME type for response response.headers.push_back( content_type ); And here's my error: error: no matching function for call to 'std::vector<boost::network::http::request_header<boost::network::http::tags::http_server>, std::allocator<boost::network::http::request_header<boost::network::http::tags::http_server> > >::push_back(boost::network::http::response_header<boost::network::http::tags::http_server>&)' /usr/include/c++/4.4/bits/stl_vector.h:733: note: candidates are: void std::vector<_Tp, _Alloc>::push_back(const _Tp&) [with _Tp = boost::network::http::request_header<boost::network::http::tags::http_server>, _Alloc = std::allocator<boost::network::http::request_header<boost::network::http::tags::http_server> >] These error messages are impossible to decipher... any ideas? The only candidate function it's listing is using boost::network::http::request_header. I tried that too and no dice. -Dave- On Sun, Jan 9, 2011 at 9:41 PM, Dean Michael Berris <mik...@gm...>wrote: > Hi David, > > On Mon, Jan 10, 2011 at 5:32 AM, David Hite <dav...@gm...> wrote: > > Howdy all, > > I've just started working with cpp-netlib and I am trying to get an HTTP > > server (not asynchronous) working with different mime Content-Types. > > I see that the FileServer example sets the mime-type for different > responses > > in the asynchronous server connection_ptr but I can't get anything like > it > > to work for a simple synchronous server response. > > Can anyone give an example of how to set the Content-Type header for a > > simple synchronous server response? > > Certainly. If you look in > libs/network/test/http/server_hello_world.cpp there is an example of > setting the headers for the response of a synchronous HTTP server. > What you'll need to remember is that the response object passed by > lvalue reference to the handler has a member named `headers` where you > would put all the headers you want. > > In your handler's operator() overload, you would have something like this: > > server::response::header_type content_type = {"Content-Type", > "application/octet-stream"}; > response.headers.push_back(content_type); > > This is at least true for the version in the 0.9-devel branch. If > you're on 0.8, you would need code that looks like this: > > server::response_header content_type = {"Content-Type", > "application/octet-stream"}; > response.headers.push_back(content_type); > > > > Thanks, > > -Dave- > > I hope this helps! > > -- > Dean Michael Berris > about.me/deanberris > > > ------------------------------------------------------------------------------ > Gaining the trust of online customers is vital for the success of any > company > that requires sensitive data to be transmitted over the Web. Learn how to > best implement a security strategy that keeps consumers' information secure > and instills the confidence they need to proceed with transactions. > http://p.sf.net/sfu/oracle-sfdevnl > _______________________________________________ > Cpp-netlib-devel mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cpp-netlib-devel > |
From: Dean M. B. <mik...@gm...> - 2011-01-10 04:41:42
|
Hi David, On Mon, Jan 10, 2011 at 5:32 AM, David Hite <dav...@gm...> wrote: > Howdy all, > I've just started working with cpp-netlib and I am trying to get an HTTP > server (not asynchronous) working with different mime Content-Types. > I see that the FileServer example sets the mime-type for different responses > in the asynchronous server connection_ptr but I can't get anything like it > to work for a simple synchronous server response. > Can anyone give an example of how to set the Content-Type header for a > simple synchronous server response? Certainly. If you look in libs/network/test/http/server_hello_world.cpp there is an example of setting the headers for the response of a synchronous HTTP server. What you'll need to remember is that the response object passed by lvalue reference to the handler has a member named `headers` where you would put all the headers you want. In your handler's operator() overload, you would have something like this: server::response::header_type content_type = {"Content-Type", "application/octet-stream"}; response.headers.push_back(content_type); This is at least true for the version in the 0.9-devel branch. If you're on 0.8, you would need code that looks like this: server::response_header content_type = {"Content-Type", "application/octet-stream"}; response.headers.push_back(content_type); > Thanks, > -Dave- I hope this helps! -- Dean Michael Berris about.me/deanberris |
From: Raindog <ra...@ma...> - 2011-01-09 23:44:03
|
On 1/9/2011 1:32 PM, David Hite wrote: > Howdy all, > > I've just started working with cpp-netlib and I am trying to get an > HTTP server (not asynchronous) working with different mime Content-Types. > > I see that the FileServer example sets the mime-type for different > responses in the asynchronous server connection_ptr but I can't get > anything like it to work for a simple synchronous server response. > > Can anyone give an example of how to set the Content-Type header for a > simple synchronous server response? > > Thanks, > -Dave- http_client_t::request login_req(url); http_client_t client; login_req << net::header("Content-Length", boost::lexical_cast<std::string>(auth_string.length())); login_req << net::header("Content-Type", "application/x-www-form-urlencoded"); login_req << net::body(auth_string); http_client_t::response auth_resp = client.post(login_req); |
From: David H. <dav...@gm...> - 2011-01-09 21:32:22
|
Howdy all, I've just started working with cpp-netlib and I am trying to get an HTTP server (not asynchronous) working with different mime Content-Types. I see that the FileServer example sets the mime-type for different responses in the asynchronous server connection_ptr but I can't get anything like it to work for a simple synchronous server response. Can anyone give an example of how to set the Content-Type header for a simple synchronous server response? Thanks, -Dave- |
From: Chatsiri R. <ins...@gm...> - 2011-01-04 01:49:24
|
On Sat, Jan 1, 2011 at 11:43 PM, Dean Michael Berris <mik...@gm... > wrote: > That's pretty much it. :) Happy New Year Everyone! :D > > -- > Dean Michael Berris > about.me/deanberris > > > ------------------------------------------------------------------------------ > Learn how Oracle Real Application Clusters (RAC) One Node allows customers > to consolidate database storage, standardize their database environment, > and, > should the need arise, upgrade to a full multi-node Oracle RAC database > without downtime or disruption > http://p.sf.net/sfu/oracle-sfdevnl > _______________________________________________ > Cpp-netlib-devel mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cpp-netlib-devel > Happy new year :D -- :-------------------------------------------------------- http://about.me/chatsiri.ratana |
From: Dean M. B. <mik...@gm...> - 2011-01-02 10:07:01
|
On Sun, Jan 2, 2011 at 2:37 AM, Raindog <ra...@ma...> wrote: > On 1/1/2011 9:00 AM, Dean Michael Berris wrote: >> >> * Documentation -- please, if you have example use cases that you want >> to contribute, now is the time to contribute them. If you have real >> world use cases where you're actually using cpp-netlib, now would be a >> good time to have your use case highlighted in the documentation. > > Why not use the boost documentation toolchain to generate documentation > with the look and feel of the current boost docs? > There's a reasoning for that, and it mostly has to do with better tool support. If you've actually tried dealing with the documentation tool chain for Boost (quickbook, docbook, etc.) then you'll see what I mean. There are also other Boost libraries that rely on RST instead of quickbook that produce similar if not better documentation output that quickbook+etc. produce. Also, the documentation used to be in Quickbook and it got harder and harder to maintain. Eventually Glyn (who was mostly writing the documentation) and I (mostly wanting to contribute to the documentation effort more) decided that continuing with Quickbook+BoostBook wasn't a good use of our time, and switched to a much easier input format in RST, and Glyn played around with Sphinx to generate the documentation in a sartisfactory manner. If you want to move back to Quickbook, that effort would be welcome -- and if someone wants to take on the documentation effort from Glyn and I please let us know what to expect as well. We'll look forward to your contributions as pull requests. ;) Have a good one and I hope this answers the question satisfactorily. -- Dean Michael Berris about.me/deanberris |
From: Raindog <ra...@ma...> - 2011-01-01 18:37:04
|
On 1/1/2011 9:00 AM, Dean Michael Berris wrote: > Hi Guys! > > (Apologies in advance for the cross-post) > > I've just pushed the master, 0.8-devel, and 0.9-devel branch onto the > cpp-netlib repository -- please take the time to test all these > branches as I work on getting the documentation up to speed on the > 0.9-devel branch preparing for the release and submission for review > on the Boost developers mailing list. I'm also welcoming contributions > in the form of: > > * Website help, the current documentation look is OK, but if you have > time to fix up some of the issues like the fonts, adding anchors and > maybe reformatting the API pages so that it's easier indexed, that > would be *sweet*. Also, we need a landing page on > cpp-netlib.github.com which introduces the library, hosts stats, and > maybe has other goodies that are specifically for a website and not > necessarily for documentation. > > * Documentation -- please, if you have example use cases that you want > to contribute, now is the time to contribute them. If you have real > world use cases where you're actually using cpp-netlib, now would be a > good time to have your use case highlighted in the documentation. Why not use the boost documentation toolchain to generate documentation with the look and feel of the current boost docs? |
From: Dean M. B. <mik...@gm...> - 2011-01-01 17:00:53
|
Hi Guys! (Apologies in advance for the cross-post) I've just pushed the master, 0.8-devel, and 0.9-devel branch onto the cpp-netlib repository -- please take the time to test all these branches as I work on getting the documentation up to speed on the 0.9-devel branch preparing for the release and submission for review on the Boost developers mailing list. I'm also welcoming contributions in the form of: * Website help, the current documentation look is OK, but if you have time to fix up some of the issues like the fonts, adding anchors and maybe reformatting the API pages so that it's easier indexed, that would be *sweet*. Also, we need a landing page on cpp-netlib.github.com which introduces the library, hosts stats, and maybe has other goodies that are specifically for a website and not necessarily for documentation. * Documentation -- please, if you have example use cases that you want to contribute, now is the time to contribute them. If you have real world use cases where you're actually using cpp-netlib, now would be a good time to have your use case highlighted in the documentation. * More string implementations -- currently I need help with supporting Qt strings, MS CString, and wide strings in the implementation of the HTTP Clients. Those who are using wide strings and unicode strings natively and who have more experience with them (I only ever deal with the "C" locale) would be most welcome to contribute to getting the HTTP client to either do conversions or natively support different string implementations. I can help with the integration part by introducing the extension points that may not be obvious from the design (as it is still largely undocumented). * Examples -- the current set of examples are a little trivial, and if you have some interesting examples you want to build on (or would like to implement some of the examples highlighted here: https://github.com/cpp-netlib/cpp-netlib/issues/labels/Examples) your contribution would be most welcome. There are some things that I've pushed out for later releases, as I would like to concentrate at the moment to making the HTTP implementations more robust and support a wider range of use-cases. I'm looking for people with experience with ESMTP 1.0 who would like to contribute to implementing a simple client implementation that we can build along the same design as the HTTP client implementation. There's already a MIME parser/generator library in cpp-netlib thanks to Marshall Clow (which he presented in BoostCon 2010) also being developed for inclusion into Boost -- hopefully we can get that baked into the ESMTP client implementation early on to make it more immediately useful. At any rate, please expect a slightly delayed release of 0.9 which would be the first release which defaults to non-header-only, while 0.8.1 will be the first patch update version for 0.8. Appropriate changelogs to follow as soon as the releases are ready. In the meantime, please feel free to test out the code already in GitHub: http://github.com/cpp-netlib/cpp-netlib/ -- the stabilization effort for 0.9 and 0.8.1 will happen on this repository. Feedback would be most appreciated. Thanks everyone! -- Dean Michael Berris about.me/deanberris |
From: Dean M. B. <mik...@gm...> - 2011-01-01 16:43:51
|
That's pretty much it. :) Happy New Year Everyone! :D -- Dean Michael Berris about.me/deanberris |
From: Dean M. B. <mik...@gm...> - 2010-12-28 05:14:52
|
On Tue, Dec 28, 2010 at 3:32 AM, Raindog <ra...@ma...> wrote: > On 12/26/2010 5:28 PM, Dean Michael Berris wrote: >> >> That said, I already have an incremental parser in the library for >> both requests and responses. I don't see why I'll need another >> implementation in there. ;) >> >> /me was secretly hoping that it was written in Spirit. :P >> >> Thanks again Jeroen, I'll think more about it. >> > If his test cases are complete, it would be a nice way to test cpp-netlib. > Yeah, but... if it's licensed under a non-BSL compatible license then I'm not entirely sure that even the test cases would be usable in cpp-netlib. I'll look at it more at a later time. -- Dean Michael Berris about.me/deanberris |