Coder Social home page Coder Social logo

Comments (7)

indexzero avatar indexzero commented on June 12, 2024

@unscene Not compatible in what way? Is there an error thrown? If so, can you paste the stack trace?

from union.

unscene avatar unscene commented on June 12, 2024

@indexzero sure updated main issue for you

from union.

unscene avatar unscene commented on June 12, 2024

It looks like in core.js somewhere between

break in node_modules/union/lib/core.js:24

and here

break in node_modules/flatiron/node_modules/director/lib/director/http/index.js:76

The response object no longer is of type http.ServerResponse, or at least a crippled version.

from union.

indexzero avatar indexzero commented on June 12, 2024

Yes, I see. We need to pass-thru this method from http.ServerResponse

from union.

unscene avatar unscene commented on June 12, 2024

I upgraded to the latest version of connect (2.0.0) and that fixed my problem. However if you want to use the latest version (1.8.5) of connect on npm, any connect middleware that abuses _implicitHeader will cause union to DIAF. Passing through _implicitHeader in ResponseStream "works" but then the patch.js problem in connect reveals itself.

The only suggestion I have is maybe pass through all methods of http.ServerResponse, so these issue can be exposed by the faulty middleware.

from union.

indexzero avatar indexzero commented on June 12, 2024

We should update the docs to specify the compatibility with only connect >= 2.0.0

from union.

amelon avatar amelon commented on June 12, 2024

there's still issue with connect session middleware and union:

-union: 0.1.7
-flatiron: 0.1.11
-connect: 2.0.0alpha1

As mentioned, connect patch ServerResponse prototype to support event "header". (connect/lib/patch.js)
On session middleware, connect expect the response parameter to be a http.ServerResponse and it listens to "header" event to write cookie header.
(line 221 on connect/lib/middleware/session.js)

    // set-cookie
    res.on('header', function(){
      if (!req.session) return;
      var cookie = req.session.cookie
        , proto = (req.headers['x-forwarded-proto'] || '').toLowerCase()
        , tls = req.connection.encrypted || (trustProxy && 'https' == proto)
        , secured = cookie.secure && tls;

      // browser-session cookies only set-cookie once
      if (null == cookie.expires && !sessionIsNew) return;

      // only send secure cookies via https
      if (cookie.secure && !secured) return debug('not secured');

      debug('set %s to %s', key, req.sessionID);
      res.setHeader('Set-Cookie', cookie.serialize(key, req.sessionID));
    });

As response object forwarded by union to connect is a ResponseStream object, "header" event is never emit.

from union.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.