--- 3m-810.pl 2010/02/11 18:48:19 70 +++ 3m-810.pl 2010/02/11 20:57:51 71 @@ -84,7 +84,7 @@ $d->{security} = $tags_security->{$_}; push @{ $json->{tags} }, $d; } keys %$tags; - print $client "HTTP/1.0 200 OK\r\nContent-Type: application/x-javascript\r\n\r\n", + print $client "HTTP/1.0 200 OK\r\nContent-Type: application/json\r\n\r\n", $param->{callback}, "(", to_json($json), ")\r\n"; } elsif ( $method =~ m{/program} ) { @@ -104,7 +104,9 @@ print $client "HTTP/1.0 $status $method\r\nLocation: $server_url\r\n\r\n"; - } elsif ( $method =~ m{/secure} ) { + } elsif ( $method =~ m{/secure(.js)} ) { + + my $json = $1; my $status = 501; # Not implementd @@ -118,13 +120,18 @@ secure_tag_with( $tag, $data ); } - print $client "HTTP/1.0 $status $method\r\nLocation: $server_url\r\n\r\n"; + if ( $json ) { + print $client "HTTP/1.0 200 OK\r\nContent-Type: application/json\r\n\r\n", + $param->{callback}, "({ ok: 1 })\r\n"; + } else { + print $client "HTTP/1.0 $status $method\r\nLocation: $server_url\r\n\r\n"; + } } else { - print $client "HTTP/1.0 404 Unkown method\r\n"; + print $client "HTTP/1.0 404 Unkown method\r\n\r\n"; } } else { - print $client "HTTP/1.0 500 No method\r\n"; + print $client "HTTP/1.0 500 No method\r\n\r\n"; } close $client; }