172 liens privés
http-echo-server
Will accept any TCP connection and echo back a HTTP response with the
entire content of the incoming TCP connection.
The server makes no attempt to understand the incoming HTTP request
hence it doesn't know when the request is completed and therefore just
terminates the TCP connection 2 seconds after the first data packet.
Installation
To setup a simple echo-server on Heroku just click this button:
Note that the Heroku routing stack will proxy the incoming request and
add custom HTTP headers.
Alternatively, to start it locally just run (only supported on newer
versions of npm):
npx http-echo-server
Or if you whish to install the module globally:
npm install http-echo-server -g
Example usage
Just curl the URL of the app:
curl http://<heroku-app-name>.herokuapp.com
Alternatively - if installed locally - you can start the server using
the command http-echo-server
, take note of the port it starts on and
then curl it:
curl http://localhost:<port>
Setting listening port
To set the http port, either supply the port as an argument to the
http-echo-server
executable:
http-echo-server 3005
Or use the PORT
environment variable:
export PORT=3005
http-echo-server
License
A great Windows utility for connections (ssh, sftp, xterm...)
A must have in your windows toolbox.
How to fix the "perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "fr_FR.UTF-8"
are supported and installed on your system." issue, often encountered when deploying
Python 2.x
$ python -m SimpleHTTPServer 8000
Python 3.x
$ python -m http.server 8000
Twisted <sub><sup>(Python)</sup></sub>
$ twistd -n web -p 8000 --path .
$ python -c 'from twisted.web.server import Site; from twisted.web.static import File; from twisted.internet import reactor; reactor.listenTCP(8000, Site(File("."))); reactor.run()'
Ruby
$ ruby -rwebrick -e'WEBrick::HTTPServer.new(:Port => 8000, :DocumentRoot => Dir.pwd).start'
Ruby 1.9.2+
$ ruby -run -ehttpd . -p8000
adsf <sub><sup>(Ruby)</sup></sub>
$ gem install adsf # install dependency
$ adsf -p 8000
Sinatra <sub><sup>(Ruby)</sup></sub>
$ gem install sinatra # install dependency
$ ruby -rsinatra -e'set :public_folder, "."; set :port, 8000'
No directory listings.
node-static <sub><sup>(Node.js)</sup></sub>
$ npm install -g node-static # install dependency
$ static -p 8000
PHP <sub><sup>(>= 5.4)</sup></sub>
$ php -S 127.0.0.1:8000