Lines 308-314
static http_t *http_open (const char *mr
Link Here
|
308 |
|
308 |
|
309 |
http_t *this; |
309 |
http_t *this; |
310 |
char *proxy; |
310 |
char *proxy; |
311 |
int done,len,linenum; |
311 |
int done,len,linenum,buflen; |
312 |
char mime_type[BUFSIZE+1]; |
312 |
char mime_type[BUFSIZE+1]; |
313 |
|
313 |
|
314 |
this = malloc (sizeof (http_t)); |
314 |
this = malloc (sizeof (http_t)); |
Lines 362-374
static http_t *http_open (const char *mr
Link Here
|
362 |
{ |
362 |
{ |
363 |
char buf[256]; |
363 |
char buf[256]; |
364 |
|
364 |
|
365 |
sprintf (buf, "http: opening >/%s< on host >%s<", |
365 |
snprintf (buf, sizeof(buf), "http: opening >/%s< on host >%s<", |
366 |
this->filename, this->host); |
366 |
this->filename, this->host); |
367 |
|
367 |
|
368 |
if (proxy != NULL) |
368 |
if (proxy != NULL) |
369 |
sprintf(buf, "%s via proxy >%s<", buf, this->proxyhost); |
369 |
snprintf(buf, sizeof(buf), "%s via proxy >%s<", buf, this->proxyhost); |
370 |
|
370 |
|
371 |
sprintf(buf, "%s\n", buf); |
371 |
snprintf(buf, sizeof(buf), "%s\n", buf); |
372 |
|
372 |
|
373 |
printf (buf); |
373 |
printf (buf); |
374 |
} |
374 |
} |
Lines 389-423
static http_t *http_open (const char *mr
Link Here
|
389 |
|
389 |
|
390 |
if (proxy != NULL) |
390 |
if (proxy != NULL) |
391 |
if (this->port != DEFAULT_HTTP_PORT) |
391 |
if (this->port != DEFAULT_HTTP_PORT) |
392 |
sprintf (this->buf, "GET http://%s:%d/%s HTTP/1.0\015\012", |
392 |
snprintf (this->buf, BUFSIZE, "GET http://%s:%d/%s HTTP/1.0\015\012", |
393 |
this->host, this->port, this->filename); |
393 |
this->host, this->port, this->filename); |
394 |
else |
394 |
else |
395 |
sprintf (this->buf, "GET http://%s/%s HTTP/1.0\015\012", |
395 |
snprintf (this->buf, BUFSIZE, "GET http://%s/%s HTTP/1.0\015\012", |
396 |
this->host, this->filename); |
396 |
this->host, this->filename); |
397 |
else |
397 |
else |
398 |
sprintf (this->buf, "GET /%s HTTP/1.0\015\012", this->filename); |
398 |
snprintf (this->buf, BUFSIZE, "GET /%s HTTP/1.0\015\012", this->filename); |
399 |
|
399 |
|
|
|
400 |
buflen = strlen(this->buf); |
400 |
if (this->port != DEFAULT_HTTP_PORT) |
401 |
if (this->port != DEFAULT_HTTP_PORT) |
401 |
sprintf (this->buf + strlen(this->buf), "Host: %s:%d\015\012", |
402 |
snprintf (this->buf + buflen, BUFSIZE - buflen, "Host: %s:%d\015\012", |
402 |
this->host, this->port); |
403 |
this->host, this->port); |
403 |
else |
404 |
else |
404 |
sprintf (this->buf + strlen(this->buf), "Host: %s\015\012", |
405 |
snprintf (this->buf + buflen, BUFSIZE - buflen, "Host: %s\015\012", |
405 |
this->host); |
406 |
this->host); |
406 |
|
407 |
|
407 |
if (this->proxyuser != NULL) |
408 |
buflen = strlen(this->buf); |
408 |
sprintf (this->buf + strlen(this->buf), "Proxy-Authorization: Basic %s\015\012", |
409 |
if (this->proxyuser != NULL) { |
409 |
this->proxyauth); |
410 |
snprintf (this->buf + buflen, BUFSIZE - buflen, "Proxy-Authorization: Basic %s\015\012", |
|
|
411 |
this->proxyauth); |
412 |
buflen = strlen(this->buf); |
413 |
} |
410 |
|
414 |
|
411 |
if (this->user != NULL) |
415 |
if (this->user != NULL) { |
412 |
sprintf (this->buf + strlen(this->buf), "Authorization: Basic %s\015\012", |
416 |
snprintf (this->buf + buflen, BUFSIZE - buflen, "Authorization: Basic %s\015\012", |
413 |
this->auth); |
417 |
this->auth); |
|
|
418 |
buflen = strlen(this->buf); |
419 |
} |
414 |
|
420 |
|
415 |
sprintf (this->buf + strlen(this->buf), "User-Agent: xine/%s\015\012", |
421 |
snprintf (this->buf + buflen, BUFSIZE - buflen, "User-Agent: xine/%s\015\012", |
416 |
VERSION); |
422 |
VERSION); |
417 |
|
423 |
|
418 |
strcat (this->buf, "Accept: */*\015\012"); |
424 |
buflen = strlen(this->buf); |
419 |
|
425 |
snprintf (this->buf + buflen, BUFSIZE - buflen, "Accept: */*\015\012"); |
420 |
strcat (this->buf, "\015\012"); |
426 |
buflen = strlen(this->buf); |
|
|
427 |
snprintf (this->buf + buflen, BUFSIZE - buflen, "\015\012"); |
421 |
|
428 |
|
422 |
if (write (this->fh, this->buf, strlen(this->buf)) != (ssize_t)strlen(this->buf)) { |
429 |
if (write (this->fh, this->buf, strlen(this->buf)) != (ssize_t)strlen(this->buf)) { |
423 |
free (this); |
430 |
free (this); |