خرید بک لینک

Vote count: 0

i'v got problem with my code. I want to know recieve header, but sometime it works well and sometime dont.

There is my code to send

send(s, message, strlen(message), 0)

And this for recieve data

int memory = 1;
int d = 0;
header = malloc(memory * sizeof(char));
if (header == NULL) {
    printf("Error, memoryn");
    retu 1;
}
while (recv(s, header + d, 1,0)>0) {
    if(strstr(header, "") != NULL)
        break;

    d++;
    if (d >= memory) {
        memory *= 2;
        header = realloc(header, memory);
        if (header == NULL) {
            printf("Error, memoryn");
            retu 1;
        }
    }
}

I think it some problem with malloc, but i cant find where.

This is succes reciev header, from https://www.w3.org/TR/ldp/images/ldpc-hierarchy.png

Header:
HTTP/1.1 200 OK
Date: Sat, 02 Apr 2016 02:35:07 GMT
Last-Modified: Tue, 24 Feb 2015 20:49:22 GMT
ETag: "7ab4-50fdba7431880;50c0cc9312bdc"
Accept-Ranges: bytes
Content-Length: 31412
Cache-Control: max-age=2592000
Expires: Mon, 02 May 2016 02:35:07 GMT
P3P: policyref="http://www.w3.org/2014/08/p3p.xml"
Vary: upgrade-insecure-requests
Access-Control-Allow-Origin: *
Coection: close
Content-Type: image/png; qs=0.7

And this wrong one from http://apk-dl.com/detail/screenshot/DueSGNGTIpribKe93O72-pJU6zgEp7qN_agFirScA9OVXmWLV8ofyAZngl0Q_Sc-K50=h500.png

Header:
HTTP/1.1 200 OK
gEp7qN_agFirScA9OVXmWLV8ofyAZngl0Q_Sc-K50=h500.png HTTP/1.1
Host: apk-dl.com
Coection: close 

Thanks for any tips, and sorry for my english.

asked 53 secs ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 14 فروردين 1395 ساعت: 9:51

صفحه بندی