X-Git-Url: http://dolda2000.com/gitweb/?p=ashd.git;a=blobdiff_plain;f=src%2Fhtparser.c;h=d1b0a1ce78f2445847e234bfe2b66eaec9572aab;hp=33ceb4990468fc1a7c5bcb9fd1847ec2c4777659;hb=5226f7c50ec6ef6a2da9ca8e04d1afca2725e259;hpb=1c3e01675acafadd2b44d54b541a57de5b5031f1 diff --git a/src/htparser.c b/src/htparser.c index 33ceb49..d1b0a1c 100644 --- a/src/htparser.c +++ b/src/htparser.c @@ -283,8 +283,8 @@ void serve(FILE *in, struct conn *conn) if(!hasheader(req, "connection", "keep-alive")) break; } else if((hd = getheader(resp, "content-length")) != NULL) { - dlen = passdata(out, in, -1); - if(dlen != atoo(hd)) + dlen = atoo(hd); + if(passdata(out, in, dlen) != dlen) break; if(!hasheader(req, "connection", "keep-alive")) break; @@ -301,8 +301,8 @@ void serve(FILE *in, struct conn *conn) } else if((hd = getheader(resp, "content-length")) != NULL) { writeresp(in, resp); fprintf(in, "\r\n"); - dlen = passdata(out, in, -1); - if(dlen != atoo(hd)) + dlen = atoo(hd); + if(passdata(out, in, dlen) != dlen) break; } else if(!getheader(resp, "transfer-encoding")) { headappheader(resp, "Transfer-Encoding", "chunked");