Land #5990, reverse_hop_http fix

bug/bundler_fix
William Vu 2015-09-26 13:42:46 -05:00
commit f4b4b21bfc
No known key found for this signature in database
GPG Key ID: 68BD00CE25866743
2 changed files with 12 additions and 4 deletions

View File

@ -33,7 +33,7 @@ if($url === "/control"){
if(array_key_exists('HTTP_X_INIT', $_SERVER)){ if(array_key_exists('HTTP_X_INIT', $_SERVER)){
$f = fopen($tempdir."/init", "w"); //only one init file $f = fopen($tempdir."/init", "w"); //only one init file
}else{ }else{
$prefix = "down_" . bin2hex($_SERVER['HTTP_X_URLFRAG']); $prefix = "down_" . sha1($_SERVER['HTTP_X_URLFRAG']);
$f = fopen(tempnam($tempdir,$prefix), "w"); $f = fopen(tempnam($tempdir,$prefix), "w");
} }
fwrite($f, $postdata); fwrite($f, $postdata);
@ -45,9 +45,9 @@ if($url === "/control"){
//get data //get data
$postdata = file_get_contents("php://input"); $postdata = file_get_contents("php://input");
//See if we should send anything down //See if we should send anything down
if($postdata === 'RECV'){ if($postdata === "RECV\x00"){
findSendDelete($tempdir, "down_" . bin2hex($url)); findSendDelete($tempdir, "down_" . sha1($url));
$fname = $tempdir . "/up_recv_" . bin2hex($url); //Only keep one RECV poll $fname = $tempdir . "/up_recv_" . sha1($url); //Only keep one RECV poll
}else{ }else{
$fname = tempnam($tempdir, "up_"); //actual data gets its own filename $fname = tempnam($tempdir, "up_"); //actual data gets its own filename
} }

View File

@ -54,6 +54,13 @@ module ReverseHopHttp
"tunnel" "tunnel"
end end
#
# Returns the socket type. (hop)
#
def type?
return 'hop'
end
# #
# Sets up a handler. Doesn't do much since it's all in start_handler. # Sets up a handler. Doesn't do much since it's all in start_handler.
# #
@ -249,6 +256,7 @@ module ReverseHopHttp
# generate a new connect # generate a new connect
sum = uri_checksum_lookup(:connect) sum = uri_checksum_lookup(:connect)
conn_id = generate_uri_uuid(sum, uuid) conn_id = generate_uri_uuid(sum, uuid)
conn_id = conn_id[1..-1] if conn_id.start_with? '/'
url = full_uri + conn_id + "/\x00" url = full_uri + conn_id + "/\x00"
print_status("Preparing stage for next session #{conn_id}") print_status("Preparing stage for next session #{conn_id}")