X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;ds=sidebyside;f=src%2Fhttp.c;h=0fb1434c37d3d0f0a24fd389e5038dd5165b3adb;hb=d6717ba6822aea328e4a456edcf0318261cdc175;hp=3d62fcd2ee8683da9d56c729f08bd58f8409231c;hpb=3576736bac485d8f04b2fc4f6b5cfcef7576d741;p=yaz-moved-to-github.git diff --git a/src/http.c b/src/http.c index 3d62fcd..0fb1434 100644 --- a/src/http.c +++ b/src/http.c @@ -1,19 +1,20 @@ -/* - * Copyright (C) 1995-2007, Index Data ApS +/* This file is part of the YAZ toolkit. + * Copyright (C) 1995-2011 Index Data * See the file LICENSE for details. - * - * $Id: http.c,v 1.4 2007-11-30 11:44:47 adam Exp $ */ - /** * \file http.c * \brief Implements HTTP decoding */ +#if HAVE_CONFIG_H +#include +#endif #include #include #include #include +#include #include #ifdef WIN32 @@ -232,6 +233,8 @@ void z_HTTP_header_add_basic_auth(ODR o, Z_HTTP_Header **hp, if (username == 0) return; + if (password == 0) + password = ""; len = strlen(username) + strlen(password); tmp = (char *) odr_malloc(o, len+2); @@ -334,20 +337,21 @@ Z_GDU *z_get_HTTP_Response(ODR o, int code) if (code != 200) { hres->content_buf = (char*) odr_malloc(o, 400); - sprintf (hres->content_buf, - "\n" - "\n" - " \n" - " YAZ " YAZ_VERSION "\n" - " \n" - " \n" - "

YAZ " - YAZ_VERSION "

\n" - "

Error: %d

\n" - "

Description: %.50s

\n" - " \n" - "\n", - code, z_HTTP_errmsg(code)); + sprintf(hres->content_buf, + "\n" + "\n" + " \n" + " YAZ " YAZ_VERSION "\n" + " \n" + " \n" + "

YAZ " + YAZ_VERSION "

\n" + "

Error: %d

\n" + "

Description: %.50s

\n" + " \n" + "\n", + code, z_HTTP_errmsg(code)); hres->content_len = strlen(hres->content_buf); z_HTTP_header_add(o, &hres->headers, "Content-Type", "text/html"); } @@ -545,6 +549,7 @@ int yaz_encode_http_request(ODR o, Z_HTTP_Request *hr) /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab