Quantcast

CXF 2.7.8: Content-Type value and Headers.content-type value doesn´t match in logs

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

CXF 2.7.8: Content-Type value and Headers.content-type value doesn´t match in logs

Jose María Zaragoza
Hello:

I've got a question about how CXF 2.7.8 prints headers logs
I've got a REST webservice deployed in a  Tomcat 7.0 server, listening
on a secure port (https)

Sometimes my service receives requests like the next one:

Address: https://example.com/WS/user1/login
Encoding: UTF-8
Http-Method: POST
Content-Type: application/json, application/json; charset=UTF-8
Headers: {accept-encoding=[gzip], connection=[Keep-Alive],
Content-Length=[230], content-type=[application/json,
application/json; charset=UTF-8], host=[example.com],
user-agent=[Dalvik/2.1.0 (Linux; U; Android 5.1.1; SM-G531F
Build/LMY48B)]}
Payload: { ... }

Look at Content-Type value and  Headers.content-type value: they
match. All right
And I reject that request caused by content-type is not supported

But sometimes  my service receives requests like the next one:

Address: https://example.com/WS/user2/login
Encoding: ISO-8859-1
Http-Method: POST
Content-Type: application/json
Headers: {accept-encoding=[gzip], connection=[Keep-Alive],
Content-Length=[232], content-type=[application/json,
application/json; charset=UTF-8], host=[example.com],
user-agent=[Dalvik/2.1.0 (Linux; U; Android 6.0.1; SM-G900F
Build/MMB29M)]}
Payload: { ... }

Look at Content-Type value and  Headers.content-type value: they don't match !!
Why ? Should they be the same value ?
In this case, I accept the request


Thanks and regards
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: CXF 2.7.8: Content-Type value and Headers.content-type value doesn´t match in logs

Sergey Beryozkin
Administrator
Hi

I'm really not aware of CXF 2.7.x augmenting the content type and I can
only imagine that there's some filter (custom or from the 3rd party
servlet filter library) that your application may have that adds a value
to Map of headers for Content-Type if a charset property is not set...

Cheers, Sergey

On 16/02/17 11:58, Jose María Zaragoza wrote:

> Hello:
>
> I've got a question about how CXF 2.7.8 prints headers logs
> I've got a REST webservice deployed in a  Tomcat 7.0 server, listening
> on a secure port (https)
>
> Sometimes my service receives requests like the next one:
>
> Address: https://example.com/WS/user1/login
> Encoding: UTF-8
> Http-Method: POST
> Content-Type: application/json, application/json; charset=UTF-8
> Headers: {accept-encoding=[gzip], connection=[Keep-Alive],
> Content-Length=[230], content-type=[application/json,
> application/json; charset=UTF-8], host=[example.com],
> user-agent=[Dalvik/2.1.0 (Linux; U; Android 5.1.1; SM-G531F
> Build/LMY48B)]}
> Payload: { ... }
>
> Look at Content-Type value and  Headers.content-type value: they
> match. All right
> And I reject that request caused by content-type is not supported
>
> But sometimes  my service receives requests like the next one:
>
> Address: https://example.com/WS/user2/login
> Encoding: ISO-8859-1
> Http-Method: POST
> Content-Type: application/json
> Headers: {accept-encoding=[gzip], connection=[Keep-Alive],
> Content-Length=[232], content-type=[application/json,
> application/json; charset=UTF-8], host=[example.com],
> user-agent=[Dalvik/2.1.0 (Linux; U; Android 6.0.1; SM-G900F
> Build/MMB29M)]}
> Payload: { ... }
>
> Look at Content-Type value and  Headers.content-type value: they don't match !!
> Why ? Should they be the same value ?
> In this case, I accept the request
>
>
> Thanks and regards
>


--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: CXF 2.7.8: Content-Type value and Headers.content-type value doesn´t match in logs

Jose María Zaragoza
2017-02-16 14:09 GMT+01:00 Sergey Beryozkin <[hidden email]>:
> Hi
>
> I'm really not aware of CXF 2.7.x augmenting the content type and I can only
> imagine that there's some filter (custom or from the 3rd party servlet
> filter library) that your application may have that adds a value to Map of
> headers for Content-Type if a charset property is not set...

Thanks Sergey
But the problem is ( in the second case, for example ) that
Content-Type header doesn't match with content-type value in Headers

application/json  != [application/json, application/json; charset=UTF-8]

I thought that Headers showed the HTTP headers, in raw
It could haves such a filter , but , in this case, both values should
be equals , right ?

Regards

>
> Cheers, Sergey
>
>
> On 16/02/17 11:58, Jose María Zaragoza wrote:
>>
>> Hello:
>>
>> I've got a question about how CXF 2.7.8 prints headers logs
>> I've got a REST webservice deployed in a  Tomcat 7.0 server, listening
>> on a secure port (https)
>>
>> Sometimes my service receives requests like the next one:
>>
>> Address: https://example.com/WS/user1/login
>> Encoding: UTF-8
>> Http-Method: POST
>> Content-Type: application/json, application/json; charset=UTF-8
>> Headers: {accept-encoding=[gzip], connection=[Keep-Alive],
>> Content-Length=[230], content-type=[application/json,
>> application/json; charset=UTF-8], host=[example.com],
>> user-agent=[Dalvik/2.1.0 (Linux; U; Android 5.1.1; SM-G531F
>> Build/LMY48B)]}
>> Payload: { ... }
>>
>> Look at Content-Type value and  Headers.content-type value: they
>> match. All right
>> And I reject that request caused by content-type is not supported
>>
>> But sometimes  my service receives requests like the next one:
>>
>> Address: https://example.com/WS/user2/login
>> Encoding: ISO-8859-1
>> Http-Method: POST
>> Content-Type: application/json
>> Headers: {accept-encoding=[gzip], connection=[Keep-Alive],
>> Content-Length=[232], content-type=[application/json,
>> application/json; charset=UTF-8], host=[example.com],
>> user-agent=[Dalvik/2.1.0 (Linux; U; Android 6.0.1; SM-G900F
>> Build/MMB29M)]}
>> Payload: { ... }
>>
>> Look at Content-Type value and  Headers.content-type value: they don't
>> match !!
>> Why ? Should they be the same value ?
>> In this case, I accept the request
>>
>>
>> Thanks and regards
>>
>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: CXF 2.7.8: Content-Type value and Headers.content-type value doesn´t match in logs

Sergey Beryozkin
Administrator
Hi

I'm only not sure where this extra value is coming from, I did a quick
test on the master:

ID: 2
Address: http://localhost:9001/bookstore/emptyput
Encoding: UTF-8
Http-Method: PUT
Content-Type: application/json
Headers: {Accept=[*/*], Cache-Control=[no-cache],
connection=[keep-alive], content-type=[application/json],
Host=[localhost:9001], Pragma=[no-cache],
User-Agent=[Apache-CXF/3.2.0-SNAPSHOT]}

Perhaps it was a 2.7.x 'feature' - can you please try CXF 3.0.x ?

Cheers, Sergey

On 16/02/17 20:36, Jose María Zaragoza wrote:

> 2017-02-16 14:09 GMT+01:00 Sergey Beryozkin <[hidden email]>:
>> Hi
>>
>> I'm really not aware of CXF 2.7.x augmenting the content type and I can only
>> imagine that there's some filter (custom or from the 3rd party servlet
>> filter library) that your application may have that adds a value to Map of
>> headers for Content-Type if a charset property is not set...
>
> Thanks Sergey
> But the problem is ( in the second case, for example ) that
> Content-Type header doesn't match with content-type value in Headers
>
> application/json  != [application/json, application/json; charset=UTF-8]
>
> I thought that Headers showed the HTTP headers, in raw
> It could haves such a filter , but , in this case, both values should
> be equals , right ?
>
> Regards
>
>>
>> Cheers, Sergey
>>
>>
>> On 16/02/17 11:58, Jose María Zaragoza wrote:
>>>
>>> Hello:
>>>
>>> I've got a question about how CXF 2.7.8 prints headers logs
>>> I've got a REST webservice deployed in a  Tomcat 7.0 server, listening
>>> on a secure port (https)
>>>
>>> Sometimes my service receives requests like the next one:
>>>
>>> Address: https://example.com/WS/user1/login
>>> Encoding: UTF-8
>>> Http-Method: POST
>>> Content-Type: application/json, application/json; charset=UTF-8
>>> Headers: {accept-encoding=[gzip], connection=[Keep-Alive],
>>> Content-Length=[230], content-type=[application/json,
>>> application/json; charset=UTF-8], host=[example.com],
>>> user-agent=[Dalvik/2.1.0 (Linux; U; Android 5.1.1; SM-G531F
>>> Build/LMY48B)]}
>>> Payload: { ... }
>>>
>>> Look at Content-Type value and  Headers.content-type value: they
>>> match. All right
>>> And I reject that request caused by content-type is not supported
>>>
>>> But sometimes  my service receives requests like the next one:
>>>
>>> Address: https://example.com/WS/user2/login
>>> Encoding: ISO-8859-1
>>> Http-Method: POST
>>> Content-Type: application/json
>>> Headers: {accept-encoding=[gzip], connection=[Keep-Alive],
>>> Content-Length=[232], content-type=[application/json,
>>> application/json; charset=UTF-8], host=[example.com],
>>> user-agent=[Dalvik/2.1.0 (Linux; U; Android 6.0.1; SM-G900F
>>> Build/MMB29M)]}
>>> Payload: { ... }
>>>
>>> Look at Content-Type value and  Headers.content-type value: they don't
>>> match !!
>>> Why ? Should they be the same value ?
>>> In this case, I accept the request
>>>
>>>
>>> Thanks and regards
>>>
>>
>>
>> --
>> Sergey Beryozkin
>>
>> Talend Community Coders
>> http://coders.talend.com/

Loading...