|
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-
|