Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 958896 - RESTEasy: Invalid Content-Type in response - Bad behavior when invalid accept header is specified in request header
RESTEasy: Invalid Content-Type in response - Bad behavior when invalid accept...
Status: CLOSED UPSTREAM
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: RESTEasy (Show other bugs)
6.1.0
Unspecified Linux
high Severity high
: ER6
: EAP 6.1.0
Assigned To: Weinan Li
nobody nobody
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-05-02 11:41 EDT by agalad
Modified: 2014-06-18 03:54 EDT (History)
4 users (show)

See Also:
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.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-06-18 03:54:25 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description agalad 2013-05-02 11:41:06 EDT
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 08:39:24 EST
Verified that RESTEasy 3.0.5.Final fixed this issue.
Comment 6 Weinan Li 2013-11-26 08:40:42 EST
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 03:54:25 EDT
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.