+For SRU responses allow Content-Type application/xml as well as text/xml.
+
--- 3.0.4 2007/05/21
Fixed bug in character set conversion of BER strings. Bug introduced
* Copyright (C) 1995-2007, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: client.c,v 1.338 2007-05-08 08:22:35 adam Exp $
+ * $Id: client.c,v 1.339 2007-05-23 11:54:46 adam Exp $
*/
/** \file client.c
* \brief yaz-client program
static void http_response(Z_HTTP_Response *hres)
{
int ret = -1;
- const char *content_type = z_HTTP_header_lookup(hres->headers,
- "Content-Type");
const char *connection_head = z_HTTP_header_lookup(hres->headers,
"Connection");
- if (content_type && !yaz_strcmp_del("text/xml", content_type, "; "))
+ if (!yaz_srw_check_content_type(hres))
+ printf("Content type does not appear to be XML");
+ else
{
Z_SOAP *soap_package = 0;
ODR o = odr_createmem(ODR_DECODE);
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/* $Id: srw.h,v 1.33 2007-01-03 08:42:14 adam Exp $ */
+/* $Id: srw.h,v 1.34 2007-05-23 11:54:47 adam Exp $ */
/**
* \file srw.h
#define YAZ_XMLNS_DIAG_v1_1 "http://www.loc.gov/zing/srw/diagnostic/"
#define YAZ_XMLNS_UPDATE_v0_9 "http://www.loc.gov/zing/srw/update/"
+YAZ_EXPORT
+int yaz_srw_check_content_type(Z_HTTP_Response *hres);
+
YAZ_END_CDECL
#endif
* Copyright (C) 1995-2007, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: srwutil.c,v 1.56 2007-05-06 20:12:20 adam Exp $
+ * $Id: srwutil.c,v 1.57 2007-05-23 11:54:47 adam Exp $
*/
/**
* \file srwutil.c
return olen;
}
+int yaz_srw_check_content_type(Z_HTTP_Response *hres)
+{
+ const char *content_type = z_HTTP_header_lookup(hres->headers,
+ "Content-Type");
+ if (content_type)
+ {
+ if (!yaz_strcmp_del("text/xml", content_type, "; "))
+ return 1;
+ if (!yaz_strcmp_del("application/xml", content_type, "; "))
+ return 1;
+ }
+ return 0;
+}
+
/**
* Look for authentication tokens in HTTP Basic parameters or in x-username/x-password
* parameters. Added by SH.
* Copyright (C) 1995-2007, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: zoom-c.c,v 1.130 2007-05-08 08:22:36 adam Exp $
+ * $Id: zoom-c.c,v 1.131 2007-05-23 11:54:47 adam Exp $
*/
/**
* \file zoom-c.c
odr_prepend(c->odr_out, "ZOOM-C",
ireq->implementationName));
- version = odr_strdup(c->odr_out, "$Revision: 1.130 $");
+ version = odr_strdup(c->odr_out, "$Revision: 1.131 $");
if (strlen(version) > 10) /* check for unexpanded CVS strings */
version[strlen(version)-2] = '\0';
ireq->implementationVersion =
static void handle_http(ZOOM_connection c, Z_HTTP_Response *hres)
{
int ret = -1;
- const char *content_type = z_HTTP_header_lookup(hres->headers,
- "Content-Type");
+ const char *addinfo = 0;
const char *connection_head = z_HTTP_header_lookup(hres->headers,
"Connection");
ZOOM_connection_set_mask(c, 0);
yaz_log(log_details, "%p handle_http", c);
-
- if (content_type && !yaz_strcmp_del("text/xml", content_type, "; "))
+
+ if (!yaz_srw_check_content_type(hres))
+ addinfo = "content-type";
+ else
{
Z_SOAP *soap_package = 0;
ODR o = c->odr_in;
if (hres->code != 200)
set_HTTP_error(c, hres->code, 0, 0);
else
- set_ZOOM_error(c, ZOOM_ERROR_DECODE, 0);
+ set_ZOOM_error(c, ZOOM_ERROR_DECODE, addinfo);
do_close(c);
}
ZOOM_connection_remove_task(c);