1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-07 11:23:12 +02:00

For DroneBL spam submissions use "Content-Type: text/xml".

This also bumps the request size limit a bit.
This commit is contained in:
Bram Matthys
2023-07-09 14:03:35 +02:00
parent 0618495962
commit 9e2232ef72
2 changed files with 24 additions and 2 deletions
+1
View File
@@ -381,6 +381,7 @@ int _spamreport(Client *client, const char *ip, NameValuePrioList *details, cons
buildvarstring_nvp(fmtstring, bodybuf, sizeof(bodybuf), list, BUILDVARSTRING_XML|BUILDVARSTRING_UNKNOWN_VAR_IS_EMPTY);
body = bodybuf;
safe_free_nvplist(list); // frees all the duplicated lists
add_nvplist(&headers, 0, "Content-Type", "text/xml");
} else
abort();
+23 -2
View File
@@ -510,7 +510,7 @@ int url_parse(const char *url, char **hostname, int *port, char **username, char
void https_connect_send_header(Download *handle)
{
char buf[1024];
char buf[8192];
char hostandport[512];
int ssl_err;
char *host;
@@ -543,15 +543,20 @@ void https_connect_send_header(Download *handle)
VERSIONONLY,
hostandport);
} else {
char add_default_content_type = 0;
if (!find_nvplist(handle->request_headers, "Content-Type"))
add_default_content_type = 1;
snprintf(buf, sizeof(buf), "POST %s HTTP/1.1\r\n"
"User-Agent: UnrealIRCd %s\r\n"
"Host: %s\r\n"
"Content-Type: application/x-www-form-urlencoded\r\n"
"%s"
"Content-Length: %ld\r\n"
"Connection: close\r\n",
handle->document,
VERSIONONLY,
hostandport,
add_default_content_type ? "Content-Type: application/x-www-form-urlencoded\r\n" : "",
strlen(handle->body));
}
} else
@@ -579,6 +584,22 @@ void https_connect_send_header(Download *handle)
"If-Modified-Since: %s\r\n", datestr);
}
}
if (handle->request_headers)
{
NameValuePrioList *n;
char nbuf[256];
for (n = handle->request_headers; n; n = n->next)
{
if (n->value)
snprintf(nbuf, sizeof(nbuf), "%s: %s\r\n", n->name, n->value);
else
snprintf(nbuf, sizeof(nbuf), "%s:\r\n", n->name);
if (strlen(buf)+strlen(nbuf) > sizeof(buf)-8)
break;
strlcat(buf, nbuf, sizeof(buf));
}
}
strlcat(buf, "\r\n", sizeof(buf));
if (handle->body)
strlcat(buf, handle->body, sizeof(buf));