summaryrefslogtreecommitdiff
path: root/src/warc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/warc.c')
-rw-r--r--src/warc.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/warc.c b/src/warc.c
index bc1aafa..6a4b9eb 100644
--- a/src/warc.c
+++ b/src/warc.c
@@ -32,6 +32,7 @@ as that of the covered work. */
#include "utils.h"
#include "version.h"
#include "dirname.h"
+#include "url.h"
#include <stdio.h>
#include <stdlib.h>
@@ -1365,6 +1366,8 @@ warc_write_cdx_record (const char *url, const char *timestamp_str,
mime_type = "-";
if (redirect_location == NULL || strlen(redirect_location) == 0)
redirect_location = "-";
+ else
+ redirect_location = url_escape(redirect_location);
number_to_string (offset_string, offset);
@@ -1413,7 +1416,7 @@ warc_write_revisit_record (const char *url, const char *timestamp_str,
warc_write_header ("WARC-Refers-To", refers_to);
warc_write_header ("WARC-Profile", "http://netpreserve.org/warc/1.0/revisit/identical-payload-digest");
warc_write_header ("WARC-Truncated", "length");
- warc_write_header ("WARC-Target-URI", url);
+ warc_write_header_uri ("WARC-Target-URI", url);
warc_write_date_header (timestamp_str);
warc_write_ip_header (ip);
warc_write_header ("Content-Type", "application/http;msgtype=response");
@@ -1505,7 +1508,7 @@ warc_write_response_record (const char *url, const char *timestamp_str,
warc_write_header ("WARC-Record-ID", response_uuid);
warc_write_header ("WARC-Warcinfo-ID", warc_current_warcinfo_uuid_str);
warc_write_header ("WARC-Concurrent-To", concurrent_to_uuid);
- warc_write_header ("WARC-Target-URI", url);
+ warc_write_header_uri ("WARC-Target-URI", url);
warc_write_date_header (timestamp_str);
warc_write_ip_header (ip);
warc_write_header ("WARC-Block-Digest", block_digest);
@@ -1562,7 +1565,7 @@ warc_write_record (const char *record_type, const char *resource_uuid,
warc_write_header ("WARC-Record-ID", resource_uuid);
warc_write_header ("WARC-Warcinfo-ID", warc_current_warcinfo_uuid_str);
warc_write_header ("WARC-Concurrent-To", concurrent_to_uuid);
- warc_write_header ("WARC-Target-URI", url);
+ warc_write_header_uri ("WARC-Target-URI", url);
warc_write_date_header (timestamp_str);
warc_write_ip_header (ip);
warc_write_digest_headers (body, payload_offset);