You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by "gchauvet (via GitHub)" <gi...@apache.org> on 2024/02/05 20:30:20 UTC

[PR] CXF-8975: Missing ending CRLF in multipart request [cxf]

gchauvet opened a new pull request, #1674:
URL: https://github.com/apache/cxf/pull/1674

   Please find attached my pull-request regarding the ticket I reported on https://issues.apache.org/jira/browse/CXF-8975 concerning a problem serializing a multipart message.
   
   Please note that I made the correction for the 3.5.x branch, but that it should also be carried over to 3.1.x. However, I haven't managed to compile the branch on my Windows workstation due to the default encoding of the generated files, as well as several unit tests that don't pass.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CXF-8975: Missing ending CRLF in multipart request [cxf]

Posted by "reta (via GitHub)" <gi...@apache.org>.
reta commented on code in PR #1674:
URL: https://github.com/apache/cxf/pull/1674#discussion_r1479029957


##########
core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java:
##########
@@ -327,7 +327,7 @@ public void writeAttachments() throws IOException {
         StringWriter writer = new StringWriter();
         writer.write("\r\n--");
         writer.write(bodyBoundary);
-        writer.write("--");
+        writer.write("--\r\n");

Review Comment:
   @gchauvet this is not correct as per rfc1341 (see please https://www.w3.org/Protocols/rfc1341/7_2_Multipart.html):
   
   ```
   Overall, the body of a multipart entity may be specified as follows:
   multipart-body := preamble 1*encapsulation 
                  close-delimiter epilogue 
   
   encapsulation := delimiter CRLF body-part 
   
   delimiter := CRLF "--" boundary   ; taken from  Content-Type 
   field. 
                                  ;   when   content-type    is 
   multipart 
                                ; There must be no space 
                                ; between "--" and boundary. 
   
   close-delimiter := delimiter "--" ; Again, no  space  before 
   "--" 
   
   preamble :=  *text                  ;  to  be  ignored  upon 
   receipt. 
   
   epilogue :=  *text                  ;  to  be  ignored  upon 
   receipt. 
   
   body-part = <"message" as defined in RFC 822, 
            with all header fields optional, and with the 
            specified delimiter not occurring anywhere in 
            the message body, either on a line by itself 
            or as a substring anywhere.  Note that the 
            semantics of a part differ from the semantics 
            of a message, as described in the text.>
   ```
   
   
   The element in question is 
   ```
   close-delimiter := delimiter "--" ; Again, no  space  before 
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CXF-8975: Missing ending CRLF in multipart request [cxf]

Posted by "gchauvet (via GitHub)" <gi...@apache.org>.
gchauvet commented on code in PR #1674:
URL: https://github.com/apache/cxf/pull/1674#discussion_r1481279362


##########
core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java:
##########
@@ -327,7 +327,7 @@ public void writeAttachments() throws IOException {
         StringWriter writer = new StringWriter();
         writer.write("\r\n--");
         writer.write(bodyBoundary);
-        writer.write("--");
+        writer.write("--\r\n");

Review Comment:
   Okay, this is a trick from the webservice provider for security purpose. We've found a workaround, there's no longer any problem. thank you.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CXF-8975: Missing ending CRLF in multipart request [cxf]

Posted by "reta (via GitHub)" <gi...@apache.org>.
reta commented on code in PR #1674:
URL: https://github.com/apache/cxf/pull/1674#discussion_r1479029957


##########
core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java:
##########
@@ -327,7 +327,7 @@ public void writeAttachments() throws IOException {
         StringWriter writer = new StringWriter();
         writer.write("\r\n--");
         writer.write(bodyBoundary);
-        writer.write("--");
+        writer.write("--\r\n");

Review Comment:
   @gchauvet this is not correct as per rfc1341 (see please https://www.w3.org/Protocols/rfc1341/7_2_Multipart.html):
   
   ```
   Overall, the body of a multipart entity may be specified as follows:
   multipart-body := preamble 1*encapsulation 
                  close-delimiter epilogue 
   
   encapsulation := delimiter CRLF body-part 
   
   delimiter := CRLF "--" boundary   ; taken from  Content-Type 
   field. 
                                  ;   when   content-type    is 
   multipart 
                                ; There must be no space 
                                ; between "--" and boundary. 
   
   close-delimiter := delimiter "--" ; Again, no  space  before 
   "--" 
   
   preamble :=  *text                  ;  to  be  ignored  upon 
   receipt. 
   
   epilogue :=  *text                  ;  to  be  ignored  upon 
   receipt. 
   
   body-part = <"message" as defined in RFC 822, 
            with all header fields optional, and with the 
            specified delimiter not occurring anywhere in 
            the message body, either on a line by itself 
            or as a substring anywhere.  Note that the 
            semantics of a part differ from the semantics 
            of a message, as described in the text.>
   ```
   
   
   The element in question is 
   ```
   close-delimiter := delimiter "--" ; Again, no  space  before 
   ```
   "--" 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CXF-8975: Missing ending CRLF in multipart request [cxf]

Posted by "gchauvet (via GitHub)" <gi...@apache.org>.
gchauvet commented on code in PR #1674:
URL: https://github.com/apache/cxf/pull/1674#discussion_r1479372350


##########
core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java:
##########
@@ -327,7 +327,7 @@ public void writeAttachments() throws IOException {
         StringWriter writer = new StringWriter();
         writer.write("\r\n--");
         writer.write(bodyBoundary);
-        writer.write("--");
+        writer.write("--\r\n");

Review Comment:
   hello @reta, 
   
   Unless I've misinterpreted the quote below, aren't we supposed to have a CRLF?
   > Note that the encapsulation boundary must occur at the beginning of a line, i.e., following a CRLF, and that that initial CRLF is considered to be part of the encapsulation boundary rather than part of the preceding part. The boundary must be followed immediately either by another CRLF and the header fields for the next part, or by two CRLFs, in which case there are no header fields for the next part (and it is therefore assumed to be of Content-Type text/plain).
   
   Or the webservice I'm calling follows RFC 2046 (https://www.rfc-editor.org/rfc/rfc2046#page-44):
   ```
   multipart-body := [preamble CRLF]
                     dash-boundary transport-padding CRLF
                     body-part *encapsulation
                     close-delimiter transport-padding
                     [CRLF epilogue]



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CXF-8975: Missing ending CRLF in multipart request [cxf]

Posted by "gchauvet (via GitHub)" <gi...@apache.org>.
gchauvet commented on code in PR #1674:
URL: https://github.com/apache/cxf/pull/1674#discussion_r1479372350


##########
core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java:
##########
@@ -327,7 +327,7 @@ public void writeAttachments() throws IOException {
         StringWriter writer = new StringWriter();
         writer.write("\r\n--");
         writer.write(bodyBoundary);
-        writer.write("--");
+        writer.write("--\r\n");

Review Comment:
   hello @reta, 
   
   erratum: I'm in the situation where I'm only transmitting a single document, so it doesn't look like there's any need for a CRLF at the end.
   
   I'm going to contact the the webservice provider that's causing the issue.
   
   Thanks



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CXF-8975: Missing ending CRLF in multipart request [cxf]

Posted by "gchauvet (via GitHub)" <gi...@apache.org>.
gchauvet closed pull request #1674: CXF-8975: Missing ending CRLF in multipart request
URL: https://github.com/apache/cxf/pull/1674


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org