Commit ecc20c920accd72ba82fd38e701937a077f49ab2
1 parent
b7e54819
Extract proper xmlrpc path information from .samp lockfile and use this informat…
…ion to post messages.
Showing
4 changed files
with
29 additions
and
12 deletions
ChangeLog
| 1 | -2015-01-07 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu> | 1 | +2015-01-12 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu> |
| 2 | + | ||
| 3 | + * Bug fix version 0.9.2 released | ||
| 4 | + ================================ | ||
| 5 | + | ||
| 6 | + Use URL path informtion in GVOClient connection to Hub | ||
| 7 | + | ||
| 2 | 8 | ||
| 3 | * Bug fix version 0.9.1 released | 9 | * Bug fix version 0.9.1 released |
| 4 | ================================ | 10 | ================================ |
NEWS
| 1 | -New Features and Important Changes in GammaLib 00-09-01 | 1 | +New Features and Important Changes in GammaLib 00-09-02 |
| 2 | 2 | ||
| 3 | Author(s) : Juergen Knoedlseder | 3 | Author(s) : Juergen Knoedlseder |
| 4 | 4 | ||
| 5 | -7 January 2015 | 5 | +12 January 2015 |
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | 1. Introduction | 8 | 1. Introduction |
| @@ -78,7 +78,9 @@ None | @@ -78,7 +78,9 @@ None | ||
| 78 | 78 | ||
| 79 | 15. VO module | 79 | 15. VO module |
| 80 | ------------- | 80 | ------------- |
| 81 | -None | 81 | +The XMLRPC path name as found in the .samp lockfile is now used to compose |
| 82 | +the http POST message. This solves a problem when trying to connect to some | ||
| 83 | +VO tool hubs. | ||
| 82 | 84 | ||
| 83 | 85 | ||
| 84 | 16. Xspec module | 86 | 16. Xspec module |
| @@ -103,8 +105,7 @@ None | @@ -103,8 +105,7 @@ None | ||
| 103 | 105 | ||
| 104 | 20. CTA interface | 106 | 20. CTA interface |
| 105 | ----------------- | 107 | ----------------- |
| 106 | -Corrected bug #1383 that led to a unit test failure for the CTA energy dispersion | ||
| 107 | -computation on recent gcc compiler versions. | 108 | +None |
| 108 | 109 | ||
| 109 | 110 | ||
| 110 | 21. COMPTEL interface | 111 | 21. COMPTEL interface |
include/GVOClient.hpp
| @@ -98,6 +98,7 @@ protected: | @@ -98,6 +98,7 @@ protected: | ||
| 98 | std::string m_hub_url; //!< The XML-RPC endpoint for communication with the hub | 98 | std::string m_hub_url; //!< The XML-RPC endpoint for communication with the hub |
| 99 | std::string m_hub_host; //!< Hub host (extracted from XML-RPC endpoint) | 99 | std::string m_hub_host; //!< Hub host (extracted from XML-RPC endpoint) |
| 100 | std::string m_hub_port; //!< Hub port (extracted from XML-RPC endpoint) | 100 | std::string m_hub_port; //!< Hub port (extracted from XML-RPC endpoint) |
| 101 | + std::string m_hub_path; //!< Hub path (extracted from XML-RPC endpoint) | ||
| 101 | std::string m_version; //!< The version of the SAMP Standard Profile implemented by the hub | 102 | std::string m_version; //!< The version of the SAMP Standard Profile implemented by the hub |
| 102 | std::string m_client_key; //!< Private client key | 103 | std::string m_client_key; //!< Private client key |
| 103 | std::string m_hub_id; //!< Hub identifier | 104 | std::string m_hub_id; //!< Hub identifier |
src/vo/GVOClient.cpp
| @@ -291,8 +291,9 @@ std::string GVOClient::print(const GChatter& chatter) const | @@ -291,8 +291,9 @@ std::string GVOClient::print(const GChatter& chatter) const | ||
| 291 | if (has_hub()) { | 291 | if (has_hub()) { |
| 292 | result.append("\n"+gammalib::parformat("Hub key")+m_secret); | 292 | result.append("\n"+gammalib::parformat("Hub key")+m_secret); |
| 293 | result.append("\n"+gammalib::parformat("Hub URL")+m_hub_url); | 293 | result.append("\n"+gammalib::parformat("Hub URL")+m_hub_url); |
| 294 | - result.append("\n"+gammalib::parformat("Hub host (port)")); | ||
| 295 | - result.append(m_hub_host+" ("+m_hub_port+")"); | 294 | + result.append("\n"+gammalib::parformat("Hub host")+m_hub_host); |
| 295 | + result.append("\n"+gammalib::parformat("Hub port")+m_hub_port); | ||
| 296 | + result.append("\n"+gammalib::parformat("Hub path")+m_hub_path); | ||
| 296 | result.append("\n"+gammalib::parformat("SAMP protocol version")); | 297 | result.append("\n"+gammalib::parformat("SAMP protocol version")); |
| 297 | result.append(m_version); | 298 | result.append(m_version); |
| 298 | result.append("\n"+gammalib::parformat("Hub connection")); | 299 | result.append("\n"+gammalib::parformat("Hub connection")); |
| @@ -340,6 +341,7 @@ void GVOClient::init_members(void) | @@ -340,6 +341,7 @@ void GVOClient::init_members(void) | ||
| 340 | m_hub_url.clear(); | 341 | m_hub_url.clear(); |
| 341 | m_hub_host.clear(); | 342 | m_hub_host.clear(); |
| 342 | m_hub_port.clear(); | 343 | m_hub_port.clear(); |
| 344 | + m_hub_path.clear(); | ||
| 343 | m_version.clear(); | 345 | m_version.clear(); |
| 344 | m_client_key.clear(); | 346 | m_client_key.clear(); |
| 345 | m_hub_id.clear(); | 347 | m_hub_id.clear(); |
| @@ -364,6 +366,7 @@ void GVOClient::copy_members(const GVOClient& client) | @@ -364,6 +366,7 @@ void GVOClient::copy_members(const GVOClient& client) | ||
| 364 | m_hub_url = client.m_hub_url; | 366 | m_hub_url = client.m_hub_url; |
| 365 | m_hub_host = client.m_hub_host; | 367 | m_hub_host = client.m_hub_host; |
| 366 | m_hub_port = client.m_hub_port; | 368 | m_hub_port = client.m_hub_port; |
| 369 | + m_hub_path = client.m_hub_path; | ||
| 367 | m_version = client.m_version; | 370 | m_version = client.m_version; |
| 368 | m_client_key = client.m_client_key; | 371 | m_client_key = client.m_client_key; |
| 369 | m_hub_id = client.m_hub_id; | 372 | m_hub_id = client.m_hub_id; |
| @@ -463,11 +466,12 @@ bool GVOClient::find_hub(void) | @@ -463,11 +466,12 @@ bool GVOClient::find_hub(void) | ||
| 463 | // Close SAMP lockfile | 466 | // Close SAMP lockfile |
| 464 | fclose(fptr); | 467 | fclose(fptr); |
| 465 | 468 | ||
| 466 | - // Extract host and port from Hub URL | 469 | + // Extract host, port and path from Hub URL |
| 467 | if (m_hub_url.compare(0, 7, "http://") == 0) { | 470 | if (m_hub_url.compare(0, 7, "http://") == 0) { |
| 468 | size_t length; | 471 | size_t length; |
| 469 | size_t start = 7; | 472 | size_t start = 7; |
| 470 | size_t stop = m_hub_url.find(":", start); | 473 | size_t stop = m_hub_url.find(":", start); |
| 474 | + size_t end = std::string::npos; | ||
| 471 | if (stop != std::string::npos) { | 475 | if (stop != std::string::npos) { |
| 472 | length = stop - start; | 476 | length = stop - start; |
| 473 | } | 477 | } |
| @@ -476,8 +480,8 @@ bool GVOClient::find_hub(void) | @@ -476,8 +480,8 @@ bool GVOClient::find_hub(void) | ||
| 476 | } | 480 | } |
| 477 | m_hub_host = m_hub_url.substr(start, length); | 481 | m_hub_host = m_hub_url.substr(start, length); |
| 478 | if (stop != std::string::npos) { | 482 | if (stop != std::string::npos) { |
| 479 | - stop = stop + 1; | ||
| 480 | - size_t end = m_hub_url.find("/", stop); | 483 | + stop++; |
| 484 | + end = m_hub_url.find("/", stop); | ||
| 481 | if (end != std::string::npos) { | 485 | if (end != std::string::npos) { |
| 482 | length = end - stop; | 486 | length = end - stop; |
| 483 | } | 487 | } |
| @@ -486,6 +490,11 @@ bool GVOClient::find_hub(void) | @@ -486,6 +490,11 @@ bool GVOClient::find_hub(void) | ||
| 486 | } | 490 | } |
| 487 | m_hub_port = m_hub_url.substr(stop, length); | 491 | m_hub_port = m_hub_url.substr(stop, length); |
| 488 | } | 492 | } |
| 493 | + if (end != std::string::npos) { | ||
| 494 | + end++; | ||
| 495 | + length = m_hub_url.length() - end; | ||
| 496 | + m_hub_path = m_hub_url.substr(end, length); | ||
| 497 | + } | ||
| 489 | } | 498 | } |
| 490 | 499 | ||
| 491 | // Check for existence of mandatory tokens | 500 | // Check for existence of mandatory tokens |
| @@ -850,7 +859,7 @@ void GVOClient::post_string(const std::string& content) const | @@ -850,7 +859,7 @@ void GVOClient::post_string(const std::string& content) const | ||
| 850 | int length = content.length(); | 859 | int length = content.length(); |
| 851 | 860 | ||
| 852 | // Set prefix | 861 | // Set prefix |
| 853 | - std::string prefix = "POST /xmlrpc HTTP/1.0\n" | 862 | + std::string prefix = "POST /"+m_hub_path+" HTTP/1.0\n" |
| 854 | "User-Agent: GammaLib\n" | 863 | "User-Agent: GammaLib\n" |
| 855 | "Content-Type: text/xml\n" | 864 | "Content-Type: text/xml\n" |
| 856 | "Content-Length: "+gammalib::str(length)+"\n\n"; | 865 | "Content-Length: "+gammalib::str(length)+"\n\n"; |