Skip to content

Add cross-origin access on json interface#415

Open
Amygos wants to merge 2 commits into
coova:masterfrom
Amygos:alloworigin
Open

Add cross-origin access on json interface#415
Amygos wants to merge 2 commits into
coova:masterfrom
Amygos:alloworigin

Conversation

@Amygos

@Amygos Amygos commented Jan 17, 2018

Copy link
Copy Markdown

No description provided.

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
Comment thread src/main-opt.c
_options.uamaliasname = STRDUP(args_info.uamaliasname_arg);
_options.uamhostname = STRDUP(args_info.uamhostname_arg);

if (args_info.alloworigin_given)

Copy link
Copy Markdown
Contributor

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

@Amygos Amygos Jan 18, 2018

Copy link
Copy Markdown
Author

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".

Comment thread src/main-opt.c
_options.alloworigin = STRDUP(args_info.alloworigin_arg);
#endif
#if(_debug_ && !defined(ENABLE_JSON))
syslog(LOG_WARNING, "JSON not implemented. build with --enable-json");

@xOneca xOneca Jan 18, 2018

Copy link
Copy Markdown
Contributor

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?

@josealgardataborges

Copy link
Copy Markdown

Anyone cares to explain, why this PR hasn't been accepted?

@mfaroukg

Copy link
Copy Markdown

Anything wrong with this pull request?

@Neustradamus

Copy link
Copy Markdown

Dear @coova team, @sevan, @jobezic,

Have you progressed on this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants