Skip to content

Request hangs #36

Description

@fletchette

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions