The “SCP” implementation of WinSCP

SCP is a simple protocol for secure file copy. Only file-copy (bi-directional) is supported by scp.

However, the WinSCP implementation of “SCP” is actually a GUI for the remote shell.

WinSCP requires login access to remote server. After login, it make use of common *ix commands like ls, ln, mv, etc. The real scp client is only called when there’s a need to exchange files (i.e. download / upload). Other than that, the operations are indeed completed by the remote shell. And because of that, the implementation is rather platform-dependent. As different distributions have different output formats, especially with “ls”, the output varies among each other. (And that’s why WinSCP recommends to use bash on the server side as default shell for remote login).

So when you use “SCP” protocol in WinSCP, you’re actually using a SSH client with scp. WinSCP should name it like “SCP (with Shell)” or something to avoid misleading.

IE 8 fixes submit button bug

Sometimes when you submit a form, you may wanna disable the submit button. (e.g. When the user is posting a order / payment).

The first idea popped up in my head was like this:

 
 
 
 
<form action="http://www.google.com/search">
<input name="q" type="text" />
<input onclick="this.disabled=true; window.alert('test');" type="submit" />
</form>

Actually I was using similar code in a real life application for a client. Then he told me it can’t work. After a little test I found out that IE 7 won’t submit the form when you disable the submit button. Firefox can handle it properly though.

And as I’m messing around with IE 8, I found they fixed the bug.

To test it, go to http://playground.softboysxp.org/post_test.html , type something and hit the button. You should see a message box, then the query will be submitted to Google. While in IE7, the form won’t get submitted.

PSP Internet Browser HTTP Headers

I remember visiting a PSP-only website, which when browsed on PC, gives a different output saying something like “you should view this on PSP”. I wonder how they implemented it.

I guess PSP must send some kind of special info to the server, so I wrote a little PHP script showing request headers. (traditional sniffers / browser plugins won’t work now, unless you wanna port them to PSP yourself, lol).

As my hosting does not allow apache_request_headers, I have to extract the data from $_SERVER myself.

<?php
foreach ($_SERVER as $k => $v) {
	if (substr($k, 0, 5) == "HTTP_") {
		// Format the variable names
		$k = str_replace('_', ' ', substr($k, 5));
		$k = str_replace(' ', '-', ucwords(strtolower($k)));
 
		echo "<tr><td class=\"e\">$k</td><td class=\"v\">$v</td></tr>\r\n";
	}
}
?>

You can point your PSP to http://playground.softboysxp.org/show_request_header.php and test it yourself.

Here’s a snapshot taken on my PSP

Clearly, there are two PSP-specific variables, x-psp-browser and x-psp-productcode. Also notice that the User-Agent was set to reflect PSP’s browser.

Further Research

I googled x-psp-browser and found this document by SCE.

Guidelines for Creating Content for the “PSP” Internet Browser (Japanese)

User-Agent by far can only be “User-Agent: Mozilla/4.0 (PSP (PlayStation Portable); 2.00)

x-psp-productcode represents the region of your PSP and can be one of the following

Region Code
開発ツール (Development Tools) “TOOL”
日本 (Japan) “J1”
北米 (North America) “UC2”
東欧/欧州 (Europe) “CEL”
韓国 (Korea) “KR2”
UK (United Kingdom) “CEK”
メキシコ (Mexico) “MX2”
AU/NZ (Australia/New Zealand) “AU3”
南アジア (South Asia) “E12”
台湾 (Taiwan) “TW1”
ロシア (Russia) “RU3”
中国 (China) “CN9”

x-psp-browser is in the format of “n.nn (xxx; yyy; zzz; …)”
n.nn is the version of the firmware
xxx, yyy, zzz … being parameters, specify from where the browser was lunched, with LX for XMB, SX for applications under XMB, and LU being applications on UMD or Memory Stick. Another parameter, “system”, specifies the version.

Another variable, x-psp-application can be used to specify the name of the game/application, when the browser was launched by an application on UMD/Memory Stick.