Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: Source/core/loader/archive/MHTMLParser.cpp

Issue 22292008: Add 8bit Content-Transfer-Encoding support for reading MHTML files (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Try to fix line endings #5 Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 switch (mimeHeader.contentTransferEncoding()) { 195 switch (mimeHeader.contentTransferEncoding()) {
196 case MIMEHeader::Base64: 196 case MIMEHeader::Base64:
197 if (!base64Decode(content->data(), content->size(), data)) { 197 if (!base64Decode(content->data(), content->size(), data)) {
198 LOG_ERROR("Invalid base64 content for MHTML part."); 198 LOG_ERROR("Invalid base64 content for MHTML part.");
199 return 0; 199 return 0;
200 } 200 }
201 break; 201 break;
202 case MIMEHeader::QuotedPrintable: 202 case MIMEHeader::QuotedPrintable:
203 quotedPrintableDecode(content->data(), content->size(), data); 203 quotedPrintableDecode(content->data(), content->size(), data);
204 break; 204 break;
205 case MIMEHeader::EightBit:
205 case MIMEHeader::SevenBit: 206 case MIMEHeader::SevenBit:
206 case MIMEHeader::Binary: 207 case MIMEHeader::Binary:
207 data.append(content->data(), content->size()); 208 data.append(content->data(), content->size());
208 break; 209 break;
209 default: 210 default:
210 LOG_ERROR("Invalid encoding for MHTML part."); 211 LOG_ERROR("Invalid encoding for MHTML part.");
211 return 0; 212 return 0;
212 } 213 }
213 RefPtr<SharedBuffer> contentBuffer = SharedBuffer::adoptVector(data); 214 RefPtr<SharedBuffer> contentBuffer = SharedBuffer::adoptVector(data);
214 // FIXME: the URL in the MIME header could be relative, we should resolve it if it is. 215 // FIXME: the URL in the MIME header could be relative, we should resolve it if it is.
(...skipping 17 matching lines...) Expand all
232 { 233 {
233 return m_resources.size(); 234 return m_resources.size();
234 } 235 }
235 236
236 ArchiveResource* MHTMLParser::subResourceAt(size_t index) const 237 ArchiveResource* MHTMLParser::subResourceAt(size_t index) const
237 { 238 {
238 return m_resources[index].get(); 239 return m_resources[index].get();
239 } 240 }
240 241
241 } 242 }
OLDNEW
« no previous file with comments | « LayoutTests/mhtml/transfer_encoding_8bit-expected.txt ('k') | Source/core/platform/network/MIMEHeader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698