mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-29 01:33:16 +03:00
File fetcher: Optimise HTTP header generation.
This commit is contained in:
parent
8d652f1ff4
commit
c14f01ea44
@ -99,19 +99,21 @@ static bool fetch_file_send_header(struct fetch_file_context *ctx,
|
||||
fetch_msg msg;
|
||||
char header[64];
|
||||
va_list ap;
|
||||
int len;
|
||||
|
||||
va_start(ap, fmt);
|
||||
|
||||
vsnprintf(header, sizeof header, fmt, ap);
|
||||
|
||||
len = vsnprintf(header, sizeof header, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
if (len >= (int)sizeof(header) || len < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
msg.type = FETCH_HEADER;
|
||||
msg.data.header_or_data.buf = (const uint8_t *) header;
|
||||
msg.data.header_or_data.len = strlen(header);
|
||||
fetch_file_send_callback(&msg, ctx);
|
||||
msg.data.header_or_data.len = len;
|
||||
|
||||
return ctx->aborted;
|
||||
return fetch_file_send_callback(&msg, ctx);
|
||||
}
|
||||
|
||||
/** callback to initialise the file fetcher. */
|
||||
|
Loading…
Reference in New Issue
Block a user