You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Jan Høydahl (JIRA)" <ji...@apache.org> on 2018/04/30 09:40:00 UTC

[jira] [Commented] (SOLR-12282) JSONResponseWriter should return Content-Type application/javascript for JSONP requests

    [ https://issues.apache.org/jira/browse/SOLR-12282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16458427#comment-16458427 ] 

Jan Høydahl commented on SOLR-12282:
------------------------------------

Hmm, why would we want to keep this supposedly insecure JSONP capability around when solutions for handling pure JSON with CORS are available and mature?

> JSONResponseWriter should return Content-Type application/javascript for JSONP requests
> ---------------------------------------------------------------------------------------
>
>                 Key: SOLR-12282
>                 URL: https://issues.apache.org/jira/browse/SOLR-12282
>             Project: Solr
>          Issue Type: Improvement
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: Response Writers
>            Reporter: Markus Schuch
>            Priority: Minor
>         Attachments: SOLR-12282.patch
>
>
> The JSONResponseWriter handles two purposes:
>  * writing JSON responses (wt=json)
>  * writing JSONP responses, namely JSON responses wrapped by a JavaScript function (wt=json&json.wrf=myFunction)
> The response writer returns the same Content-Type in both cases. (default: application/json)
> But for JSONP the correct Content-Type would be "application/javascript".
> The response type is configurable, but it is currently not possible to return the correct Content-Type in both cases with one configuration at the same time.
> The attached patch changes the default Content-Type to {{application/javascript; charset=utf-8}} for responses with wrapper functions (JSONP). If param {{content-type}} is configured, this Content-Type will be returned for both JSON and JSONP to ensure backward compatibility.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org