Author: adrian.chadd
Date: Sun Jul 5 05:21:24 2009
New Revision: 14123
Modified:
branches/LUSCA_HEAD/src/http.c
Log:
Merge Squid-2 patch 12462: fix chunk parsing errors on FreeBSD
From the original patch:
Because strtoll has different behaviour (actually, POSIX-compliant, AFAICT,
but whatever)
on FreeBSD6+, it's not possible to count on strtoll not setting errno to
EINVALID when parsing
"/r/n".
This patch checks to see if it's an empty line before checking errno,
avoiding this problem.
Modified: branches/LUSCA_HEAD/src/http.c
==============================================================================
--- branches/LUSCA_HEAD/src/http.c (original)
+++ branches/LUSCA_HEAD/src/http.c Sun Jul 5 05:21:24 2009
@@ -827,10 +827,10 @@
debug(11, 3) ("Chunk header '%.*s'\n",
strLen2(httpState->chunkhdr),
strBuf2(httpState->chunkhdr));
errno = 0;
httpState->chunk_size =
strto_off_t(strBuf(httpState->chunkhdr),
&end, 16);
- if (errno)
- badchunk = 1;
- else if (end == strBuf(httpState->chunkhdr))
+ if (end == strBuf(httpState->chunkhdr))
emptychunk = 1;
+ else if (errno)
+ badchunk = 1;
while (end && (*end == '\r' || *end == ' ' || *end == '\t'))
end++;
if (httpState->chunk_size < 0 || badchunk || !end || (*end
!= '\n'
&& *end != ';')) {
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"lusca-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/lusca-commit?hl=en
-~----------~----~----~----~------~----~------~--~---