inetcomm: Read content encoding from MIME header.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
dec243fd2a
commit
56dc24695e
|
@ -765,6 +765,22 @@ static void init_content_type(MimeBody *body, header_t *header)
|
||||||
body->content_sub_type = strdupA(slash + 1);
|
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)
|
static HRESULT parse_headers(MimeBody *body, IStream *stm)
|
||||||
{
|
{
|
||||||
char *header_buf, *cur_header_ptr;
|
char *header_buf, *cur_header_ptr;
|
||||||
|
@ -780,8 +796,14 @@ static HRESULT parse_headers(MimeBody *body, IStream *stm)
|
||||||
read_value(header, &cur_header_ptr);
|
read_value(header, &cur_header_ptr);
|
||||||
list_add_tail(&body->headers, &header->entry);
|
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);
|
init_content_type(body, header);
|
||||||
|
break;
|
||||||
|
case PID_HDR_CNTXFER:
|
||||||
|
init_content_encoding(body, header);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, header_buf);
|
HeapFree(GetProcessHeap(), 0, header_buf);
|
||||||
|
|
|
@ -150,7 +150,6 @@ static void test_CreateBody(void)
|
||||||
IStream *in;
|
IStream *in;
|
||||||
LARGE_INTEGER off;
|
LARGE_INTEGER off;
|
||||||
ULARGE_INTEGER pos;
|
ULARGE_INTEGER pos;
|
||||||
ENCODINGTYPE enc;
|
|
||||||
ULONG count, found_param, i;
|
ULONG count, found_param, i;
|
||||||
MIMEPARAMINFO *param_info;
|
MIMEPARAMINFO *param_info;
|
||||||
IMimeAllocator *alloc;
|
IMimeAllocator *alloc;
|
||||||
|
@ -191,9 +190,7 @@ static void test_CreateBody(void)
|
||||||
hr = IMimeBody_IsContentType(body, "text", "plain");
|
hr = IMimeBody_IsContentType(body, "text", "plain");
|
||||||
todo_wine
|
todo_wine
|
||||||
ok(hr == S_OK, "ret %08x\n", hr);
|
ok(hr == S_OK, "ret %08x\n", hr);
|
||||||
hr = IMimeBody_GetCurrentEncoding(body, &enc);
|
test_current_encoding(body, IET_8BIT);
|
||||||
ok(hr == S_OK, "ret %08x\n", hr);
|
|
||||||
ok(enc == IET_8BIT, "encoding %d\n", enc);
|
|
||||||
|
|
||||||
memset(&offsets, 0xcc, sizeof(offsets));
|
memset(&offsets, 0xcc, sizeof(offsets));
|
||||||
hr = IMimeBody_GetOffsets(body, &offsets);
|
hr = IMimeBody_GetOffsets(body, &offsets);
|
||||||
|
@ -658,7 +655,6 @@ static void test_CreateMessage(void)
|
||||||
ok(count == 2, "got %d\n", count);
|
ok(count == 2, "got %d\n", count);
|
||||||
if(count == 2)
|
if(count == 2)
|
||||||
{
|
{
|
||||||
ENCODINGTYPE encoding;
|
|
||||||
IMimeBody *attachment;
|
IMimeBody *attachment;
|
||||||
PROPVARIANT prop;
|
PROPVARIANT prop;
|
||||||
|
|
||||||
|
@ -670,9 +666,7 @@ static void test_CreateMessage(void)
|
||||||
hr = IMimeBody_IsContentType(attachment, "multipart", NULL);
|
hr = IMimeBody_IsContentType(attachment, "multipart", NULL);
|
||||||
ok(hr == S_FALSE, "ret %08x\n", hr);
|
ok(hr == S_FALSE, "ret %08x\n", hr);
|
||||||
|
|
||||||
hr = IMimeBody_GetCurrentEncoding(attachment, &encoding);
|
test_current_encoding(attachment, IET_8BIT);
|
||||||
ok(hr == S_OK, "ret %08x\n", hr);
|
|
||||||
todo_wine ok(encoding == IET_8BIT, "ret %d\n", encoding);
|
|
||||||
|
|
||||||
prop.vt = VT_LPSTR;
|
prop.vt = VT_LPSTR;
|
||||||
hr = IMimeBody_GetProp(attachment, "Content-Transfer-Encoding", 0, &prop);
|
hr = IMimeBody_GetProp(attachment, "Content-Transfer-Encoding", 0, &prop);
|
||||||
|
|
Loading…
Reference in New Issue