X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=src%2Fhttp.c;h=0fb1434c37d3d0f0a24fd389e5038dd5165b3adb;hb=dbd362a3dc1cfcafbcbafee0d5b28a4397fe7f03;hp=3362438696ed9bf9cea5fdc21b62b10f6a381d6e;hpb=93f4285bbf2ed5a42fe62f92c7c4618df5f20583;p=yaz-moved-to-github.git diff --git a/src/http.c b/src/http.c index 3362438..0fb1434 100644 --- a/src/http.c +++ b/src/http.c @@ -1,18 +1,20 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2008 Index Data + * Copyright (C) 1995-2011 Index Data * See the file LICENSE for details. */ - /** * \file http.c * \brief Implements HTTP decoding */ +#if HAVE_CONFIG_H +#include +#endif #include #include #include #include -#include +#include #include #ifdef WIN32 @@ -231,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); @@ -333,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"); } @@ -544,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