Changeset 18995
- Timestamp:
- 04/10/18 09:38:20 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/rainsensor.cc
r18993 r18995 185 185 void PostRequest() 186 186 { 187 const string auth = fAuthentication.empty() ? "" : 188 "Authorization: Basic "+fAuthentication+"\r\n"; 189 187 190 const string cmd = 188 191 "GET "+fSite+" HTTP/1.1\r\n" 189 192 "Accept: */*\r\n" 190 193 "Content-Type: application/octet-stream\r\n" 191 "Authorization: Basic "+fAuthentication+"\r\n"194 +auth+ 192 195 "User-Agent: FACT\r\n" 193 196 "Host: www.fact-project.org\r\n" … … 287 290 void SetAuthentication(const string &user, const string &password) 288 291 { 292 if (user.empty() && password.empty()) 293 { 294 fAuthentication = ""; 295 return; 296 } 297 289 298 const string auth = user+":"+password; 290 299 … … 437 446 int EvalOptions(Configuration &conf) 438 447 { 448 const string user = conf.Has("user") ? conf.Get<string>("user") : ""; 449 const string pass = conf.Has("password") ? conf.Get<string>("password") : ""; 450 439 451 fRain.SetInterval(conf.Get<uint16_t>("interval")); 440 452 fRain.SetDebugTx(conf.Get<bool>("debug-tx")); … … 442 454 fRain.SetSite(conf.Get<string>("url")); 443 455 fRain.SetEndpoint(conf.Get<string>("addr")); 444 fRain.SetAuthentication( conf.Get<string>("user"), conf.Get<string>("password"));456 fRain.SetAuthentication(user, pass); 445 457 fRain.StartConnect(); 446 458 … … 468 480 ("no-dim,d", po_switch(), "Disable dim services") 469 481 ("addr,a", var<string>("www.magic.iac.es:80"), "Network address of Cosy") 470 ("url,u", var<string>("/site/weather/ protected/current.json"), "File name and path to load")482 ("url,u", var<string>("/site/weather/rain_current.json"), "File name and path to load") 471 483 ("quiet,q", po_bool(true), "Disable printing contents of all received messages (except dynamic data) in clear text.") 472 484 ("interval,i", var<uint16_t>(60), "Interval between two updates on the server in seconds") 473 485 ("debug-tx", po_bool(), "Enable debugging of ethernet transmission.") 474 486 ("debug-rx", po_bool(), "Enable debugging of ethernet receptions.") 475 ("user", var<string>( "FACT")->required(), "User name for authentication.")476 ("password", var<string>() ->required(), "Password for authentication.")487 ("user", var<string>(), "User name for authentication.") 488 ("password", var<string>(), "Password for authentication.") 477 489 ; 478 490
Note:
See TracChangeset
for help on using the changeset viewer.