Android Question HttpJob and gzip

DonManfred

Expert
Licensed User
Longtime User
httpheader001.png
It is not a valid archive. I don't know what format this file use but it is neither Gzip nor Zip (and I don't even think it's an archive; that looks like an encrypted string).

http://ypool.net/api/personal_stats?key=nIcvhzn!4orRtYFkbWps&coinType=XPM:

You can have a look at example in #1. There is the url which is viewable in browser (webview and browser on pc too).



In 2. try the result from this url is loaded with httputil2 and saved to sdcard... THIS file is not what you see in webview. My Firefox (LiveHeaders) states that the content of this url is compressed with GZIP.
 
Last edited:
Upvote 0

Informatix

Expert
Licensed User
Longtime User
You can have a look at example in #1. There is the url which is viewable in browser (webview and browser on pc too).
In 2. try the result from this url is loaded with httputil2 and saved to sdcard... THIS file is not what you see in webview. My Firefox (LiveHeaders) states that the content of this url is compressed with GZIP.

The magic number of this file is 1F EF instead of the expected 1F 8B for a Gzip file. You should check if there's not a problem of charset conversion.
 
Upvote 0

Informatix

Expert
Licensed User
Longtime User
Ok, I finally used the following code as Job.GetString in the provided example does not return the raw data (I'm a bit slow today):
B4X:
Dim out As OutputStream = File.OpenOutput(File.DirDefaultExternal, "demo.gzip", False)
File.Copy2(job.GetInputStream, out)
out.Close
The magic number at the beginning is the right one so it's a Gzip file indeed, but as Erel said above, there's something wrong at the end.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
The problem is in the length block (last 4 bytes):
SS-2014-04-17_12.35.09.png


You can see it in 7zip that it reports 4gb for the unpacked length.

it.wikipedia.org
Col termine gzip si fa spesso riferimento all'omonimo formato di file, che è composto da:
  • una intestazione di 10 byte contenente un magic number, una versione del programma e un timestamp;
  • intestazioni addizionali facoltative, come ad esempio il nome originale del file;
  • un corpo centrale, contenente un insieme di dati compressi;
  • 8 byte finali contenenti un checksum di tipo CRC-32 dei dati e la loro lunghezza originaria.
-------------------------------------------------------------------------------------------------------
"gzip" is often also used to refer to the gzip file format, which is:
  • a 10-byte header, containing a magic number (1f 8b), a version number and a timestamp
  • optional extra headers, such as the original file name,
  • a body, containing a DEFLATE-compressed payload
  • an 8-byte footer, containing a CRC-32 checksum and the length of the original uncompressed data
_____________________________________________

Too much effort for this problem and too little for my quiz :D.
I'm just kidding. I hope that the guy appreciates your interest.
 
Upvote 0
Top