git-svn: trunk@2902
Nigel Horne authored on 2007/03/05 19:52:01... | ... |
@@ -1,3 +1,8 @@ |
1 |
+Mon Mar 5 08:57:00 GMT 2007 (njh) |
|
2 |
+--------------------------------- |
|
3 |
+ * libclamav/mbox.c: Fix another part of bug 255 (please only report one |
|
4 |
+ bug per bugzilla bug :-( ) |
|
5 |
+ |
|
1 | 6 |
Fri Mar 2 23:05:00 CET 2007 (edwin) |
2 | 7 |
---------------------------------- |
3 | 8 |
* libclamav/htmlnorm.c: Better handling for empty charset in meta tag. |
... | ... |
@@ -4347,6 +4347,10 @@ static int my_r_gethostbyname(const char *hostname, struct hostent *hp, char *bu |
4347 | 4347 |
#define NONBLOCK_SELECT_MAX_FAILURES 3 |
4348 | 4348 |
#define NONBLOCK_MAX_BOGUS_LOOPS 10 |
4349 | 4349 |
|
4350 |
+/* |
|
4351 |
+ * Simple implementation of a subset of RFC1945 (HTTP/1.0) |
|
4352 |
+ * TODO: HTTP/1.1 (RFC2068) |
|
4353 |
+ */ |
|
4350 | 4354 |
static void * |
4351 | 4355 |
#ifdef CL_THREAD_SAFE |
4352 | 4356 |
getURL(void *a) |
... | ... |
@@ -4361,7 +4365,6 @@ getURL(struct arg *arg) |
4361 | 4361 |
const char *url = arg->url; |
4362 | 4362 |
const char *dir = arg->dir; |
4363 | 4363 |
const char *filename = arg->filename; |
4364 |
- char fout[NAME_MAX + 1]; |
|
4365 | 4364 |
#ifdef C_WINDOWS |
4366 | 4365 |
SOCKET sd; |
4367 | 4366 |
#else |
... | ... |
@@ -4381,7 +4384,7 @@ getURL(struct arg *arg) |
4381 | 4381 |
char *ptr; |
4382 | 4382 |
int flags, via_proxy; |
4383 | 4383 |
const char *proxy; |
4384 |
- char buf[BUFSIZ + 1], site[BUFSIZ]; |
|
4384 |
+ char buf[BUFSIZ + 1], site[BUFSIZ], fout[NAME_MAX + 1]; |
|
4385 | 4385 |
|
4386 | 4386 |
if(strlen(url) > (sizeof(site) - 1)) { |
4387 | 4387 |
cli_dbgmsg("Ignoring long URL \"%s\"\n", url); |
... | ... |
@@ -4526,10 +4529,10 @@ getURL(struct arg *arg) |
4526 | 4526 |
*/ |
4527 | 4527 |
if(via_proxy) |
4528 | 4528 |
snprintf(buf, sizeof(buf) - 1, |
4529 |
- "GET %s HTTP/1.0\nUser-Agent: www.clamav.net\n\n", url); |
|
4529 |
+ "GET %s HTTP/1.0\nUser-Agent: www.clamav.net\r\n\r\n", url); |
|
4530 | 4530 |
else |
4531 | 4531 |
snprintf(buf, sizeof(buf) - 1, |
4532 |
- "GET /%s HTTP/1.0\nUser-Agent: www.clamav.net\n\n", url); |
|
4532 |
+ "GET /%s HTTP/1.0\nUser-Agent: www.clamav.net\r\n\r\n", url); |
|
4533 | 4533 |
|
4534 | 4534 |
/*cli_dbgmsg("%s", buf);*/ |
4535 | 4535 |
|
... | ... |
@@ -4623,8 +4626,10 @@ getURL(struct arg *arg) |
4623 | 4623 |
/* |
4624 | 4624 |
* Don't write the HTTP header |
4625 | 4625 |
*/ |
4626 |
- ptr = strstr(buf, "\n\n"); |
|
4627 |
- if(ptr != NULL) { |
|
4626 |
+ if((ptr = strstr(buf, "\r\n\r\n")) != NULL) { |
|
4627 |
+ ptr += 4; |
|
4628 |
+ n -= (int)(ptr - buf); |
|
4629 |
+ } else if((ptr = strstr(buf, "\n\n")) != NULL) { |
|
4628 | 4630 |
ptr += 2; |
4629 | 4631 |
n -= (int)(ptr - buf); |
4630 | 4632 |
} else |