-
Notifications
You must be signed in to change notification settings - Fork 260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add cross-origin access on json interface #415
base: master
Are you sure you want to change the base?
Conversation
Add header Access-Control-Allow-Origin on json interface for enable cross-origin HTTP requests. The presence of the header is determinate by "alloworigin" option, if the option is present and no vaule is specified the default vaule is "*". See also: https://developer.mozilla.org/docs/Web/HTTP/Headers/Access-Control-Allow-Origin and https://developer.mozilla.org/docs/Web/HTTP/CORS
@@ -1398,6 +1398,15 @@ int main(int argc, char **argv) { | |||
_options.usestatusfile = STRDUP(args_info.usestatusfile_arg); | |||
_options.uamaliasname = STRDUP(args_info.uamaliasname_arg); | |||
_options.uamhostname = STRDUP(args_info.uamhostname_arg); | |||
|
|||
if (args_info.alloworigin_given) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you want the if (...) statement in thee #ifdef
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I leave the if (...) statement outside the #ifdef because if someone specify "alloworigin" option without json support will get a warning in syslog. I have mimic the behavior of other case like "proxylisten".
_options.alloworigin = STRDUP(args_info.alloworigin_arg); | ||
#endif | ||
#if(_debug_ && !defined(ENABLE_JSON)) | ||
syslog(LOG_WARNING, "JSON not implemented. build with --enable-json"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add to the message which option needs JSON support (i.e. alloworigin
). And maybe better error than warn?
Anyone cares to explain, why this PR hasn't been accepted? |
Anything wrong with this pull request? |
No description provided.