Overview
Features
Download
Documentation
Community
Add-Ons & Services

poco::net::HTTPRequest with user agent

A general discussion forum.

poco::net::HTTPRequest with user agent

Postby Plusplus » 14 Jun 2010, 13:20

Hello,
I need to do the following http request with the poco net library :

Code: Select all
GET /axis-cgi/com/ptz.cgi?camera=1&center=10,10
User-Agent: Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.8.1.1) Gecko/20060601 Firefox/2.0.0.1 (Ubuntu-edgy)
Host: 10.xx.xx.xx
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,


Currently, I build my http request as it shown in the poco net sample "httpGet", but I don't know how can I put the user agent with poco classes.
(...)
Code: Select all

URI uri(argv[1]);
      std::string path(uri.getPathAndQuery());
      if (path.empty()) path = "/";

      HTTPClientSession session(uri.getHost(), uri.getPort());
      HTTPRequest req(HTTPRequest::HTTP_GET, path, HTTPMessage::HTTP_1_1);
      session.sendRequest(req);

(...)
Does anyone could help me ?

Thanks.
Plusplus
 
Posts: 5
Joined: 03 Jun 2010, 13:49

Re: poco::net::HTTPRequest with user agent

Postby guenter » 14 Jun 2010, 13:25

Code: Select all
req.set("User-Agent", "Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.8.1.1) Gecko/20060601 Firefox/2.0.0.1 (Ubuntu-edgy)");
guenter
 
Posts: 1157
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: poco::net::HTTPRequest with user agent

Postby Plusplus » 14 Jun 2010, 13:36

Thanks you !
Very easy at leat... Great Poco !
Plusplus
 
Posts: 5
Joined: 03 Jun 2010, 13:49


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron