View | Details | Raw Unified | Return to bug 30054
Collapse All | Expand All

(-)fetch.c Fri Aug 24 19:49:29 2001 (-4 / +11 lines)
Lines 104-110 Link Here
104
       char *port;
104
       char *port;
105
       volatile int s;
105
       volatile int s;
106
       size_t len;
106
       size_t len;
107
       char c, *cp, *ep, *portnum, *path, buf[4096];
107
       char c, *cp, *ep, *http_buffer, *portnum, *path, buf[4096];
108
       const char *savefile;
108
       const char *savefile;
109
       char *line, *proxy, *host;
109
       char *line, *proxy, *host;
110
       volatile sig_t oldintr;
110
       volatile sig_t oldintr;
Lines 280-291 Link Here
280
               printf("Requesting %s\n", origline);
280
               printf("Requesting %s\n", origline);
281
       else
281
       else
282
               printf("Requesting %s (via %s)\n", origline, proxyenv);
282
               printf("Requesting %s (via %s)\n", origline, proxyenv);
283
       len = snprintf(buf, sizeof(buf), "GET %s%s HTTP/1.0\r\n\r\n",
283
       len = asprintf(&http_buffer, "GET %s%s HTTP/1.0\r\nHost: %s\r\n\r\n",
284
           proxy ? "" : "/", path);
284
           proxy ? "" : "/", path, host);
285
       if (write(s, buf, len) < len) {
285
       if (len == -1) {
286
               warn("Allocating space for HTTP request");
287
               goto cleanup_url_get;
288
       }
289
       if (write(s, http_buffer, len) < len) {
286
               warn("Writing HTTP request");
290
               warn("Writing HTTP request");
291
               if (http_buffer != NULL)
292
                       free(http_buffer);
287
               goto cleanup_url_get;
293
               goto cleanup_url_get;
288
       }
294
       }
295
       free(http_buffer);
289
       memset(buf, 0, sizeof(buf));
296
       memset(buf, 0, sizeof(buf));
290
       for (cp = buf; cp < buf + sizeof(buf); ) {
297
       for (cp = buf; cp < buf + sizeof(buf); ) {
291
               if (read(s, cp, 1) != 1)
298
               if (read(s, cp, 1) != 1)

Return to bug 30054