summaryrefslogtreecommitdiff
blob: 6a394d4b308ec8f50eac27c0d08261425ab9196e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
--- a/chaosreader	2011-11-10 19:17:50.000000000 +0100
+++ b/chaosreader	2012-03-09 18:15:21.096105305 +0100
@@ -5350,6 +5353,24 @@
 		next if length($http_data) < 8;
 		$partnum++;
 		$parttext = sprintf("%02d",$partnum);
+		
+		## from https://sourceforge.net/tracker/?func=detail&aid=2019799&group_id=107384&atid=647491 
+		### Chunk Check
+		if ( $http_header =~ /Transfer-Encoding: chunked/ ) {
+                  my $new_http_data="";
+                  my $chunksize=-1;
+                  my $pos=0;
+                  until ($chunksize==0) {
+                    my $eolpos=index($http_data,"\r\n",$pos);
+                    $chunksize=hex(substr($http_data,$pos,$eolpos - $pos));
+                    $pos=($eolpos+2);
+                    if ($chunksize > 0) {
+                      $new_http_data.=substr($http_data,$pos,$chunksize);
+                    }
+                    $pos+=($chunksize+2);
+                  }
+                  $http_data=$new_http_data;
+		}
 
 		### Part - Checks
 		$http_type = &File_Type($http_data);