+
+
+
+// int ret_code = 2; /* 2=NOT TAKEN, 1=TAKEN, 0=SOAP TAKEN */
+// Z_SRW_PDU *sru_res = 0;
+// Z_SOAP *soap_package = 0;
+// char *charset = 0;
+// Z_SRW_diagnostic *diagnostic = 0;
+// int num_diagnostic = 0;
+// mp::odr odr;
+
+// if (!(ret_code = yaz_sru_decode(http_req, &sru_res,
+// &soap_package, odr, &charset,
+// &diagnostic, &num_diagnostic)))
+// {
+// protocol = "SRU GET/POST";
+// }
+// else if (!(ret_code = yaz_srw_decode(http_req, &sru_res,
+// &soap_package, odr, &charset)))
+// {
+// protocol = "SRU SOAP";
+// }
+// else
+// {
+// protocol = "HTTP";
+// }
+
+ std::string protocol("HTTP");
+
+ const std::string mime_text_xml("text/xml");
+ const std::string mime_soap_xml("application/soap+xml");
+ const std::string mime_urlencoded("application/x-www-form-urlencoded");
+
+ const std::string http_method(http_req->method);
+ const std::string http_type(z_HTTP_header_lookup(http_req->headers,
+ "Content-Type"));
+
+
+ if (http_method == "GET")
+ protocol = "SRU GET";
+ else if ( http_method == "POST"
+ && http_type == mime_urlencoded)
+ protocol = "SRU POST";
+ else if ( http_method == "POST"
+ && (http_type == mime_text_xml
+ || http_type == mime_soap_xml))
+ protocol = "SRU SOAP";
+
+ std::cout << "SRUtoZ3950 " << protocol << "\n";
+
+ package.move();
+ return;
+
+
+
+ std::string message("<html>\n<body>\n<h1>"
+ "Metaproxy SRUtoZ3950 filter"
+ "</h1>\n");
+
+ message += "<h3>HTTP Info</h3><br/>\n";
+ message += "<p>\n";
+ message += "<b>Method: </b> " + std::string(http_req->method) + "<br/>\n";
+ message += "<b>Version:</b> " + std::string(http_req->version) + "<br/>\n";
+ message += "<b>Path: </b> " + std::string(http_req->path) + "<br/>\n";
+ message += "<b>Content-Type:</b>"
+ + std::string(z_HTTP_header_lookup(http_req->headers, "Content-Type"))
+ + "<br/>\n";
+ message += "<b>Content-Length:</b>"
+ + std::string(z_HTTP_header_lookup(http_req->headers,
+ "Content-Length"))
+ + "<br/>\n";
+ message += "</p>\n";
+
+ message += "<h3>Headers</h3><br/>\n";
+ message += "<p>\n";
+ Z_HTTP_Header* header = http_req->headers;
+ while (header){
+ message += "<b>Header: </b> <i>"
+ + std::string(header->name) + ":</i> "
+ + std::string(header->value) + "<br/>\n";
+ header = header->next;
+ }
+ message += "</p>\n";
+ message += "</body>\n</html>\n";
+
+ //std::cout << message << "\n";
+
+