X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fzgdu.c;h=543eda6d387ebd2d3797367d27aaae6f21bbae2a;hb=5443d85bcd6ac9a3ca444586ab7a83c3ba85bc6b;hp=b38233fcececde3998e544ba230ed96a68abf117;hpb=d21c0a79df949a31f337094b8e169d04a939a9dc;p=yaz-moved-to-github.git diff --git a/src/zgdu.c b/src/zgdu.c index b38233f..543eda6 100644 --- a/src/zgdu.c +++ b/src/zgdu.c @@ -2,11 +2,12 @@ * Copyright (c) 2002-2003, Index Data. * See the file LICENSE for details. * - * $Id: zgdu.c,v 1.2 2003-12-21 11:33:29 adam Exp $ + * $Id: zgdu.c,v 1.5 2003-12-31 00:14:01 adam Exp $ */ #include #include +#include #include static int decode_headers_content(ODR o, int off, Z_HTTP_Header **headers, @@ -293,11 +294,10 @@ int z_GDU (ODR o, Z_GDU **p, int opt, const char *name) if (!z_HTTP_header_lookup((*p)->u.HTTP_Response->headers, "Content-Length")) { - char lstr[20]; - sprintf(lstr, "%d", (*p)->u.HTTP_Response->content_len); - z_HTTP_header_add(o, - &(*p)->u.HTTP_Response->headers, - "Content-Length", lstr); + char lstr[60]; + sprintf(lstr, "Content-Length: %d\r\n", + (*p)->u.HTTP_Response->content_len); + odr_write(o, (unsigned char *) lstr, strlen(lstr)); } for (h = (*p)->u.HTTP_Response->headers; h; h = h->next) { @@ -332,11 +332,10 @@ int z_GDU (ODR o, Z_GDU **p, int opt, const char *name) !z_HTTP_header_lookup((*p)->u.HTTP_Request->headers, "Content-Length")) { - char lstr[20]; - sprintf(lstr, "%d", (*p)->u.HTTP_Request->content_len); - z_HTTP_header_add(o, - &(*p)->u.HTTP_Request->headers, - "Content-Length", lstr); + char lstr[60]; + sprintf(lstr, "Content-Length: %d\r\n", + (*p)->u.HTTP_Request->content_len); + odr_write(o, (unsigned char *) lstr, strlen(lstr)); } for (h = (*p)->u.HTTP_Request->headers; h; h = h->next) { @@ -352,7 +351,9 @@ int z_GDU (ODR o, Z_GDU **p, int opt, const char *name) (*p)->u.HTTP_Request->content_len); if (o->direction == ODR_PRINT) { - fprintf(o->print, "-- HTTP request:\n%.*s\n", o->top, o->buf); + fprintf(o->print, "-- HTTP request:\n%.*s\n", o->top - top0, + o->buf + top0); + fprintf(o->print, "-- \n"); } break; case Z_GDU_Z3950: