w3->ssl_ctx = NULL;
#endif
if(strcmp(protocol, "file") != 0) {
- if(strcmp(protocol, "http") == 0){
+ if(strcmp(protocol, "http") == 0) {
#ifdef SSL_SUPPORT
- }else if(strcmp(protocol, "https") == 0){
+ } else if(strcmp(protocol, "https") == 0) {
#endif
- }else{
+ } else {
__W3_Debug("Protocol", "Not suppported");
W3_Free(w3);
w3 = NULL;
char* chunk = NULL;
bool breakchunk = false;
int chunksize;
+ size_t allsize = -1;
while(true) {
int l = __W3_Auto_Read(w3, buf, w3->readsize);
if(l <= 0) break;
}
if(strcasecmp(data, "transfer-encoding") == 0 && strcasecmp(data + k + 1, "chunked") == 0) {
chunked = true;
+ } else if(strcasecmp(data, "content-length") == 0) {
+ allsize = atoi(data + k + 1);
}
}
break;
func(w3, buffer, l - i);
free(buffer);
}
+ allsize -= l - i;
+ if(allsize == 0) {
+ breakchunk = 1;
+ }
}
break;
}
extern "C" {
#endif
-#define LIBW3_VERSION "1.3B" \
+#define LIBW3_VERSION "1.3C" \
SUFFIX
#ifdef __cplusplus