| OLD | NEW |
| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 } | 59 } |
| 60 // New key/value, store the previous one if any. | 60 // New key/value, store the previous one if any. |
| 61 if (!key.isEmpty()) { | 61 if (!key.isEmpty()) { |
| 62 if (keyValuePairs.find(key) != keyValuePairs.end()) | 62 if (keyValuePairs.find(key) != keyValuePairs.end()) |
| 63 LOG_ERROR("Key duplicate found in MIME header. Key is '%s', prev
ious value replaced.", key.ascii().data()); | 63 LOG_ERROR("Key duplicate found in MIME header. Key is '%s', prev
ious value replaced.", key.ascii().data()); |
| 64 keyValuePairs.add(key, value.toString().stripWhiteSpace()); | 64 keyValuePairs.add(key, value.toString().stripWhiteSpace()); |
| 65 key = String(); | 65 key = String(); |
| 66 value.clear(); | 66 value.clear(); |
| 67 } | 67 } |
| 68 size_t semiColonIndex = line.find(':'); | 68 size_t semiColonIndex = line.find(':'); |
| 69 if (semiColonIndex == notFound) { | 69 if (semiColonIndex == kNotFound) { |
| 70 // This is not a key value pair, ignore. | 70 // This is not a key value pair, ignore. |
| 71 continue; | 71 continue; |
| 72 } | 72 } |
| 73 key = line.substring(0, semiColonIndex).lower().stripWhiteSpace(); | 73 key = line.substring(0, semiColonIndex).lower().stripWhiteSpace(); |
| 74 value.append(line.substring(semiColonIndex + 1)); | 74 value.append(line.substring(semiColonIndex + 1)); |
| 75 } | 75 } |
| 76 // Store the last property if there is one. | 76 // Store the last property if there is one. |
| 77 if (!key.isEmpty()) | 77 if (!key.isEmpty()) |
| 78 keyValuePairs.set(key, value.toString().stripWhiteSpace()); | 78 keyValuePairs.set(key, value.toString().stripWhiteSpace()); |
| 79 return keyValuePairs; | 79 return keyValuePairs; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 LOG_ERROR("Unknown encoding '%s' found in MIME header.", text.ascii().data()
); | 129 LOG_ERROR("Unknown encoding '%s' found in MIME header.", text.ascii().data()
); |
| 130 return Unknown; | 130 return Unknown; |
| 131 } | 131 } |
| 132 | 132 |
| 133 MIMEHeader::MIMEHeader() | 133 MIMEHeader::MIMEHeader() |
| 134 : m_contentTransferEncoding(Unknown) | 134 : m_contentTransferEncoding(Unknown) |
| 135 { | 135 { |
| 136 } | 136 } |
| 137 | 137 |
| 138 } | 138 } |
| OLD | NEW |