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

Request hangs #36

Open
fletchette opened this issue Mar 26, 2016 · 0 comments
Open

Request hangs #36

fletchette opened this issue Mar 26, 2016 · 0 comments

Comments

@fletchette
Copy link

Sorry that this isn't really an issue with Harmon. Its an issue with implementing it correctly. I've looked through some other issues and all the documentation but I can't figure it out -

var http = require('http'),
    connect = require('connect'),
    httpProxy = require('http-proxy');

var through = require('through');
//require("./static");

var selects = [{
    query: "head",
    func: function(elem) {
        var s = elem.createStream({outer : true });
        s.pipe(through(function(data) {
            console.log(3);
            if(data.toString().indexOf('</head>') > -1) {
                console.log(1);
                s.write('<script>alert("hello");</script>');
                console.log(2);
            }
            s.write(data);
        }));
    }
}];

var app = connect();

var proxy = httpProxy.createProxyServer({
    target: "ip_address_here"
});

proxy.on("error", function(e) {
    console.log(e);
});

app.use(require("harmon")([], selects, true));

app.use(
    function(req, res) {
        proxy.web(req, res);
    }
);

http.createServer(app).listen(80);

when I go to it in the web browser the alert pops up and then the page hangs.
Thanks

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