Skip to content
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

[v1.4.1] On browser, doesn't use the right protocol and port. #11

Closed
zallek opened this issue Feb 22, 2016 · 2 comments
Closed

[v1.4.1] On browser, doesn't use the right protocol and port. #11

zallek opened this issue Feb 22, 2016 · 2 comments

Comments

@zallek
Copy link

zallek commented Feb 22, 2016

When using this lib served on localhost, the lib doesn't fetch json urls with the right port and protocol.

Some params aren't passed to http module which makes http lib resolve url to fetch according to current protocol and port.

Replacing this block at https://github.com/BigstickCarpet/json-schema-ref-parser/blob/v1.4.1/lib/read.js#L176

var req = protocol.get(
  {
    hostname: u.hostname,
    port: u.port,
    path: u.path,
    auth: u.auth
  },
  onResponse
);

by the following, solve the issue:

var req = protocol.get(
  {
    protocol: u.protocol,
    host: u.host,
    hostname: u.hostname,
    port: u.port,
    path: u.path,
    auth: u.auth
  },
  onResponse
);
@zallek zallek changed the title On browser, doesn't using the right protocol and port. [v1.4.1] On browser, doesn't using the right protocol and port. Feb 22, 2016
@zallek
Copy link
Author

zallek commented Feb 22, 2016

I created a branch on my fork https://github.com/zallek/json-schema-ref-parser/tree/bugfix/port-and-protocol-resolving
commit: zallek@04d08b8

But I can't create PR for your repo because I need a target branch based on v1.4.1 tag.

@zallek zallek changed the title [v1.4.1] On browser, doesn't using the right protocol and port. [v1.4.1] On browser, doesn't use the right protocol and port. Feb 22, 2016
@JamesMessinger
Copy link
Member

This issue is fixed in newer versions of the library. Please upgrade to the latest version, which includes many critical bug fixes, as well as many new features.

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

No branches or pull requests

2 participants