Skip to content

Add user agent string to parseUrl method #13

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

Merged
merged 2 commits into from
Jul 12, 2016
Merged

Conversation

joshbeckman
Copy link
Contributor

Without a declared user agent, a surprising amount of RSS feeds will return a 400
error code

Without a user agent, a surprising amount of RSS feeds will return a 400
error code
@joshbeckman
Copy link
Contributor Author

bump

var parsedUrl = url.parse(feedUrl);
var req = get({
hostname: parsedUrl.hostname,
path: parsedUrl.path,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add parsedUrl.search to the path if it exists? Otherwise LGTM

Copy link
Contributor Author

@joshbeckman joshbeckman Jul 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The path attribute will contain the search string, if present. https://nodejs.org/api/url.html#url_urlobject_path

On Jul 11, 2016, at 10:20, Bobby Brennan notifications@github.com wrote:

In index.js:

var xml = '';

  • var get = url.indexOf('https') === 0 ? HTTPS.get : HTTP.get;
  • var req = get(url, function(res) {
  • var get = feedUrl.indexOf('https') === 0 ? HTTPS.get : HTTP.get;
  • var parsedUrl = url.parse(feedUrl);
  • var req = get({
  • hostname: parsedUrl.hostname,
  • path: parsedUrl.path,
    Can you add parsedUrl.search to the path if it exists? Otherwise LGTM


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

@lantrix
Copy link

lantrix commented Jul 12, 2016

@andjosh this would explain the 400s I was getting from mediafire pulling in an RSS feed. Once again you are ahead of the game. I suspected it may be the lack of user-agent.

@rbren rbren merged commit e033910 into rbren:master Jul 12, 2016
@rbren
Copy link
Owner

rbren commented Jul 12, 2016

Released as 2.5.0

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.

3 participants