mirror of
https://github.com/curl/curl.git
synced 2026-07-26 03:47:17 +03:00
http: add support to read and store the referrer header
- add CURLINFO_REFERER libcurl option
- add --write-out '%{referer}' command-line option
- extend --xattr command-line option to fill user.xdg.referrer.url extended
attribute with the referrer (if there was any)
Closes #6591
This commit is contained in:
parent
70472a44de
commit
44872aefc2
15 changed files with 35 additions and 11 deletions
|
|
@ -83,6 +83,7 @@ static const struct writeoutvar variables[] = {
|
|||
{"proxy_ssl_verify_result", VAR_PROXY_SSL_VERIFY_RESULT,
|
||||
CURLINFO_PROXY_SSL_VERIFYRESULT, writeLong},
|
||||
{"redirect_url", VAR_REDIRECT_URL, CURLINFO_REDIRECT_URL, writeString},
|
||||
{"referer", VAR_REFERER, CURLINFO_REFERER, writeString},
|
||||
{"remote_ip", VAR_PRIMARY_IP, CURLINFO_PRIMARY_IP, writeString},
|
||||
{"remote_port", VAR_PRIMARY_PORT, CURLINFO_PRIMARY_PORT, writeLong},
|
||||
{"response_code", VAR_HTTP_CODE, CURLINFO_RESPONSE_CODE, writeLong},
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
|
|
@ -54,6 +54,7 @@ typedef enum {
|
|||
VAR_REDIRECT_COUNT,
|
||||
VAR_REDIRECT_TIME,
|
||||
VAR_REDIRECT_URL,
|
||||
VAR_REFERER,
|
||||
VAR_REQUEST_SIZE,
|
||||
VAR_SCHEME,
|
||||
VAR_SIZE_DOWNLOAD,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
|
|
@ -44,9 +44,10 @@ static const struct xattr_mapping {
|
|||
/* mappings proposed by
|
||||
* https://freedesktop.org/wiki/CommonExtendedAttributes/
|
||||
*/
|
||||
{ "user.xdg.origin.url", CURLINFO_EFFECTIVE_URL },
|
||||
{ "user.mime_type", CURLINFO_CONTENT_TYPE },
|
||||
{ NULL, CURLINFO_NONE } /* last element, abort loop here */
|
||||
{ "user.xdg.referrer.url", CURLINFO_REFERER },
|
||||
{ "user.xdg.origin.url", CURLINFO_EFFECTIVE_URL },
|
||||
{ "user.mime_type", CURLINFO_CONTENT_TYPE },
|
||||
{ NULL, CURLINFO_NONE } /* last element, abort here */
|
||||
};
|
||||
|
||||
/* returns TRUE if a new URL is returned, that then needs to be freed */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue