Commit 56dc2469 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

inetcomm: Read content encoding from MIME header.

parent dec243fd
......@@ -765,6 +765,22 @@ static void init_content_type(MimeBody *body, header_t *header)
body->content_sub_type = strdupA(slash + 1);
}
static void init_content_encoding(MimeBody *body, header_t *header)
{
const char *encoding = header->value.u.pszVal;
if(!strcasecmp(encoding, "base64"))
body->encoding = IET_BASE64;
else if(!strcasecmp(encoding, "quoted-printable"))
body->encoding = IET_QP;
else if(!strcasecmp(encoding, "7bit"))
body->encoding = IET_7BIT;
else if(!strcasecmp(encoding, "8bit"))
body->encoding = IET_8BIT;
else
FIXME("unknown encoding %s\n", debugstr_a(encoding));
}
static HRESULT parse_headers(MimeBody *body, IStream *stm)
{
char *header_buf, *cur_header_ptr;
......@@ -780,8 +796,14 @@ static HRESULT parse_headers(MimeBody *body, IStream *stm)
read_value(header, &cur_header_ptr);
list_add_tail(&body->headers, &header->entry);
if(header->prop->id == PID_HDR_CNTTYPE)
switch(header->prop->id) {
case PID_HDR_CNTTYPE:
init_content_type(body, header);
break;
case PID_HDR_CNTXFER:
init_content_encoding(body, header);
break;
}
}
HeapFree(GetProcessHeap(), 0, header_buf);
......
......@@ -150,7 +150,6 @@ static void test_CreateBody(void)
IStream *in;
LARGE_INTEGER off;
ULARGE_INTEGER pos;
ENCODINGTYPE enc;
ULONG count, found_param, i;
MIMEPARAMINFO *param_info;
IMimeAllocator *alloc;
......@@ -191,9 +190,7 @@ static void test_CreateBody(void)
hr = IMimeBody_IsContentType(body, "text", "plain");
todo_wine
ok(hr == S_OK, "ret %08x\n", hr);
hr = IMimeBody_GetCurrentEncoding(body, &enc);
ok(hr == S_OK, "ret %08x\n", hr);
ok(enc == IET_8BIT, "encoding %d\n", enc);
test_current_encoding(body, IET_8BIT);
memset(&offsets, 0xcc, sizeof(offsets));
hr = IMimeBody_GetOffsets(body, &offsets);
......@@ -658,7 +655,6 @@ static void test_CreateMessage(void)
ok(count == 2, "got %d\n", count);
if(count == 2)
{
ENCODINGTYPE encoding;
IMimeBody *attachment;
PROPVARIANT prop;
......@@ -670,9 +666,7 @@ static void test_CreateMessage(void)
hr = IMimeBody_IsContentType(attachment, "multipart", NULL);
ok(hr == S_FALSE, "ret %08x\n", hr);
hr = IMimeBody_GetCurrentEncoding(attachment, &encoding);
ok(hr == S_OK, "ret %08x\n", hr);
todo_wine ok(encoding == IET_8BIT, "ret %d\n", encoding);
test_current_encoding(attachment, IET_8BIT);
prop.vt = VT_LPSTR;
hr = IMimeBody_GetProp(attachment, "Content-Transfer-Encoding", 0, &prop);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment