B2G/gecko/dom/mobilemessage/src/ril/MmsPduHelper.jsm
/**
   * @param data
   *        A wrapped object containing raw PDU data.
   * @param headers
   *        An optional object to store parsed header fields. Created
   *        automatically if undefined.
   *
   * @return A boolean value indicating whether it's followed by message body.
   */
@param data
A wrapped object containing raw PDU data.
@param headers
An optional object to store parsed header fields. Created
automatically if undefined.

@return A boolean value indicating whether it's followed by message body.
@param data A wrapped object containing raw PDU data . @param headers An optional object to store parsed header fields . Created automatically if undefined . @return A boolean value indicating whether it ' s followed by message body .
function parseHeaders(data, headers) {
    if (!headers) {
      headers = {};
    }
    let header;
    while (data.offset < data.array.length) {
      header = HeaderField.decode(data, headers);
      if (header) {
        let orig = headers[header.name];
        if (Array.isArray(orig)) {
          headers[header.name].push(header.value);
        } else if (orig) {
          headers[header.name] = [orig, header.value];
        } else {
          headers[header.name] = header.value;
        }
        if (header.name == "content-type") {
          break;
        }
      }
    }
    return headers;
  }
function parseHeaders ( data , headers ) { if ( ! headers ) { headers = { } ; } let header ; while ( data . offset < data . array . length ) { header = HeaderField . decode ( data , headers ) ; if ( header ) { let orig = headers [ header . name ] ; if ( Array . isArray ( orig ) ) { headers [ header . name ] . push ( header . value ) ; } else if ( orig ) { headers [ header . name ] = [ orig , header . value ] ; } else { headers [ header . name ] = header . value ; } if ( header . name == "content-type" ) { break ; } } } return headers ; }
@param data
        A wrapped object containing raw PDU data.
@param data A wrapped object containing raw PDU data .
// There is no `header length` information in MMS PDU. If we just got // something wrong in parsing header fields, we might not be able to // determine the correct header-content boundary. // `... if the PDU contains a message body the Content Type MUST be // the last header field, followed by message body.` See // OMA-TS-MMS_ENC-V1_3-20110913-A section 7.