Subversion Repositories SvarDOS

Rev

Rev 215 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 215 Rev 218
Line 166... Line 166...
166
    if (byteread > 0) {
166
    if (byteread > 0) {
167
      buffer[byteread] = 0;
167
      buffer[byteread] = 0;
168
      lastactivity = time(NULL);
168
      lastactivity = time(NULL);
169
      /* do I know the http code yet? */
169
      /* do I know the http code yet? */
170
      if (httpcode < 0) {
170
      if (httpcode < 0) {
-
 
171
        int spc;
-
 
172
        /* find the first space (HTTP/1.1 200 OK) */
-
 
173
        for (spc = 0; spc < 16; spc++) {
-
 
174
          if (buffer[spc] == ' ') break;
-
 
175
          if (buffer[spc] == 0) break;
-
 
176
        }
-
 
177
        if (buffer[spc] == 0) continue; /* not enough data received */
-
 
178
        if (buffer[spc] != ' ') {
-
 
179
          puts("ERROR: server answered with invalid HTTP");
-
 
180
          goto SHITQUIT;
-
 
181
        }
171
        httpcode = atoi((char *)buffer);
182
        httpcode = atoi((char *)(buffer + spc + 1));
172
        /* on error, the answer should be always printed on screen */
183
        /* on error, the answer should be always printed on screen */
173
        if ((httpcode == 200) && (*outfname != 0)) {
184
        if ((httpcode == 200) && (*outfname != 0)) {
174
          fd = fopen(outfname, "wb");
185
          fd = fopen(outfname, "wb");
175
          if (fd == NULL) {
186
          if (fd == NULL) {
176
            printf("ERROR: failed to create file %s", outfname);
187
            printf("ERROR: failed to create file %s", outfname);