X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fsrwutil.c;h=81e1010f15bd5482544def67872be40688e36188;hp=017ec5e604245bea5385f559b490c49767ef58ab;hb=5e0171c5568e93a00cad52e4187b9b28e8bacbf1;hpb=09c113499ad3e65ca1679889c2a0165a52f1cb50 diff --git a/src/srwutil.c b/src/srwutil.c index 017ec5e..81e1010 100644 --- a/src/srwutil.c +++ b/src/srwutil.c @@ -39,33 +39,6 @@ char *yaz_encode_sru_dbpath_odr(ODR out, const char *db) return dst; } -Z_AttributeList *yaz_use_attribute_create(ODR o, const char *name) -{ - Z_AttributeList *attributes= (Z_AttributeList *) - odr_malloc(o, sizeof(*attributes)); - Z_AttributeElement ** elements; - attributes->num_attributes = 1; - elements = (Z_AttributeElement**) - odr_malloc(o, attributes->num_attributes * sizeof(*elements)); - elements[0] = (Z_AttributeElement*) odr_malloc(o,sizeof(**elements)); - elements[0]->attributeType = odr_intdup(o, 1); - elements[0]->attributeSet = odr_nullval(); - elements[0]->which = Z_AttributeValue_complex; - elements[0]->value.complex = (Z_ComplexAttribute *) - odr_malloc(o, sizeof(Z_ComplexAttribute)); - elements[0]->value.complex->num_list = 1; - elements[0]->value.complex->list = (Z_StringOrNumeric **) - odr_malloc(o, 1 * sizeof(Z_StringOrNumeric *)); - elements[0]->value.complex->list[0] = (Z_StringOrNumeric *) - odr_malloc(o, sizeof(Z_StringOrNumeric)); - elements[0]->value.complex->list[0]->which = Z_StringOrNumeric_string; - elements[0]->value.complex->list[0]->u.string = odr_strdup(o, name); - elements[0]->value.complex->semanticAction = 0; - elements[0]->value.complex->num_semanticAction = 0; - attributes->attributes = elements; - return attributes; -} - #if YAZ_HAVE_XML2 const char *yaz_element_attribute_value_get(xmlNodePtr ptr, const char *node_name, @@ -1052,6 +1025,7 @@ int yaz_sru_get_encode(Z_HTTP_Request *hreq, Z_SRW_PDU *srw_pdu, char *name[MAX_SRU_PARAMETERS], *value[MAX_SRU_PARAMETERS]; /* definite upper limit for SRU params */ char *uri_args; char *path; + char *cp; z_HTTP_header_add_basic_auth(encode, &hreq->headers, srw_pdu->username, srw_pdu->password); @@ -1061,6 +1035,10 @@ int yaz_sru_get_encode(Z_HTTP_Request *hreq, Z_SRW_PDU *srw_pdu, hreq->method = "GET"; + cp = strchr(hreq->path, '#'); + if (cp) + *cp = '\0'; + path = (char *) odr_malloc(encode, strlen(hreq->path) + strlen(uri_args) + 4);