mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-01-31 00:23:50 +00:00
Report missing Content-Disposition header
This commit is contained in:
parent
463e27684c
commit
518740bcf2
11
httpd.c
11
httpd.c
@ -485,9 +485,16 @@ int http_response_content_type(httpd_request *r, uint16_t result, const char *wh
|
||||
|
||||
int http_response_content_disposition(httpd_request *r, uint16_t result, const char *what, const char *type)
|
||||
{
|
||||
DEBUGF(httpd, "%s Content-Disposition: %s %s", what, type);
|
||||
DEBUGF(httpd, "%s Content-Disposition%s%s", what,
|
||||
type && type[0] ? ": " : "",
|
||||
type && type[0] ? type : " header"
|
||||
);
|
||||
strbuf msg = strbuf_alloca(100);
|
||||
strbuf_sprintf(msg, "%s Content-Disposition: %s", what, type);
|
||||
strbuf_sprintf(msg, "%s Content-Disposition", what);
|
||||
if (type && type[0])
|
||||
strbuf_sprintf(msg, ": %s", type);
|
||||
else
|
||||
strbuf_puts(msg, " header");
|
||||
http_request_simple_response(&r->http, result, strbuf_str(msg)); // Unsupported Media Type
|
||||
return result;
|
||||
}
|
||||
|
@ -609,6 +609,8 @@ static int send_mime_part_end(struct http_request *hr)
|
||||
static int send_mime_part_header(struct http_request *hr, const struct mime_part_headers *h)
|
||||
{
|
||||
httpd_request *r = (httpd_request *) hr;
|
||||
if (!h->content_disposition.type[0])
|
||||
return http_response_content_disposition(r, 415, "Missing", h->content_disposition.type);
|
||||
if (strcmp(h->content_disposition.type, "form-data") != 0)
|
||||
return http_response_content_disposition(r, 415, "Unsupported", h->content_disposition.type);
|
||||
if (strcmp(h->content_disposition.name, PART_MESSAGE) == 0) {
|
||||
|
@ -309,6 +309,10 @@ static int rhizome_direct_process_mime_end(struct http_request *hr)
|
||||
static int rhizome_direct_process_mime_part_header(struct http_request *hr, const struct mime_part_headers *h)
|
||||
{
|
||||
httpd_request *r = (httpd_request *) hr;
|
||||
if (!h->content_disposition.type[0])
|
||||
return http_response_content_disposition(r, 415, "Missing", h->content_disposition.type);
|
||||
if (strcmp(h->content_disposition.type, "form-data") != 0)
|
||||
return http_response_content_disposition(r, 415, "Unsupported", h->content_disposition.type);
|
||||
if ( strcmp(h->content_disposition.name, PART_PAYLOAD) == 0
|
||||
|| strcmp(h->content_disposition.name, PART_DATA) == 0
|
||||
) {
|
||||
|
@ -470,6 +470,8 @@ static int insert_make_manifest(httpd_request *r)
|
||||
static int insert_mime_part_header(struct http_request *hr, const struct mime_part_headers *h)
|
||||
{
|
||||
httpd_request *r = (httpd_request *) hr;
|
||||
if (!h->content_disposition.type[0])
|
||||
return http_response_content_disposition(r, 415, "Missing", h->content_disposition.type);
|
||||
if (strcmp(h->content_disposition.type, "form-data") != 0)
|
||||
return http_response_content_disposition(r, 415, "Unsupported", h->content_disposition.type);
|
||||
if (strcmp(h->content_disposition.name, PART_AUTHOR) == 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user