aboutsummaryrefslogtreecommitdiff
path: root/src/Scraping/ScrapingHttp.c
diff options
context:
space:
mode:
authorfrosty <gabriel@bwaaa.monster>2026-08-05 18:57:18 -0400
committerfrosty <gabriel@bwaaa.monster>2026-08-05 18:57:18 -0400
commit296021e0ce7e27db837638076c3316a4af35b1b7 (patch)
treeadc521936be16b9e3e5ef639868f3adc2ccaf784 /src/Scraping/ScrapingHttp.c
parent2419dec7f863dfc7c1824b00445ff9a06c837f80 (diff)
parent11acc93f4357b86e2ca3a74e549193d84ab685f4 (diff)
downloadomnisearch-296021e0ce7e27db837638076c3316a4af35b1b7.tar.gz
Merge branch 'indev-yacy' into indev
Diffstat (limited to 'src/Scraping/ScrapingHttp.c')
-rw-r--r--src/Scraping/ScrapingHttp.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/Scraping/ScrapingHttp.c b/src/Scraping/ScrapingHttp.c
index 1a6a292..89f4853 100644
--- a/src/Scraping/ScrapingHttp.c
+++ b/src/Scraping/ScrapingHttp.c
@@ -89,11 +89,14 @@ struct curl_slist *build_request_headers(const char *host_header,
struct curl_slist *headers = NULL;
char host_buf[BUFFER_SIZE_MEDIUM], ref_buf[BUFFER_SIZE_MEDIUM];
- snprintf(host_buf, sizeof(host_buf), "Host: %s", host_header);
- snprintf(ref_buf, sizeof(ref_buf), "Referer: %s", referer);
-
- headers = curl_slist_append(headers, host_buf);
- headers = curl_slist_append(headers, ref_buf);
+ if (host_header && host_header[0] != '\0') {
+ snprintf(host_buf, sizeof(host_buf), "Host: %s", host_header);
+ headers = curl_slist_append(headers, host_buf);
+ }
+ if (referer && referer[0] != '\0') {
+ snprintf(ref_buf, sizeof(ref_buf), "Referer: %s", referer);
+ headers = curl_slist_append(headers, ref_buf);
+ }
headers = curl_slist_append(
headers,
"Accept: "