View Issue Details

IDProjectCategoryView StatusLast Update
0035990FPCFCLpublic2019-08-24 14:32
ReporterSimon AmeisAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformDesktop PCOSWindows 7, 64 bitOS Version6.1 SP 1
Product Version3.3.1Product Buildtrunk 
Target VersionFixed in Version3.3.1 
Summary0035990: fcl-web: TCustomJSONRPCModule Response content type
DescriptionTCustomJSONRPCModule doesn't set a content type in HTTP response object. This should be set to application/json indicate the JSON response should not be executed by the client webbrowser.

See https://stackoverflow.com/questions/477816/what-is-the-correct-json-content-type for reference

For fixing add <code>AResponse.ContentType := 'application/json; charset=utf-8';</code> to TCustomJSONRPCModule.HandleRequest. The charset=utf8 may be omitted, as UTF-8 is default encoding for JSON.

Also it would be reasonable to add a new property to TCustomJSONRPCModule in case the content type should be modified by user (e.g. to set application/javascript, see also link above).
Steps To ReproduceWhen using fcl-web as FastCGI behind nginx, nginx will add text/html content type by itself when it's missing.
Tagsfcl-web
Fixed in Revision42768.
FPCOldBugId
FPCTarget3.2.0
Attached Files

Activities

Michael Van Canneyt

2019-08-23 09:24

administrator   ~0117790

Changed, thanks for reporting.

I also changed the return to use the response stream, so there is no juggling with code pages.
As an added benefit it should be faster as well, since no parsing for EOL will be done.

Issue History

Date Modified Username Field Change
2019-08-20 22:45 Simon Ameis New Issue
2019-08-20 22:46 Simon Ameis Tag Attached: fcl-web
2019-08-21 21:34 Michael Van Canneyt Assigned To => Michael Van Canneyt
2019-08-21 21:34 Michael Van Canneyt Status new => assigned
2019-08-23 09:24 Michael Van Canneyt Status assigned => resolved
2019-08-23 09:24 Michael Van Canneyt Resolution open => fixed
2019-08-23 09:24 Michael Van Canneyt Fixed in Version => 3.3.1
2019-08-23 09:24 Michael Van Canneyt Fixed in Revision => 42768.
2019-08-23 09:24 Michael Van Canneyt FPCTarget => 3.2.0
2019-08-23 09:24 Michael Van Canneyt Note Added: 0117790
2019-08-24 14:32 Simon Ameis Status resolved => closed