Loading ...
Sorry, an error occurred while loading the content.

MIME CRLF interop bug with Axis...

Expand Messages
  • Byrne Reese
    I wanted to post a patch to MIME::Entity which will resolve a long standing interop bug between SOAP::Lite and Apache Axis. The problem will be resolved
    Message 1 of 2 , Jun 2, 2003
    • 0 Attachment
      I wanted to post a patch to MIME::Entity which will resolve a long
      standing interop bug between SOAP::Lite and Apache Axis. The problem
      will be resolved permanently in the next SOAP::Lite/SOAP::MIME release
      (so stay tuned).

      [With any luck, this patch will actually be made to MIME::Entity - and
      I working with the author of that toolkit to get it patched.]

      In summary, the problem has to do with MIME::Entity's use of newline
      characters exclusively as mime boundary delimitation -- when in fact
      it should CRLFs. The fix is to MIME::Entity::print_body. If you need
      to be interacting with Apache Axis services ASAP - add this to your
      perl scripts:

      BEGIN {

      sub MIME::Entity::print_body {
      my ($self, $out) = @_;
      $out = MIME::Entity::wraphandle($out || select); ### get a
      printable output
      my ($type) = split '/', lc($self->mime_type); ### handle by MIME type

      ### Multipart...
      if ($type eq 'multipart') {
      my $boundary = $self->head->multipart_boundary;

      ### Preamble:
      my $preamble = join('', @{ $self->preamble || $DefPreamble });
      $out->print("$preamble\n") if ($preamble ne '');

      ### Parts:
      my $part;
      foreach $part ($self->parts) {
      # PATCHED!!!!! Added the '\r'
      $out->print("--$boundary\r\n");
      $part->print($out);
      # PATCHED!!!!! Added the '\r'
      $out->print("\r\n"); ### needed for next delim/close
      }
      # PATCHED!!!!! Added the '\r'
      $out->print("--$boundary--\r\n");

      ### Epilogue:
      my $epilogue = join('', @{ $self->epilogue || $DefEpilogue });
      if ($epilogue ne '') {
      $out->print($epilogue);
      # PATCHED!!!!! Added the '\r'
      $out->print("\n") if ($epilogue !~ /\n\Z/); ### be nice
      }
      }

      ### Singlepart type with parts...
      ### This makes $ent->print handle message/rfc822 bodies
      ### when parse_nested_messages('NEST') is on [idea by Marc
      Rouleau].
      elsif ($self->parts) {
      my $need_sep = 0;
      my $part;
      foreach $part ($self->parts) {
      $out->print("\n\n") if $need_sep++;
      $part->print($out);
      }
      }

      ### Singlepart type, or no parts: output body...
      else {
      $self->bodyhandle ? $self->print_bodyhandle($out)
      : MIME::Entity::whine "missing body; treated as empty";
      }
      1;
      }
      }
    • Simon Fell
      Great!, in addition this should also fix interop problems with PocketSOAPs SwA support. Cheers Simon www.pocketsoap.com
      Message 2 of 2 , Jun 2, 2003
      • 0 Attachment
        Great!, in addition this should also fix interop problems with
        PocketSOAPs SwA support.

        Cheers
        Simon
        www.pocketsoap.com

        On Mon, 02 Jun 2003 23:25:16 -0000, in soap you wrote:

        >I wanted to post a patch to MIME::Entity which will resolve a long
        >standing interop bug between SOAP::Lite and Apache Axis. The problem
        >will be resolved permanently in the next SOAP::Lite/SOAP::MIME release
        >(so stay tuned).
        >
        >[With any luck, this patch will actually be made to MIME::Entity - and
        >I working with the author of that toolkit to get it patched.]
        >
        >In summary, the problem has to do with MIME::Entity's use of newline
        >characters exclusively as mime boundary delimitation -- when in fact
        >it should CRLFs. The fix is to MIME::Entity::print_body. If you need
        >to be interacting with Apache Axis services ASAP - add this to your
        >perl scripts:
      Your message has been successfully submitted and would be delivered to recipients shortly.