Skip to content

Commit

Permalink
Generation of boundary for output body
Browse files Browse the repository at this point in the history
  • Loading branch information
Valery Kholodkov committed Feb 21, 2009
1 parent 5b26659 commit 06a8705
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions ngx_http_upload_module.c
Expand Up @@ -2819,6 +2819,7 @@ static ngx_int_t upload_parse_request_headers(ngx_http_upload_ctx_t *upload_ctx,
u_char *boundary_start_ptr, *boundary_end_ptr;
ngx_http_upload_header_t *h;
ngx_int_t rc;
ngx_atomic_uint_t boundary;

// Check whether Content-Type header is missing
if(headers_in->content_type == NULL) {
Expand Down Expand Up @@ -2876,11 +2877,25 @@ static ngx_int_t upload_parse_request_headers(ngx_http_upload_ctx_t *upload_ctx,

upload_ctx->content_type = *content_type;

content_type->data = (u_char*)MULTIPART_FORM_DATA_STRING "; boundary=BLAH";
content_type->len = sizeof(MULTIPART_FORM_DATA_STRING "; boundary=BLAH") - 1;
boundary = ngx_next_temp_number(0);

boundary_start_ptr = (u_char*)"BLAH";
boundary_end_ptr = boundary_start_ptr + 4;
content_type->data =
ngx_pnalloc(upload_ctx->request->pool,
sizeof(MULTIPART_FORM_DATA_STRING "; boundary=") - 1
+ NGX_ATOMIC_T_LEN);

if (content_type->data == NULL) {
return NGX_ERROR;
}

content_type->len =
ngx_sprintf(content_type->data,
MULTIPART_FORM_DATA_STRING "; boundary=%0muA",
boundary)
- content_type->data;

boundary_start_ptr = content_type->data + sizeof(MULTIPART_FORM_DATA_STRING "; boundary=") - 1;
boundary_end_ptr = content_type->data + content_type->len;
}
else{
// Find colon in content type string, which terminates mime type
Expand Down

0 comments on commit 06a8705

Please sign in to comment.