Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

PSP-HTTPD

From GameBrew
PSP-HTTPD
Psphttpd.png
General
AuthorElxx
TypeOther
Version0.6
LicenseMixed
Last Updated2006/02/12
Links
Download
Website

PSP-HTTPD is an extremely portable web server that runs off just your PSP's Wi-Fi capabilities, in Infrastructure mode. When you start it up, it will connect to the Wi-Fi router and then your PSP will be accessible by any other Internet-capable device on your network. This means that you can wirelessly browse the files on your PSP using your computer, cell phone, PDA, or even a second web browser-enabled PSP. If you're really short on computers, you can open up your router to the web and host a website off your PSP.

Also, starting at 0.6, you can upload files to your PSP wirelessly from anywhere in the world just by using your web browser.

There is also a new module called LHP included. This allows you to embed Lua code in web pages, to create dynamic server-side scripts on your PSP.

Installation

Copy the folders PSP-HTTPD to the /PSP/GAME directory on your Memory Stick.

Copy the folder LHP to the root of your Memory Stick.

User guide

Configuration

Open the config.txt file to change the primary settings. You may need to guess and check when selecting which value works best for the chunk size. If higher values cause transfers to frequently fail, lower the chunk size. However, the smaller you choose, the slower file transfers will be. The transfer error checking will keep fixing the data at a maximum of however many times you choose. This means that higher chunk sizes will work, but they might end up being even slower than lower ones.

It is recommended that you configure your PSP's network settings to use a static IP. This way, you know a single IP that you can always use for your PSP inside your network. However, dynamic IP's work fine as well, and the current IP of your PSP will be shown on the top-right corner of the console.

How to use

Start up your PSP, navigate to Game in the Cross Media Bar, go to Memory Stick(tm), and select psp-httpd 0.6.

If you did not select a default WLAN profile in the config file, you will be prompted to choose one. Select it by using the up/down arrows. When you confirm your selection, you have to press either O or X. If you want to be prompted each time the server does a 'soft restart', press O. Otherwise, to save the setting for the session, press X. Once the WLAN connection initializes, the app will load, basic info will be printed, and then the server will start.

To begin browsing your PSP, simply launch your web browser on a computer within the network and go to the PSP's IP. A directory and file listing should pop up and you will be able to browse. Any file can be downloaded as well. You can even connect to PSP-HTTPD using a second 2.0+ PSP and download music, savegames, and other files.

If, at any time, the server seems to stop responding to requests, you may need to restart it. This can be accomplished using two methods. Pressing Select will do a 'soft restart', which will simply disconnect your PSP from the access point and then reconnect it, saving your bandwith and uptime statistics. However, pressing Start will perform a 'hard restart', which will completely unload the PSP-HTTPD script and start it up again. This reinitializes the Wi-Fi functions conpletely. However, all statistics will be reset.

To shut down the server at any time, just press the Home button on your PSP and select "Yes" when it asks you whether you want to quit.

Uploading files

To upload a file to your PSP, click the "Upload File" link in the desired directory on the directory browser. You will be taken to a form where you can select a file to upload and also the location to upload it to. The location is automatically set to the directory you came from, but you may change it here. To upload the file, press Submit. Your PSP might freeze while the file is transferred, but the WLAN light should continue to flash until the file is uploaded.

Once the data is all sent to the PSP, the next page will tell you whether your upload was successful. You can then hit Back if you wish to upload another file to the directory.

Some reasons for your upload failing can be:

  • A file by the name already exists on the Memory Stick (the page will inform you of this).
  • There is not enough space left on the Memory Stick.
  • You entered an invalid location for the file. Make sure you follow the directions on the Upload page.
  • If your PSP locks up indefinitely, your file may be too large to send over the WLAN.

LHP server-side scripting

For basic documentation on LHP, please check the LHP 0.6.txt file.

Status bar

The blue bar at the top tells you some basic info about your server. It updates every time new text is printed in the console. In order from left to right, the data it shows is as follows:

  • Out - This is the total amount of data that your PSP has sent to other computers.
  • In - This is the total amount of data that your PSP has received.
  • Up - This is the uptime of the server, shown in a format of Hours:Minutes.Seconds
  • IP - The last item is your PSP's current IP within the network and the port it is listening on.

Debugging messages

When transferring a file, a series of | and . will be printed. At each attempt to send a chunk of data, | will be printed. If the chunk is successfully sent, it will be succeeded by a period (.) .

However, if the chunk is not send, the PSP will continue to try to send it up to fifty times, with 50 milliseconds between each attempt, which will be shown by additional |'s. If it is unable to do so, an X will be printed and file transfer will be aborted.

This may be due to network problems such as bad Wi-Fi reception. Stop the current browser request and try again. It has been noted that the server sometimes fails to respond to further requests after this has happened. You will need to restart it and try again.

Changelog

v0.6

  • Created the first implementation of LHP, for Lua-powered dynamic pages with psp-httpd.
  • Server can now parse variables in both GET and POST requests.
  • Included a script for file uploading.
  • Folder listing templates include a link to file uploader.
  • All network output (folder listings, headers, etc.) is now sent in chunks.
  • Server will not automatically restart after an error.
  • Added orange as a colour code for graphicsPrint.

v0.5.1

  • WLAN functions are now initialized only once in the app, improving speed and reliability.
  • Doing a 'soft reboot' no longer makes the connection unstable.
  • Server will still prompt you for profile even if you only have one, to give you time to do any needed setup.
  • After the server fails connecting a 3rd time, it no longer hard restarts - it will simply show the connection selection screen again.

v0.5

  • Server is now a standalone PSP app, using a custom compiled version of LuaPlayer.
  • New WLAN connection code in LuaPlayer core, allowing for quick checking of connection status without freezes.
  • Network profile selector now able to save your selection.
  • Network profile selector auto-connects if you only have one network profile.
  • Added top status bar to show input/output/uptime/IP info.
  • All server execution is within a single loop now, allowing for soft restarts.
  • Added slight margins and line spacing to console output for better readability.
  • Changed directory listing template to 90% relative width to make viewing on mobile/PSP browsers easier.
  • Split code and templates into separate directories.
  • Title of directory listing page reflects location.
  • Added auto_restart config setting.
  • Added autorestart_method config setting.
  • Fixed crash when trying to view non-existent directory.
  • Added MIME type for MP3 files.
  • Added screenshot function (press Triangle when idling to save to screenshot.png).
  • Changed 'bytes' to 'b' in file size parsing function.

v0.4

  • Added WLAN profile chooser at startup [thanks modsyn].
  • Improved error handling now resends only missing portions of chunks, allowing higher speeds.
  • Default chunk size increased to 8192.

v0.3

  • New template-based interface for directory listings.
  • Fixed error on exit, server now shuts down cleanly.
  • Config file revamped, now with commented options and two new settings: server port and send retries.
  • If the config file does not exist or options are missing, default variables will be loaded.
  • File sizes now sent in HTTP headers.
  • Added CSS mime type.
  • Changed default number of error-checking repeats from 100 to 80.
  • File send message in console now shows more detailed info about the file.

v0.2

  • Chunk size no longer internally set as 1024.
  • Default chunk size increased from 512 to 1024.
  • File transfer error correction improved considerably, transfer rates of 20KB/s + usable now without frequent corruption.
  • MIME type checking no longer case-sensitive, so files such as test.HtMl will still display.
  • File size added to files in directory view.
  • When browsing a directory with an index.htm file, the index.htm will be shown instead of directory listing.

v0.1

  • Initial Release.

Credits

Elton Muuga.

External links

Advertising: