From 30ef6714ab770d6dfc07855cc226bc8aab8cada4 Mon Sep 17 00:00:00 2001 From: Thierry Louge Date: Fri, 20 Nov 2015 12:48:19 +0100 Subject: [PATCH] GVOHub send url containing get_fits method. It detects http get_fits method call and returning is ont he way --- src/vo/GVOHub.cpp | 63 +++++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/src/vo/GVOHub.cpp b/src/vo/GVOHub.cpp index 633a813..8922b7d 100644 --- a/src/vo/GVOHub.cpp +++ b/src/vo/GVOHub.cpp @@ -430,11 +430,33 @@ void GVOHub::handle_request(const socklen_t& sock) // Extract response into an XML object GXml xml; + size_t start_html = message.find("GET /get_fits"); + if (start_html != std::string::npos) { + #if defined(G_CONSOLE_DUMP) + std::cout << "get_fits called " << std::endl; + #endif + //Form and send here the html message containing fits file data + std::string msg =""; + msg.append("HTTP/1.1 200 OK\n"); + msg.append("Connection: open\n"); + msg.append("Content-Type: multipart/form-data\n"); + //Fixed length for tests + msg.append("Content-Length: 364\n"); + //Fixed filename for tests + msg.append("Content-Disposition: form-data; name=\"Gammalib_fits\";filename=\"/root/Skw+_Fermi_5.fits\"\n"); + post_string(msg, sock); + #if defined(G_CONSOLE_DUMP) + std::cout < methodName"); @@ -1146,13 +1168,10 @@ void GVOHub::broadcast(const GXml& xml, const socklen_t& sock) // Get message mtype std::string mtype = get_mtype(xml); #if defined(G_CONSOLE_DUMP) - std::cout<<"mtype is: " +mtype + "i value: " + gammalib::str(i)<\n"); msg.append("\n"); @@ -1750,30 +1763,24 @@ void GVOHub::send_notifications(const std::string& method, msg.append(" \n"); msg.append(" \n"); msg.append(" name\n"); - msg.append(" "); - const GXmlNode* node = xml.element("methodCall > params > param[1] > value > struct > member[1] > value"); - if (node != NULL) { - const GXmlText* text = static_cast((*node)[0]); - if (text != NULL) { - msg.append(text->text()); - } - } - msg.append("\n"); + msg.append(" Gammalib_shared_fits\n"); msg.append(" \n"); msg.append(" \n"); msg.append(" image-id\n"); - msg.append(" IMAGE_ID\n"); + msg.append(" Gammalib_shared_fits_id\n"); msg.append(" \n"); msg.append(" \n"); msg.append(" url\n"); - msg.append(" http://127.0.0.1:2526/\n"); + msg.append(" http://127.0.0.1:2526/get_fits\n"); msg.append(" \n"); msg.append(" \n"); msg.append(" \n"); msg.append(" \n"); msg.append("\n"); msg.append("\n"); - + #if defined(G_CONSOLE_DUMP) + std::cout << msg << std::endl; + #endif // Post notification notify(m_clients[i].url, msg); -- libgit2 0.21.4