X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fzgdu.c;h=543eda6d387ebd2d3797367d27aaae6f21bbae2a;hb=0a1e9944179033c72f1fa9f9c13fabddc1945aeb;hp=fa921536dc73851af54af85a5c48caf67b493425;hpb=b1419c61a0ac369638256f2afd1fc6b8ecd8fa34;p=yaz-moved-to-github.git diff --git a/src/zgdu.c b/src/zgdu.c index fa92153..543eda6 100644 --- a/src/zgdu.c +++ b/src/zgdu.c @@ -2,7 +2,7 @@ * Copyright (c) 2002-2003, Index Data. * See the file LICENSE for details. * - * $Id: zgdu.c,v 1.3 2003-12-30 00:29:53 adam Exp $ + * $Id: zgdu.c,v 1.5 2003-12-31 00:14:01 adam Exp $ */ #include @@ -294,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) { @@ -333,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) { @@ -353,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: