~ubuntu-branches/ubuntu/precise/wget/precise-proposed

« back to all changes in this revision

Viewing changes to src/url.c

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2011-10-19 00:00:09 UTC
  • mfrom: (2.1.13 sid)
  • Revision ID: james.westby@ubuntu.com-20111019000009-8p33w3wz4b1rdri0
Tags: 1.13-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Add wget-udeb to ship wget.gnu as alternative to busybox wget
    implementation.
  - Depend on libssl-dev 0.9.8k-7ubuntu4 (LP: #503339)
* Dropped changes, superseded in Debian:
  - Keep build dependencies in main:
    + debian/control: remove info2man build-dep
    + debian/patches/series: disable wget-infopod_generated_manpage
  - Mark wget Multi-Arch: foreign, so packages that aren't of the same arch
    can depend on it.
* Pass --with-ssl=openssl; we don't want to use gnutls, there's no udeb for
  it.
* Add a second build pass for the udeb, so we can build without libidn.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* URL handling.
2
2
   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
3
 
   2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 
3
   2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
 
4
   Inc.
4
5
 
5
6
This file is part of GNU Wget.
6
7
 
33
34
#include <stdio.h>
34
35
#include <stdlib.h>
35
36
#include <string.h>
36
 
#ifdef HAVE_UNISTD_H
37
 
# include <unistd.h>
38
 
#endif
 
37
#include <unistd.h>
39
38
#include <errno.h>
40
39
#include <assert.h>
41
40
 
463
462
  return *p == ':';
464
463
}
465
464
 
 
465
bool
 
466
url_valid_scheme (const char *url)
 
467
{
 
468
  enum url_scheme scheme = url_scheme (url);
 
469
  return scheme != SCHEME_INVALID;
 
470
}
 
471
 
466
472
int
467
473
scheme_default_port (enum url_scheme scheme)
468
474
{
624
630
    *p++ = '?';
625
631
  if (flags & scm_has_fragment)
626
632
    *p++ = '#';
627
 
  *p++ = '\0';
 
633
  *p = '\0';
628
634
  return seps;
629
635
}
630
636
 
1492
1498
   possible.  Does not create directories on the file system.  */
1493
1499
 
1494
1500
char *
1495
 
url_file_name (const struct url *u)
 
1501
url_file_name (const struct url *u, char *replaced_filename)
1496
1502
{
1497
1503
  struct growable fnres;        /* stands for "file name result" */
1498
1504
 
1547
1553
      append_dir_structure (u, &fnres);
1548
1554
    }
1549
1555
 
1550
 
  /* Add the file name. */
1551
 
  if (fnres.tail)
1552
 
    append_char ('/', &fnres);
1553
 
  u_file = *u->file ? u->file : index_filename;
1554
 
  append_uri_pathel (u_file, u_file + strlen (u_file), false, &fnres);
 
1556
  if (!replaced_filename)
 
1557
    {
 
1558
      /* Add the file name. */
 
1559
      if (fnres.tail)
 
1560
        append_char ('/', &fnres);
 
1561
      u_file = *u->file ? u->file : index_filename;
 
1562
      append_uri_pathel (u_file, u_file + strlen (u_file), false, &fnres);
1555
1563
 
1556
 
  /* Append "?query" to the file name. */
1557
 
  u_query = u->query && *u->query ? u->query : NULL;
1558
 
  if (u_query)
 
1564
      /* Append "?query" to the file name. */
 
1565
      u_query = u->query && *u->query ? u->query : NULL;
 
1566
      if (u_query)
 
1567
        {
 
1568
          append_char (FN_QUERY_SEP, &fnres);
 
1569
          append_uri_pathel (u_query, u_query + strlen (u_query),
 
1570
                             true, &fnres);
 
1571
        }
 
1572
    }
 
1573
  else
1559
1574
    {
1560
 
      append_char (FN_QUERY_SEP, &fnres);
1561
 
      append_uri_pathel (u_query, u_query + strlen (u_query), true, &fnres);
 
1575
      if (fnres.tail)
 
1576
        append_char ('/', &fnres);
 
1577
      u_file = replaced_filename;
 
1578
      append_uri_pathel (u_file, u_file + strlen (u_file), false, &fnres);
1562
1579
    }
1563
1580
 
1564
1581
  /* Zero-terminate the file name. */