Bug 958896 - RESTEasy: Invalid Content-Type in response - Bad behavior when invalid accept header is specified in request header
Summary: RESTEasy: Invalid Content-Type in response - Bad behavior when invalid accept...
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: RESTEasy
Version: 6.1.0
Hardware: Unspecified
OS: Linux
high
high
Target Milestone: ER6
: EAP 6.1.0
Assignee: Weinan Li
QA Contact: Nobody
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-05-02 15:41 UTC by agalad
Modified: 2014-06-18 07:54 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Known Issue
Doc Text:
There exists a problem within the RESTEasy subsystem of JBoss EAP 6 where an incorrect `HTTP 200` response is sent when there is an invalid accept header in a received HTTP request. When an invalid accept header is provided, the correct response should be `HTTP 500`. This issue is currently under investigation.
Clone Of:
Environment:
Last Closed: 2014-06-18 07:54:25 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description agalad 2013-05-02 15:41:06 UTC
Description of problem:

This problem was first discovered when running RESTEasy testsuite as test org.jboss.resteasy.test.providers.jaxb.regression.TestBadContentType.testHtmlError in jaxb providers was occasionally failing. One way of choosing appropriate jaxb provider for (un)marshalling data is defining request accept header (simulated in mentioned test). This works fine for valid accept header such as text/xml. However if invalid accept header is provided (header for which there is no suitable provider) such as text/html instead of receiving response status 500 (no suitable provider was found) somewhere on the way to server content type is replaced by */* and first matching provider is used (response is 200).


Version-Release number of selected component (if applicable):

RESTEasy 2.3.5.Final and RESTEasy 2.3.6.

How reproducible:

I have created a simple web project simulating this problem where accept header can be provided and corresponding response observed.

Steps to Deploy:

1. Clone project from github: git clone https://github.com/badassviking/resteasy-mimetest.git
2. Start Jboss-As: JBOSS_HOME/bin/standalone.sh
3. Deploy application from cloned repo: mvn clean package jboss-as:deploy
4. Application will be running on the following url: http://localhost:8080/ResteasyMimeTest/ (port might be different)

Steps to Reproduce:
1. Enter text/html in Accepts
2. Enter */* in Accepts
3. Enter foo/bar in Accepts
  
Actual results:

1. Response Status: OK, Content-Type: [*/*]
2. Response Status: OK, Content-Type: [*/*]
3. Response Status: OK, Content-Type: [*/*]


Expected results:

1. Response Status: 500 Could not find MessageBodyWriter for response object of of media type: text/html
2. Response Status: OK, Content-Type: specific type like text/xml or application/xml based on used provider
3. Response Status: 500 Could not find MessageBodyWriter for response object of of media type: foo/bar


Additional info:

Comment 5 Weinan Li 2013-11-26 13:39:24 UTC
Verified that RESTEasy 3.0.5.Final fixed this issue.

Comment 6 Weinan Li 2013-11-26 13:40:42 UTC
Do we have to fix this in Branch_2_3? I propose we mark it as "won't fix".

Comment 8 Weinan Li 2014-06-18 07:54:25 UTC
EAP7 + RESTEasy 3.x will fix this problem.


Note You need to log in before you can comment on or make changes to this bug.