Skip to content

Parse Error HPE_INVALID_CONSTANT when using proxy #1706

@lacco

Description

@lacco

I am using a proxy to fetch different URLs, but Youtube URLs are constantly failing with { [Error: Parse Error] bytesParsed: 984, code: 'HPE_INVALID_CONSTANT' }. When fetching the URL without proxy, everything is working fine, but with the proxy I get the mentioned error.

This is the code I use to fetch it:

request = Meteor.npmRequire("request").defaults({jar: true, maxRedirects: 30, timeout: 30000, strictSSL: false})

r = request({
  url: "https://youtu.be/YwTwrx1MTE4",
  proxy: "http://myproxy.com" # everything is working fine when deleting this line...
}, (error, response, body) ->
  console.log(error)
  # => { [Error: Parse Error] bytesParsed: 984, code: 'HPE_INVALID_CONSTANT' }
  console.log(r.response.headers)
)

These are the headers of the successful response without the proxy:

{
  "accept-ranges": "none",
  "alternate-protocol": "443:quic,p=1",
  "cache-control": "no-cache",
  "content-type": "text/html; charset=utf-8",
  "date": "Fri, 31 Jul 2015 06:33:37 GMT",
  "expires": "Tue, 27 Apr 1971 19:44:06 EST",
  "p3p": "CP=\"This is not a P3P policy! See http://support.google.com/accounts/answer/151657?hl=de for more info.\"",
  "server": "gwiseguy/2.0",
  "set-cookie": [
    "VISITOR_INFO1_LIVE=PfExje12ZXg; path=/; domain=.youtube.com; expires=Wed, 30-Mar-2016 18:26:37 GMT; httponly",
    "PREF=f1=50000000; path=/; domain=.youtube.com; expires=Wed, 30-Mar-2016 18:26:37 GMT",
    "YSC=_uKF2sbupGg; path=/; domain=.youtube.com; httponly"
  ],
  "transfer-encoding": "chunked",
  "vary": "Accept-Encoding",
  "x-content-type-options": "nosniff",
  "x-frame-options": "SAMEORIGIN",
  "x-xss-protection": "1; mode=block; report=https://www.google.com/appserve/security-bugs/log/youtube"
}

And these are the headers of the failing response when using the proxy:

{
  "accept-ranges": "none",
  "alternate-protocol": "443:quic,p=1",
  "cache-control": "no-cache",
  "connection": "close",
  "content-type": "text/html; charset=utf-8",
  "date": "Fri, 31 Jul 2015 06:33:02 GMT",
  "expires": "Tue, 27 Apr 1971 19:44:06 EST",
  "p3p": "CP=\"This is not a P3P policy! See http://support.google.com/accounts/answer/151657?hl=en for more info.\"",
  "proxy-connection": "close",
  "server": "gwiseguy/2.0",
  "set-cookie": [
    "YSC=7uyKX90bszI; path=/; domain=.youtube.com; httponly",
    "VISITOR_INFO1_LIVE=bq4DFwx9M5g; path=/; domain=.youtube.com; expires=Wed, 30-Mar-2016 18:26:02 GMT; httponly"
  ],
  "transfer-encoding": "chunked",
  "vary": "Accept-Encoding",
  "x-content-type-options": "nosniff",
  "x-crawlera-slave": "107.161.85.68:80",
  "x-crawlera-version": "1.4.2",
  "x-frame-options": "SAMEORIGIN",
  "x-xss-protection": "1; mode=block; report=https://www.google.com/appserve/security-bugs/log/youtube"
}

Any ideas what I can do?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions