shokkueibu
Knight
Hey there!
It's my first time working with URL messages in the module system. I believe I've managed to set up everything just fine outside Warband.
The problem seems to be when the Warband server receives a response. The registers, string or not, seem to be prefixed with characters that shouldn't be there. It tested okay through Chrome so I assume Warband is getting the messages in the correct format though I know of no way to confirm that.
I've also noticed the messages about players joining the game sometimes got omitted while the one about receiving the URL response is there. They should appear more often throughout the log since the code only runs after someone joins.
The requests are getting to the server just fine, as far as I can tell:
This is my first time dealing with PHP but it works as expected when I access it on the browser.
This [font=consolas,fixedsys]test.php?int=30&str=Achilles[/font] displays the following in my browser:
as expected.
Any ideas on what could be wrong?
EDIT:
Solved:
It's my first time working with URL messages in the module system. I believe I've managed to set up everything just fine outside Warband.
The problem seems to be when the Warband server receives a response. The registers, string or not, seem to be prefixed with characters that shouldn't be there. It tested okay through Chrome so I assume Warband is getting the messages in the correct format though I know of no way to confirm that.
I've also noticed the messages about players joining the game sometimes got omitted while the one about receiving the URL response is there. They should appear more often throughout the log since the code only runs after someone joins.
Code:
16:47:01 - SERVER has joined the game with ID: 0 and has administrator rights.
16:47:22 - Achilles has joined the game with ID: ****
16:47:23 - Sent *****/test.php?int=6&str=Achilles
16:47:26 - Got 0 integers and 2 strings
16:47:26 - Int: 100, 0, 0, 0, 0, 0
16:47:26 - Str: "a
6", "Achilles
0
", "", "", "", ""
16:48:13 - sHocK_of_Sarrdak has joined the game with ID: ****
16:48:17 - Sent *****/test.php?int=4&str=sHocK_of_Sarrdak
16:48:20 - Got 1 integers and 1 strings
16:48:20 - Int: 124, 0, 0, 0, 0, 0
16:48:20 - Str: "sHocK_of_Sarrdak
0
", "Achilles
0
", "", "", "", ""
16:54:11 - <img=ico_headshot> Achilles
16:54:38 - Achilles has joined the game with ID: ****
16:54:40 - Sent *****/test.php?int=30&str=Achilles
16:54:43 - Got 0 integers and 2 strings
16:54:43 - Int: 100, 0, 0, 0, 0, 0
16:54:43 - Str: "b
30", "Achilles
0
", "", "", "", ""
17:02:06 - hibik has joined the game with ID: ****
17:02:10 - Sent *****/test.php?int=1&str=hibik
17:02:13 - Got 1 integers and 1 strings
17:02:13 - Int: 71, 0, 0, 0, 0, 0
17:02:13 - Str: "hibik
0
", "Achilles
0
", "", "", "", ""
17:17:30 - Sent *****/test.php?int=30&str=Achilles
17:17:31 - Sent *****/test.php?int=4&str=sHocK_of_Sarrdak
17:17:33 - Got 0 integers and 2 strings
17:17:33 - Int: 100, 0, 0, 0, 0, 0
17:17:33 - Str: "b
30", "Achilles
0
", "", "", "", ""
17:17:34 - Got 1 integers and 1 strings
17:17:34 - Int: 124, 0, 0, 0, 0, 0
17:17:34 - Str: "sHocK_of_Sarrdak
0
", "Achilles
0
", "", "", "", ""
17:47:37 - Sent *****/test.php?int=30&str=Achilles
17:47:38 - Sent *****/test.php?int=4&str=sHocK_of_Sarrdak
17:47:40 - Got 0 integers and 2 strings
17:47:40 - Int: 100, 0, 0, 0, 0, 0
17:47:40 - Str: "b
30", "Achilles
0
", "", "", "", ""
17:47:41 - Got 1 integers and 1 strings
17:47:41 - Int: 124, 0, 0, 0, 0, 0
17:47:41 - Str: "sHocK_of_Sarrdak
0
", "Achilles
0
", "", "", "", ""
Code:
("game_receive_url_response",[
(store_script_param, ":num_integers", 1),
(store_script_param, ":num_strings", 2),
(try_begin),
(assign, reg60, ":num_integers"),
(assign, reg61, ":num_strings"),
(server_add_message_to_log, "@Got {reg60} integers and {reg61} strings"),
(server_add_message_to_log, "@Int: {reg0}, {reg1}, {reg2}, {reg3}, {reg4}, {reg5}"),
(server_add_message_to_log, "@Str: \"{s0}\", \"{s1}\", \"{s2}\", \"{s3}\", \"{s4}\", \"{s5}\""),
(try_end),
]),
Code:
(ti_server_player_joined, 0, 0, [],[
(store_trigger_param_1, ":player_no"),
(call_script, "script_multiplayer_server_player_joined_common", ":player_no"),
(assign, reg0, ":player_no"),
(str_store_player_username, s0, ":player_no"),
(send_message_to_url, "@http://127.0.0.1/*****/test.php?int={reg0}&str={s0}"),
(server_add_message_to_log, "@Sent *****/test.php?int={reg0}&str={s0}"),
]),
The requests are getting to the server just fine, as far as I can tell:
Code:
127.0.0.1 - - [17/Sep/2011:16:47:23 +0100] "GET /*****/test.php?int=6&str=Achilles HTTP/1.1" 200 20 "-" "Mozilla/4.0"
127.0.0.1 - - [17/Sep/2011:16:48:17 +0100] "GET /*****/test.php?int=4&str=sHocK_of_Sarrdak HTTP/1.1" 200 29 "-" "Mozilla/4.0"
127.0.0.1 - - [17/Sep/2011:16:54:40 +0100] "GET /*****/test.php?int=30&str=Achilles HTTP/1.1" 200 21 "-" "Mozilla/4.0"
127.0.0.1 - - [17/Sep/2011:17:02:10 +0100] "GET /*****/test.php?int=1&str=hibik HTTP/1.1" 200 17 "-" "Mozilla/4.0"
127.0.0.1 - - [17/Sep/2011:17:17:30 +0100] "GET /*****/test.php?int=30&str=Achilles HTTP/1.1" 200 21 "-" "Mozilla/4.0"
127.0.0.1 - - [17/Sep/2011:17:17:31 +0100] "GET /*****/test.php?int=4&str=sHocK_of_Sarrdak HTTP/1.1" 200 29 "-" "Mozilla/4.0"
127.0.0.1 - - [17/Sep/2011:17:47:37 +0100] "GET /*****/test.php?int=30&str=Achilles HTTP/1.1" 200 21 "-" "Mozilla/4.0"
127.0.0.1 - - [17/Sep/2011:17:47:38 +0100] "GET /*****/test.php?int=4&str=sHocK_of_Sarrdak HTTP/1.1" 200 29 "-" "Mozilla/4.0"
This is my first time dealing with PHP but it works as expected when I access it on the browser.
Code:
<?php
$int = $_GET["int"];
$str = $_GET["str"];
$count = 0;
if($int != null){
$count++;
echo $int;
}
if($count == 1){
echo "|";
}
if($str != null){
$count++;
echo $str;
}
if($count == 0){
echo "0";
}
?>
This [font=consolas,fixedsys]test.php?int=30&str=Achilles[/font] displays the following in my browser:
Code:
30|Achilles
Any ideas on what could be wrong?
EDIT:
Solved:
Vornne said:I asked chadz through cmpxchg8b about this problem (developers of cRPG), who said it is a problem with warband reading part of the headers; their fix is to add this code to the very start of the php script, before any data is output:Code:header_remove(); function set_content_length($output) { header("Content-Length: ".strlen($output)); return $output; } ob_start("set_content_length");