fixed bug #1744091 - NSISdl shows negative values with buggy apache
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5176 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
acc4233b41
commit
d748e470d8
2 changed files with 15 additions and 2 deletions
|
@ -481,3 +481,17 @@ int JNL_HTTPGet::peek_bytes(char *buf, int len)
|
||||||
if (m_con && m_http_state==3) return m_con->peek_bytes(buf,len);
|
if (m_con && m_http_state==3) return m_con->peek_bytes(buf,len);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__int64 JNL_HTTPGet::content_length()
|
||||||
|
{
|
||||||
|
char *p=getheader("content-length:");
|
||||||
|
if (!p) return 0;
|
||||||
|
__int64 cl = myatoi64(p);
|
||||||
|
if (cl > 0) return cl;
|
||||||
|
|
||||||
|
// workaround for bug #1744091
|
||||||
|
// some buggy apache servers return negative values for sizes
|
||||||
|
// over 2gb - fix it for them
|
||||||
|
if (cl < 0)
|
||||||
|
return __int64(unsigned(cl));
|
||||||
|
}
|
||||||
|
|
|
@ -43,7 +43,6 @@
|
||||||
#define _HTTPGET_H_
|
#define _HTTPGET_H_
|
||||||
|
|
||||||
#include "connection.h"
|
#include "connection.h"
|
||||||
#include "util.h"
|
|
||||||
|
|
||||||
class JNL_HTTPGet
|
class JNL_HTTPGet
|
||||||
{
|
{
|
||||||
|
@ -71,7 +70,7 @@ class JNL_HTTPGet
|
||||||
int get_bytes(char *buf, int len);
|
int get_bytes(char *buf, int len);
|
||||||
int peek_bytes(char *buf, int len);
|
int peek_bytes(char *buf, int len);
|
||||||
|
|
||||||
__int64 content_length() { char *p=getheader("content-length:"); if (p) return myatoi64(p); return 0; }
|
__int64 content_length();
|
||||||
|
|
||||||
JNL_Connection *get_con() { return m_con; }
|
JNL_Connection *get_con() { return m_con; }
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue