Jetty responds with 302 for multipart request (RAP file upload)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Jetty responds with 302 for multipart request (RAP file upload)

Ivan Furnadjiev
Hi all,
with RAP 3.5 release (Photon) we are facing a problem with file upload
under Jetty (9.4.10). The multipart POST request is answered with 302,
which leads to another similar request, but GET this time (expected
according to [1]), which is dropped by RAP file upload service handler.
Switching back to Jetty 9.4.7 solves the problem. The RAP file upload is
operational under Tomcat 8/9. Is this a regression in Jetty? Does anyone
have a clue, what has been changed and how to solve it?

[1] https://en.wikipedia.org/wiki/HTTP_302

Best regards,
Ivan

_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users

Clipboard01.png (381K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Jetty responds with 302 for multipart request (RAP file upload)

Greg Wilkins

Ivan,

It's a bit hard to say exactly what is going on here as we probably need a bit more info....
but I'll hazard some guesses.

Firstly, I don't know of anything in recent jetty releases that would send a 302 response to a multipart POST, so if the 302 being sent is new, then I don't think it is jetty that is sending it.

It is correct that a new request after a 302 should be a GET, but technically speaking a GET should not include a message body.   We've never really agreed with that part of the spec and Jetty is typically happy to accept a GET with a body.   However, you may wish to review your client and/or design if it really relies on this, as I'm pretty sure it is not required to be supported.

But looking at the image supplied, it does appear that a GET request is eventually generated that has the multipart content.

So how are you doing the file upload?  MultipartFilter?  Servlet 3.1 Part API?  ServletRequest.getParameter?

You could try adding POST to the methods that support form content in HttpConfigurationClass, but I'm not entirely sure that will help... but I'm guess there is some kind of method switch in the path that needs to be configured.   Tell us what the path is and we can tell you more.

cheers









 

On 4 July 2018 at 13:00, Ivan Furnadjiev <[hidden email]> wrote:
Hi all,
with RAP 3.5 release (Photon) we are facing a problem with file upload under Jetty (9.4.10). The multipart POST request is answered with 302, which leads to another similar request, but GET this time (expected according to [1]), which is dropped by RAP file upload service handler. Switching back to Jetty 9.4.7 solves the problem. The RAP file upload is operational under Tomcat 8/9. Is this a regression in Jetty? Does anyone have a clue, what has been changed and how to solve it?

[1] https://en.wikipedia.org/wiki/HTTP_302

Best regards,
Ivan

_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users



--

_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users
Reply | Threaded
Open this post in threaded view
|

Re: Jetty responds with 302 for multipart request (RAP file upload)

Ivan Furnadjiev
Hi,
just received some more information about the issue on bug:
536620: File upload issue with RAP 3.5.0 (Photon)
https://bugs.eclipse.org/bugs/show_bug.cgi?id=536620
It seems that this problem has been introduced by Equinox HTTP and not the Jetty itself. We will continue with the investigation. I'll keep you posted about the results.
Best regards,
Ivan

On 7/4/2018 14:39, Greg Wilkins wrote:

Ivan,

It's a bit hard to say exactly what is going on here as we probably need a bit more info....
but I'll hazard some guesses.

Firstly, I don't know of anything in recent jetty releases that would send a 302 response to a multipart POST, so if the 302 being sent is new, then I don't think it is jetty that is sending it.

It is correct that a new request after a 302 should be a GET, but technically speaking a GET should not include a message body.   We've never really agreed with that part of the spec and Jetty is typically happy to accept a GET with a body.   However, you may wish to review your client and/or design if it really relies on this, as I'm pretty sure it is not required to be supported.

But looking at the image supplied, it does appear that a GET request is eventually generated that has the multipart content.

So how are you doing the file upload?  MultipartFilter?  Servlet 3.1 Part API?  ServletRequest.getParameter?

You could try adding POST to the methods that support form content in HttpConfigurationClass, but I'm not entirely sure that will help... but I'm guess there is some kind of method switch in the path that needs to be configured.   Tell us what the path is and we can tell you more.

cheers









 

On 4 July 2018 at 13:00, Ivan Furnadjiev <[hidden email]> wrote:
Hi all,
with RAP 3.5 release (Photon) we are facing a problem with file upload under Jetty (9.4.10). The multipart POST request is answered with 302, which leads to another similar request, but GET this time (expected according to [1]), which is dropped by RAP file upload service handler. Switching back to Jetty 9.4.7 solves the problem. The RAP file upload is operational under Tomcat 8/9. Is this a regression in Jetty? Does anyone have a clue, what has been changed and how to solve it?

[1] https://en.wikipedia.org/wiki/HTTP_302

Best regards,
Ivan

_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users



--


_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users