Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content type is quoted leading to boundary of multipart being double quoted #95

Closed
Shucki opened this issue Sep 11, 2019 · 8 comments
Closed
Assignees
Labels

Comments

@Shucki
Copy link

Shucki commented Sep 11, 2019

Since version 4.4.2 mendelson can no longer process an MDN response received. Looking at the response it seems that the boundary of the multipart is an issue.
The entire content type seems to be quoted the wrong way:
Content-Type: "multipart/report; report-type=disposition-notification; boundary=\"----=_Part_0_578487367.1568197726076\""
I have not enabled the quote header values setting.

I have not found an RFC that specifies the content type in quotes. I believe the issue is the AS2HttpHeaderSetter setting the header according to the whole value and not the contents of the value.

@phax phax self-assigned this Sep 11, 2019
@phax phax added the bug label Sep 11, 2019
@phax
Copy link
Owner

phax commented Sep 11, 2019

Yes I noticed that myself, and that's why 4.4.3 was released - that should fix the issue.

@phax
Copy link
Owner

phax commented Sep 11, 2019

I just tested it and it works fine again. Sorry for any inconvenience it caused.

@phax phax closed this as completed Sep 11, 2019
@Shucki
Copy link
Author

Shucki commented Sep 11, 2019

I am still experiencing it with 4.4.3:

* Done waiting for 100-continue
* We are completely uploaded and fine
< HTTP/1.1 200 OK
< AS2-To: mendelson
< AS2-From: openas2
< AS2-Version: 1.1
< Date: "Mi, 11 Sep 2019 15:00:45 +0200"
< Server: "ph-OpenAS2 4.4.3"
< Mime-Version: 1.0
< Subject: "Your Requested MDN Response"
< Content-Transfer-Encoding: binary
< Content-Type: "multipart/report; report-type=disposition-notification;    boundary=\"----=_Part_0_172702331.1568206845081\""
< Message-ID: "<ph-OpenAS2-11092019150045+0200-7071@OPENAS2_MENDELSON>"
< Content-Length: 756

Edit: I have used curl for the output above, mendelson gives me the following output

[3:03:26 PM] Message sent successfully (HTTP 200); 3.65 KB transfered in 6.10s [0.60 KB/s].
[3:03:26 PM] Generating outbound MDN, setting message id to "null".
[3:03:31 PM] Outbound MDN created for AS2 message "mendelson_opensource_AS2-1568207006698-9@unknown_unknown", state set to [null].
[3:03:31 PM] Outbound MDN details: null
[3:03:31 PM] AS2ServerProcessing: [java.lang.RuntimeException] Unexpected MDN received: No related message exists for inbound MDN "null"
[3:03:31 PM] Unable to process on server: Incoming message response
[3:03:31 PM] performUserDefinedProcessing: inbound message of class de.mendelson.comm.as2.clientserver.message.IncomingMessageRequest has not been processed.

@phax phax reopened this Sep 11, 2019
@phax
Copy link
Owner

phax commented Sep 12, 2019

Well, that is a bit weird. Prior to 4.4.2 no header was quoted, so I'm confused why it is quoted now.
Can you please enable the dumping of outgoing messages.
One way to do that is to set the system property AS2.httpDumpDirectoryOutgoing to an existing directory, and than perform the transmission again.

@Shucki
Copy link
Author

Shucki commented Sep 16, 2019

I am not getting a dump for the outgoing message (I enabled both incoming and outgoing, incoming does work but the MDN is not dumped).
I am using sync MDN, so the AS2ReceiverHandler sends the MDN in sendMDN.
With debugging I found:

start: AS2ReceiverHandler line 412

  1. AS2HttpresponseHandlerSocket Line 103 call aHeaders.getAllHeaderLines(true)
  2. in HttpHeaderMap line 731 getAllHeaderLines calls forEachHeaderLine
  3. HttpHeaderMap forEachHeaderLine and forEachSingleHeaderLine call quoteIfNecessary with "true".
    Line 701 in HTTPHeaderMap:
    final String sHeaderLine = sKey + ": " + (bUnifyValue ? getUnifiedValue (sValue, true) : sValue);

this leads to the quoting of the content type (and other headers).

In version 4.4.1 the method forEachHeaderLine looks different:
final String sHeaderLine = sKey + ": " + getUnifiedValue (sValue);

@phax
Copy link
Owner

phax commented Sep 27, 2019

Release 4.4.4 is out and should fix that. Sorry for inconvenience. Please confirm that it works. Thx.

@phax phax closed this as completed Oct 1, 2019
@Shucki
Copy link
Author

Shucki commented Oct 1, 2019

I can confirm that strings are no longer quoted in 4.4.4 in my case. Tested with curl and checked output manually and mendelson also works again. Thank you for the quick fix and release.

@phax
Copy link
Owner

phax commented Oct 1, 2019

Thanks for crosschecking :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants