<commit_before>var wompt  = require("./includes");

function Channel(config){
	this.name = config.name;
	this.messages = new wompt.MessageList();
	this.sessions = {};
}

Channel.prototype = {
	process_request: function(con){
		var action = con.req.parts[3].split('?', 2);
		con.action = action[0];
		con.query = action[1];
		this.action_responders[con.action].call(this, con);
	},
	
	action_responders: {
		recv: function(con){
			var session = this.create_session(con.res);
			this.sessions[session.id] = session;
		},
		
		post: function(con){
			var msg = con.req.query.split('=',2)[1];
			this.push_message(msg)
			con.res.json(200, {})
		}
	},
	
	push_message: function(msg){
		this.messages.add_message(msg);
		this.inform_sessions(msg);
	},
	
	inform_sessions: function(msg){
		for(var id in this.sessions){
			var session = this.sessions[id];
			wompt.logger.log("Sending " + msg + " to client " + id);
			session.push_message(msg);
		}
		this.sessions = {};
	},
	
	create_session: function(res){
		return new wompt.Session(null, this, res);
	}
}

exports.Channel = Channel;
<commit_msg>Bug fix. Channel.process_request was assigning query info to con.query when it should have been assigning to con.req.query, which is what channel.post expected.<commit_after>var wompt  = require("./includes");

function Channel(config){
	this.name = config.name;
	this.messages = new wompt.MessageList();
	this.sessions = {};
}

Channel.prototype = {
	process_request: function(con){
		var action = con.req.parts[3].split('?', 2);
		con.action = action[0];
		con.req.query = action[1];
		this.action_responders[con.action].call(this, con);
	},
	
	action_responders: {
		recv: function(con){
			var session = this.create_session(con.res);
			this.sessions[session.id] = session;
		},
		
		post: function(con){
			var msg = con.req.query.split('=',2)[1];
			this.push_message(msg)
			con.res.json(200, {})
		}
	},
	
	push_message: function(msg){
		this.messages.add_message(msg);
		this.inform_sessions(msg);
	},
	
	inform_sessions: function(msg){
		for(var id in this.sessions){
			var session = this.sessions[id];
			wompt.logger.log("Sending " + msg + " to client " + id);
			session.push_message(msg);
		}
		this.sessions = {};
	},
	
	create_session: function(res){
		return new wompt.Session(null, this, res);
	}
}

exports.Channel = Channel;

{'fraction_non_alphanumeric': 0.1644596326356258, 'fraction_numerical': 0.007689021785561726, 'mean_word_length': 3.9829787234042553, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '850693', 'n_tokens_mistral': 923, 'n_tokens_neox': 829, 'n_words': 157}