summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.in1
-rw-r--r--src/css.c10
-rw-r--r--src/css_.c10
-rw-r--r--src/ftp.c2
-rw-r--r--src/http.c4
-rw-r--r--src/init.c4
-rw-r--r--src/main.c2
-rw-r--r--src/xattr.c24
-rw-r--r--src/xattr.h3
9 files changed, 37 insertions, 23 deletions
diff --git a/src/Makefile.in b/src/Makefile.in
index 56c5c79..6e5dde9 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1530,6 +1530,7 @@ program_transform_name = @program_transform_name@
psdir = @psdir@
pyexecdir = @pyexecdir@
pythondir = @pythondir@
+runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
diff --git a/src/css.c b/src/css.c
index 8a4cf23..68fec94 100644
--- a/src/css.c
+++ b/src/css.c
@@ -1,9 +1,9 @@
-#line 1 "css.c"
+#line 2 "css.c"
/* config.h must precede flex's inclusion of <stdio.h>
in order for its _GNU_SOURCE definition to take effect. */
#include <config.h>
-#line 6 "css.c"
+#line 7 "css.c"
#define YY_INT_ALIGNED short int
@@ -2449,8 +2449,8 @@ as that of the covered work. */
#endif
#endif
-#line 2452 "css.c"
#line 2453 "css.c"
+#line 2454 "css.c"
#define INITIAL 0
@@ -2668,7 +2668,7 @@ YY_DECL
#line 112 "css.l"
-#line 2671 "css.c"
+#line 2672 "css.c"
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
{
@@ -2958,7 +2958,7 @@ YY_RULE_SETUP
#line 167 "css.l"
ECHO;
YY_BREAK
-#line 2961 "css.c"
+#line 2962 "css.c"
case YY_STATE_EOF(INITIAL):
yyterminate();
diff --git a/src/css_.c b/src/css_.c
index cf3fdca..8ca830d 100644
--- a/src/css_.c
+++ b/src/css_.c
@@ -1,10 +1,10 @@
#include "wget.h"
-#line 1 "css.c"
+#line 2 "css.c"
/* config.h must precede flex's inclusion of <stdio.h>
in order for its _GNU_SOURCE definition to take effect. */
#include <config.h>
-#line 6 "css.c"
+#line 7 "css.c"
#define YY_INT_ALIGNED short int
@@ -2450,8 +2450,8 @@ as that of the covered work. */
#endif
#endif
-#line 2452 "css.c"
#line 2453 "css.c"
+#line 2454 "css.c"
#define INITIAL 0
@@ -2669,7 +2669,7 @@ YY_DECL
#line 112 "css.l"
-#line 2671 "css.c"
+#line 2672 "css.c"
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
{
@@ -2959,7 +2959,7 @@ YY_RULE_SETUP
#line 167 "css.l"
ECHO;
YY_BREAK
-#line 2961 "css.c"
+#line 2962 "css.c"
case YY_STATE_EOF(INITIAL):
yyterminate();
diff --git a/src/ftp.c b/src/ftp.c
index 3f4ab53..6b8bdf8 100644
--- a/src/ftp.c
+++ b/src/ftp.c
@@ -1580,7 +1580,7 @@ Error in server response, closing control connection.\n"));
#ifdef ENABLE_XATTR
if (opt.enable_xattr)
- set_file_metadata (u->url, NULL, fp);
+ set_file_metadata (u, NULL, fp);
#endif
fd_close (local_sock);
diff --git a/src/http.c b/src/http.c
index d77762f..a01fc57 100644
--- a/src/http.c
+++ b/src/http.c
@@ -4113,9 +4113,9 @@ gethttp (const struct url *u, struct url *original_url, struct http_stat *hs,
if (opt.enable_xattr)
{
if (original_url != u)
- set_file_metadata (u->url, original_url->url, fp);
+ set_file_metadata (u, original_url, fp);
else
- set_file_metadata (u->url, NULL, fp);
+ set_file_metadata (u, NULL, fp);
}
#endif
diff --git a/src/init.c b/src/init.c
index b829a2c..51b6361 100644
--- a/src/init.c
+++ b/src/init.c
@@ -507,11 +507,7 @@ defaults (void)
opt.hsts = true;
#endif
-#ifdef ENABLE_XATTR
- opt.enable_xattr = true;
-#else
opt.enable_xattr = false;
-#endif
}
/* Return the user's home directory (strdup-ed), or NULL if none is
diff --git a/src/main.c b/src/main.c
index ff41c8d..4408ffb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -755,7 +755,7 @@ Download:\n"),
#endif
#ifdef ENABLE_XATTR
N_("\
- --no-xattr turn off storage of metadata in extended file attributes\n"),
+ --xattr turn on storage of metadata in extended file attributes\n"),
#endif
"\n",
diff --git a/src/xattr.c b/src/xattr.c
index 6652422..0f20fad 100644
--- a/src/xattr.c
+++ b/src/xattr.c
@@ -21,6 +21,7 @@
#include <string.h>
#include "log.h"
+#include "utils.h"
#include "xattr.h"
#ifdef USE_XATTR
@@ -57,7 +58,7 @@ write_xattr_metadata (const char *name, const char *value, FILE *fp)
#endif /* USE_XATTR */
int
-set_file_metadata (const char *origin_url, const char *referrer_url, FILE *fp)
+set_file_metadata (const struct url *origin_url, const struct url *referrer_url, FILE *fp)
{
/* Save metadata about where the file came from (requested, final URLs) to
* user POSIX Extended Attributes of retrieved file.
@@ -67,13 +68,28 @@ set_file_metadata (const char *origin_url, const char *referrer_url, FILE *fp)
* [http://0pointer.de/lennart/projects/mod_mime_xattr/].
*/
int retval = -1;
+ char *value;
if (!origin_url || !fp)
return retval;
- retval = write_xattr_metadata ("user.xdg.origin.url", escnonprint_uri (origin_url), fp);
- if ((!retval) && referrer_url)
- retval = write_xattr_metadata ("user.xdg.referrer.url", escnonprint_uri (referrer_url), fp);
+ value = url_string (origin_url, URL_AUTH_HIDE);
+ retval = write_xattr_metadata ("user.xdg.origin.url", escnonprint_uri (value), fp);
+ xfree (value);
+
+ if (!retval && referrer_url)
+ {
+ struct url u;
+
+ memset(&u, 0, sizeof(u));
+ u.scheme = referrer_url->scheme;
+ u.host = referrer_url->host;
+ u.port = referrer_url->port;
+
+ value = url_string (&u, 0);
+ retval = write_xattr_metadata ("user.xdg.referrer.url", escnonprint_uri (value), fp);
+ xfree (value);
+ }
return retval;
}
diff --git a/src/xattr.h b/src/xattr.h
index 10f3ed1..40c7a8d 100644
--- a/src/xattr.h
+++ b/src/xattr.h
@@ -16,12 +16,13 @@
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <stdio.h>
+#include <url.h>
#ifndef _XATTR_H
#define _XATTR_H
/* Store metadata name/value attributes against fp. */
-int set_file_metadata (const char *origin_url, const char *referrer_url, FILE *fp);
+int set_file_metadata (const struct url *origin_url, const struct url *referrer_url, FILE *fp);
#if defined(__linux)
/* libc on Linux has fsetxattr (5 arguments). */