Limit upload speed for testing on lighttpd - upload

I'm implementing ubr upload. It used Perl and PHP to upload files with a progress bar. I'm running a lighttpd development server and would like to test it fully. Currently it just transfer the files instantly since its really just moving files on my computer. Is there a way to make it seem like it actually transfers it slowly so I can watch the progress bar?
I tried adding the following to my lighttpd.conf. It may have slowed down loading the pages a little, but uploads are still instantanteous.
$HTTP["host"] == "localhost" {
server.kbytes-per-second = 8
}
Thanks

Instead of throttling things on the server side, you could try throttling your client machine. There's a nice article on how to throttle bandwidth on macs over at O'Reilly:
Exploring the Mac OS X firewall
ipfw is a BSD thing, but on Linux you could try using the shaper module and shapecfg:
Traffic Shaping Basics

$HTTP['host'] contains the host of the server. You could put the config variable in the configuration file without the host check.

Thanks for the help! Actually, I'm dual booting and just tested my exact script on my apache server. When I transfer a 200mb file on apache it actually displays the progress bar as the file transfers. On my lighttpd server, the page is "busy" as it posts the file in the background, then the bar pops up as 100% complete.
I think the way the script works is that CGI posts the file, and as it is doing that it keeps writing the size it has written into another file. Then a php script is being called every second which opens this file and looks at how much has been written.
It seems like my lighttpd server is not allowing perl and php to work at the same time.. I may be wrong though.
On my windows server I actually installed WAMP and perl. My lighttpd is using fastcgi for the php and just mod_cgi module for the perl scripts.

Ah it looks like other people have issues with lighttpd and uber uploader...
(can't link to it since I'm new)
Now the question is if lighttpd is worth using since I'll have to change this on top of all my mod_rewrite stuff.

Try using charles: http://www.charlesproxy.com/

You can limit your browser bandwidth by using the Sloppy HTTP proxy: http://www.dallaway.com/sloppy/
Sloppy deliberately slows the transfer of data between client and server.
Example usage: you probably build web sites on your local network, which is fast. Using Sloppy is one way to get the "dial-up experience" of your work without the hassle of having to install a modem.

Related

How to build a server database for my application

I'm new to server side programming with a background in iOS. So I want to know where to start.
Here I tried to list some specific questions:
Can I just create a local database and practice on that?
Do the local databases and databases on remote server work the same?
If no, how can I choose which server I can use? (I went through the webpages of AWS cloud service and found they are really overwhelming.)
Arslan's answer is great, but I would like to add to it a bit. You mentioned a Chatroom, so in that case you should look into socket programming. The reason why I bring this up is, while no one has outright said it, you shouldn't create a chat server by read / writing to a database. It's much better to just keep it in memory and log to the database on an as need basis.
AWS is a fantastic solution and they have a lot of different solutions for different situations. You should look at using EC2, which is their server program. They have a free tier of it so that you can use and / or you can test locally. I suggest testing locally then pushing up to a free tier every now and then to make sure everything is running properly.
Also I would look into using CloudKit for data base storage. If you don't need instantaneous communication, it's far easier to use Apple's built in system rather than setup a server and manage it.
links: CloudKit, AWS EC2 Free Tier
As it happens I'm actually working on a ChatRoom Server program, here's the link to github. It is written in C++ so I recommend using it as a reference unless you want to write your own socket in C++.
Can I just create a local database and practice on that?
Sure. You can install a server locally on your machine ( there are plenty of available ) and through 'localhost:3000' or 'localhost' you can access the root of your server depending upon what you are using at server end. You can then configure your server to respond to a particular message.
Do the local databases and databases on remote server work the same?
Of course, the work they way is almost same. The difference you have stated yourself: remote.
If no, how can I choose which server I can use? (I went through the webpages of AWS cloud service and found they are really overwhelming.)
I would suggest you to start from the local server. But first you have to choose language: PHP, Ruby, Python - it depends upon you and your personal preferences. You can also use something like Parse.com. Parse.com is free up to 30 requests/second, and you can use Objective-C to send and retrieve data from the server with a few very easy steps. And of course, parse.com handles singing up and logging in a user for you , all you have to do is to write a code of few lines in your iOS app.
Download Apple's free Server.app from the Appstore, it wraps one of the best database management systems: PostgreSQL. Start it with this Terminal command:
sudo serveradmin start postgres
More info on these pages:
http://support.apple.com/kb/HT5583
http://www.postgresql.org

Lighttpd and buffering of POST uploads to CGI on embedded device

I'm using lighttpd on an embedded device with relatively low amounts of RAM and flash storage, and I'm running into the issue with Lighttpd where it's buffering to disk(or RAM) the entire file upload and the system is running out of space. When using apache, it will essentially stream through the data directly to the CGI program, which is what I need.
From my research, I haven't been able to find any way to configure lighttpd (or nginx) in order so that it will not buffer the entire file upload, but rather pass it directly or stream it to the CGI program which will consume it.
The application is a system upgrade which will be written directly to a certain area of flash by the CGI program, but I simply don't have the space for any type of buffering/caching which seems to be required by the lightweight web servers I have looked at.
Does anyone know of a way to avoid this buffering with lighttpd/nginx or other lightweight web server ?
The Nginx Upload Module was written to handle these types of situations but it appears abandoned by the author and apparently does not work with Nginx 1.3.9+
The Nginx Big Upload Module is an extension to the Nginx Lua Module to handle this.
If you prefer to do things yourself, you can try the Lua Resty Upload extension to the Nginx Lua Module written by the author of the Lua Module himself.
Since lighttpd 1.4.40 (released July 2016) server.stream-request-body = 2
See lighttpd server.stream-request-body doc
(old question, but it came up at the top of a search, so I am updating with an answer)

Writing Minecraft panel in Ruby on Rails

I'm planning on writing a control panel for Minecraft in Rails but I don't have much experience with Java at all, Minecraft seems to have some standard remote connection and query tools, but most conventional panels don't seem to use them. For example with McMyAdmin, I have disabled remote connectiona and the query, but it still seems to be able to communicate with the server after restarting it after I've edited the server configs to disable the settings.
What I'm asking is if anyone knows how McMyAdmin communicates with the Minecraft server, it comes with a plugin, but I've deleted that as well and it still seems to be able to communicate with the server, I know McMyAdmin is written in .NET and I believe it uses Mono as it's server, as it's cross platform.
If anybody could shed some light on this I'd be ever so greatful, just trying to get my head around the communication.
McMyAdmin uses the plugin to open a socket that it can interact with(Not sure which features are provided using this plugin). The rest of the features are just from the Process instance that it creates. It also just edits the config files for a few things as well or runs commands using the input stream of the process.

How To SSH From IPhone App

So I have been looking every where, and so far i haven't been able to find anything that allows me to ssh from an iPhone app, and have finally resorted to posting a new pos.
So I am trying to make an app to manage servers and part of the tasks that I need to be able to do it to be able to some how remotely connect over the internet to a server with either an ip address or a DNS name.
The connection to the server does not necessarily need to be a SSH connection, it could be a telnet although because of the security issues i would prefer SSH (if it is a lot less code I would accept telnet), but on the other hand it could be some other type of connection.
The application just needs to be able to run a script on the server end and if a SSH or telnet I would not need any help but if some other type of connection i may need a bit of help. Also the server on the other end is intended to be linux server (either ubuntu or gentoo, but not sure which yet but all i can say is will almost certainly be a linux server operating system).
I have already looked at the libssh/2 and would welcome any other similar demos as have not been able to work out how get the frameworks to work as well as licensing issues with using the frameworks in it.
PS. I am relatively new to programming and although i have some basic knowledge of coding some type of tutorial or sample code would be greatly appreciated.
Many Thanks For Any Help
Thomas
SSH is a hugely complicated beast. As long as you only need to execute one command without interactivity, it sounds like you could achieve the same thing by running a web server on the server and posting the commands via HTTP from the device. You can use SSL to achieve security. You'll need a mechanism that allows you to authenticate the device (you'd need something with ssh, too). And you'll have to have something in the web server on the server that figures out and runs the desired script. But all that is still hugely easier than dealing with libssh.

How to monitor File Uploads without using Flash?

I've been looking for a way to monitor file uploading information without using flash, but probably using ajax, i suppose. I want to monitor speed and percentage of finished file upload.
Do you know of any resource that describes how to do that, or what i should follow to do it ?
In the pre-HTML5 world I believe this requires web-server support. I've used this Apache module successfully in the past:
http://piotrsarnacki.com/2008/06/18/upload-progress-bar-with-mod_passenger-and-apache/
The only way without flash is to do it on the server. The gist is:
Start the file upload
Open a streaming connection to the server
Have the server read the post headers to tell you how large the file is going to be
Have the server repeatedly check the file size (in /tmp generally) to see how complete it is
stream the % done back to the client
I've done it before in other languages, but never in ruby, so not sure of a project that's done it, sorry.

Resources