Changeset 24256 for titan/titan/sock.h
- Timestamp:
- 10/13/13 10:16:30 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/titan/sock.h
r24245 r24256 726 726 len = strtoul(contentlen, NULL, 10); 727 727 } 728 if(filename == NULL && flag == 0 && ostrstr(tmpbuf, "Content-Type: application/x-gzip") != NULL) 729 gzip = 1; 728 if(filename == NULL && (flag == 0 || flag == 1) && ostrstr(tmpbuf, "Content-Type: application/x-gzip") != NULL) 729 { 730 if(flag == 0) gzip = -1; 731 else if(flag == 1) gzip = headerlen; 732 } 730 733 731 734 if(flag == 0) headerlen = 0; … … 776 779 sockclose(&sock); 777 780 778 if(gzip == 1)781 if(gzip != 0) 779 782 { 780 783 int unzipret = 0, outlen = 0; 781 784 char* outbuf = NULL; 782 785 783 unzipret = ounzip(buf, count, &outbuf, &outlen, MINMALLOC * 100, 2); 784 if(unzipret == 0 && outbuf != NULL) 785 { 786 free(buf); buf = outbuf; 787 count = outlen; 788 } 786 if(gzip == -1) 787 outbuf = malloc(MINMALLOC * 100); 789 788 else 790 { 791 err("unzip http data"); 789 outbuf = malloc((MINMALLOC * 100) + gzip); 790 791 if(outbuf != NULL) 792 { 793 if(gzip == -1) 794 unzipret = ounzip(buf, count, &outbuf, &outlen, MINMALLOC * 100, 1); 795 else 796 { 797 memcpy(outbuf, buf, gzip); 798 char* tmpoutbuf = outbuf + gzip; 799 unzipret = ounzip(buf + gzip, count - gzip, &tmpoutbuf, &outlen, MINMALLOC * 100, 1); 800 outlen += gzip; 801 } 802 if(unzipret == 0) 803 { 804 free(buf); buf = outbuf; 805 count = outlen; 806 } 807 else 808 { 809 free(outbuf); outbuf = NULL; 810 err("unzip http data"); 811 } 812 } 813 else 814 { 815 err("no mem"); 792 816 } 793 817 }
Note: See TracChangeset
for help on using the changeset viewer.