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

not working on chrome #1

Open
espoal opened this issue Oct 27, 2017 · 1 comment
Open

not working on chrome #1

espoal opened this issue Oct 27, 2017 · 1 comment

Comments

@espoal
Copy link

espoal commented Oct 27, 2017

As per the post comment, the example repo doesn't work on my Ubuntu + Chrome.

I can make it work by fixing the reqPath.

Here's the req object:

   Http2ServerRequest {
     _readableState: 
      ReadableState {
        objectMode: false,
        highWaterMark: 16384,
        buffer: [Object],
        length: 0,
        pipes: null,
        pipesCount: 0,
        flowing: null,
        ended: false,
        endEmitted: false,
        reading: false,
        sync: true,
        needReadable: false,
        emittedReadable: false,
        readableListening: false,
        resumeScheduled: false,
        destroyed: false,
        defaultEncoding: 'utf8',
        awaitDrain: 0,
        readingMore: false,
        decoder: null,
        encoding: null },
     readable: true,
     domain: null,
     _events: 
      { pause: [Function: onRequestPause],
        resume: [Function: onRequestResume] },
     _eventsCount: 2,
     _maxListeners: undefined,
     [Symbol(state)]: { closed: false, didRead: false },
     [Symbol(headers)]: 
      { ':method': 'GET',
        ':authority': 'localhost:4000',
        ':scheme': 'https',
        ':path': '/',
        'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36',
        'upgrade-insecure-requests': '1',
        accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
        'accept-encoding': 'gzip, deflate, br',
        'accept-language': 'en-US,en;q=0.9,it;q=0.8' },
     [Symbol(rawHeaders)]: 
      [ ':method',
        'GET',
        ':authority',
        'localhost:4000',
        ':scheme',
        'https',
        ':path',
        '/',
        'user-agent',
        'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36',
        'upgrade-insecure-requests',
        '1',
        'accept',
        'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
        'accept-encoding',
        'gzip, deflate, br',
        'accept-language',
        'en-US,en;q=0.9,it;q=0.8' ],
     [Symbol(trailers)]: {},
     [Symbol(rawTrailers)]: [],
     [Symbol(stream)]: Http2Stream { id: 1,
  state: 
   { state: 2,
     weight: 256,
     sumDependencyWeight: 0,
     localClose: 0,
     remoteClose: 0,
     localWindowSize: 65535 },
  readableState: 
   ReadableState {
     objectMode: false,
     highWaterMark: 16384,
     buffer: BufferList { head: null, tail: null, length: 0 },
     length: 0,
     pipes: null,
     pipesCount: 0,
     flowing: false,
     ended: true,
     endEmitted: false,
     reading: false,
     sync: true,
     needReadable: false,
     emittedReadable: true,
     readableListening: false,
     resumeScheduled: false,
     destroyed: false,
     defaultEncoding: 'utf8',
     awaitDrain: 0,
     readingMore: false,
     decoder: null,
     encoding: null },
  writableState: 
   WritableState {
     objectMode: false,
     highWaterMark: 16384,
     finalCalled: false,
     needDrain: false,
     ending: false,
     ended: false,
     finished: false,
     destroyed: false,
     decodeStrings: false,
     defaultEncoding: 'utf8',
     length: 0,
     writing: false,
     corked: 0,
     sync: true,
     bufferProcessing: false,
     onwrite: [Function: bound onwrite],
     writecb: null,
     writelen: 0,
     bufferedRequest: null,
     lastBufferedRequest: null,
     pendingcb: 0,
     prefinished: false,
     errorEmitted: false,
     bufferedRequestCount: 0,
     corkedRequestsFree: 
      { next: null,
        entry: null,
        finish: [Function: bound onCorkedFinish] } } } } }
{ req: 
   Http2ServerRequest {
     _readableState: 
      ReadableState {
        objectMode: false,
        highWaterMark: 16384,
        buffer: [Object],
        length: 0,
        pipes: null,
        pipesCount: 0,
        flowing: null,
        ended: false,
        endEmitted: false,
        reading: false,
        sync: true,
        needReadable: false,
        emittedReadable: false,
        readableListening: false,
        resumeScheduled: false,
        destroyed: false,
        defaultEncoding: 'utf8',
        awaitDrain: 0,
        readingMore: false,
        decoder: null,
        encoding: null },
     readable: true,
     domain: null,
     _events: 
      { pause: [Function: onRequestPause],
        resume: [Function: onRequestResume] },
     _eventsCount: 2,
     _maxListeners: undefined,
     [Symbol(state)]: { closed: false, didRead: false },
     [Symbol(headers)]: 
      { ':method': 'GET',
        ':authority': 'localhost:4000',
        ':scheme': 'https',
        ':path': '/favicon.ico',
        'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36',
        accept: 'image/webp,image/apng,image/*,*/*;q=0.8',
        referer: 'https://localhost:4000/',
        'accept-encoding': 'gzip, deflate, br',
        'accept-language': 'en-US,en;q=0.9,it;q=0.8' },
     [Symbol(rawHeaders)]: 
      [ ':method',
        'GET',
        ':authority',
        'localhost:4000',
        ':scheme',
        'https',
        ':path',
        '/favicon.ico',
        'user-agent',
        'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36',
        'accept',
        'image/webp,image/apng,image/*,*/*;q=0.8',
        'referer',
        'https://localhost:4000/',
        'accept-encoding',
        'gzip, deflate, br',
        'accept-language',
        'en-US,en;q=0.9,it;q=0.8' ],
     [Symbol(trailers)]: {},
     [Symbol(rawTrailers)]: [],
     [Symbol(stream)]: Http2Stream { id: 3,
  state: 
   { state: 2,
     weight: 220,
     sumDependencyWeight: 256,
     localClose: 0,
     remoteClose: 0,
     localWindowSize: 65535 },
  readableState: 
   ReadableState {
     objectMode: false,
     highWaterMark: 16384,
     buffer: BufferList { head: null, tail: null, length: 0 },
     length: 0,
     pipes: null,
     pipesCount: 0,
     flowing: false,
     ended: true,
     endEmitted: false,
     reading: false,
     sync: true,
     needReadable: false,
     emittedReadable: true,
     readableListening: false,
     resumeScheduled: false,
     destroyed: false,
     defaultEncoding: 'utf8',
     awaitDrain: 0,
     readingMore: false,
     decoder: null,
     encoding: null },
  writableState: 
   WritableState {
     objectMode: false,
     highWaterMark: 16384,
     finalCalled: false,
     needDrain: false,
     ending: false,
     ended: false,
     finished: false,
     destroyed: false,
     decodeStrings: false,
     defaultEncoding: 'utf8',
     length: 0,
     writing: false,
     corked: 0,
     sync: true,
     bufferProcessing: false,
     onwrite: [Function: bound onwrite],
     writecb: null,
     writelen: 0,
     bufferedRequest: null,
     lastBufferedRequest: null,
     pendingcb: 0,
     prefinished: false,
     errorEmitted: false,
     bufferedRequestCount: 0,
     corkedRequestsFree: 
      { next: null,
        entry: null,
        finish: [Function: bound onCorkedFinish] } } } } }
@espoal
Copy link
Author

espoal commented Oct 27, 2017

to make it work I need to edit line 23 of server.js with:
const reqPath = req.headers[':path'] === '/' ? '/index.html' : req.headers[':path'];

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

1 participant