X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fsrwutil.c;h=a04516a109d001a8c2df8a5ed561326888f9388b;hb=29b39371225c6c6eaa746d8805dd46d42b9b9668;hp=9eff9aaebe82ba0d1b5392eea092a0ffaf318c0f;hpb=38d3fafb8baf5f2d0a3acfcb5a72f5994e75d4a4;p=yaz-moved-to-github.git diff --git a/src/srwutil.c b/src/srwutil.c index 9eff9aa..a04516a 100644 --- a/src/srwutil.c +++ b/src/srwutil.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include "sru-p.h" @@ -85,52 +86,6 @@ const char *yaz_element_attribute_value_get(xmlNodePtr ptr, } #endif -static int yaz_base64decode(const char *in, char *out) -{ - const char *map = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz0123456789+/"; - int olen = 0; - int len = strlen(in); - - while (len >= 4) - { - char i0, i1, i2, i3; - char *p; - - if (!(p = strchr(map, in[0]))) - return 0; - i0 = p - map; - len--; - if (!(p = strchr(map, in[1]))) - return 0; - i1 = p - map; - len--; - *(out++) = i0 << 2 | i1 >> 4; - olen++; - if (in[2] == '=') - break; - if (!(p = strchr(map, in[2]))) - return 0; - i2 = p - map; - len--; - *(out++) = i1 << 4 | i2 >> 2; - olen++; - if (in[3] == '=') - break; - if (!(p = strchr(map, in[3]))) - return 0; - i3 = p - map; - len--; - *(out++) = i2 << 6 | i3; - olen++; - - in += 4; - } - - *out = '\0'; - return olen; -} - int yaz_srw_check_content_type(Z_HTTP_Response *hres) { const char *content_type = z_HTTP_header_lookup(hres->headers, @@ -161,7 +116,7 @@ static void yaz_srw_decodeauth(Z_SRW_PDU *sr, Z_HTTP_Request *hreq, if (basic) { - int len, olen; + int len; char out[256]; char ubuf[256] = "", pbuf[256] = "", *p; if (strncmp(basic, "Basic ", 6)) @@ -170,7 +125,7 @@ static void yaz_srw_decodeauth(Z_SRW_PDU *sr, Z_HTTP_Request *hreq, len = strlen(basic); if (!len || len > 256) return; - olen = yaz_base64decode(basic, out); + yaz_base64decode(basic, out); /* Format of out should be username:password at this point */ strcpy(ubuf, out); if ((p = strchr(ubuf, ':'))) @@ -437,7 +392,6 @@ int yaz_sru_decode(Z_HTTP_Request *hreq, Z_SRW_PDU **srw_pdu, char *startRecord = 0; char *maximumTerms = 0; char *responsePosition = 0; - char *extraRequestData = 0; Z_SRW_extra_arg *extra_args = 0; #endif char **uri_name; @@ -500,7 +454,7 @@ int yaz_sru_decode(Z_HTTP_Request *hreq, Z_SRW_PDU **srw_pdu, else if (!strcmp(n, "responsePosition")) responsePosition = v; else if (!strcmp(n, "extraRequestData")) - extraRequestData = v; + ; /* ignoring extraRequestData */ else if (n[0] == 'x' && n[1] == '-') { Z_SRW_extra_arg **l = &extra_args;