Questions tagged [httpserver]

An HTTP Server is any application which receives requests via the HTTP protocol and sends back the corresponding response to fulfill the request.

An HTTP Server is any application which receives requests via the HTTP protocol and sends back the corresponding response to fulfill the request. This is the main method used by websites to handle HTML pages, Stylesheets, Scripts, Images, and other various types of files and requests which a web page may request from the server. HTTP Servers also handle other attributes of such a request, such as Query Strings and Cookies.

1287 questions
1619
votes
7 answers

What is the Python 3 equivalent of "python -m SimpleHTTPServer"

What is the Python 3 equivalent of python -m SimpleHTTPServer?
ryanbraganza
  • 16,863
  • 3
  • 17
  • 24
407
votes
22 answers

Simple HTTP server in Java using only Java SE API

Is there a way to create a very basic HTTP server (supporting only GET/POST) in Java using just the Java SE API, without writing code to manually parse HTTP requests and manually format HTTP responses? The Java SE API nicely encapsulates the HTTP…
asker
  • 4,095
  • 3
  • 15
  • 3
333
votes
15 answers

What is a faster alternative to Python's http.server (or SimpleHTTPServer)?

Python's http.server (or SimpleHTTPServer for Python 2) is a great way of serve the contents of the current directory from the command line: python -m http.server However, as far as web servers go, it's very slooooow... It behaves as though it's…
Drew Noakes
  • 300,895
  • 165
  • 679
  • 742
198
votes
17 answers

Get and Set a Single Cookie with Node.js HTTP Server

I want to be able to set a single cookie, and read that single cookie with each request made to the nodejs server instance. Can it be done in a few lines of code, without the need to pull in a third party lib? var http =…
Corey Hart
  • 10,316
  • 9
  • 41
  • 47
133
votes
12 answers

Build a simple HTTP server in C

I need to build a simple HTTP server in C. Any guidance? Links? Samples?
Nathan H
  • 48,033
  • 60
  • 165
  • 247
113
votes
4 answers

npm http-server with SSL

I'm using the npm package "http-server" (https://www.npmjs.com/package/http-server) to set up a simple webserver, but I cannot get it to use SSL. My command in package.json is http-server -p 8000 -o -S with a cert.pem and key.pem in my root…
delucasvb
  • 5,393
  • 4
  • 25
  • 35
72
votes
1 answer

How to silent/quiet HTTPServer and BasicHTTPRequestHandler's stderr output?

I am writing a simple http server as part of my project. Below is a skeleton of my script: from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler class MyHanlder(BaseHTTPRequestHandler): def do_GET(self): self.send_response(200) …
Hai Vu
  • 37,849
  • 11
  • 66
  • 93
53
votes
3 answers

How can I receive an uploaded file using a Golang net/http server?

I'm playing around with Mux and net/http. Lately, I'm trying to get a simple server with one endpoint to accept a file upload. Here's the code I've got so far: server.go package main import ( "fmt" "github.com/gorilla/mux" "log" …
user7179784
  • 531
  • 1
  • 4
  • 3
44
votes
2 answers

Python HTTP Server/Client: Remote end closed connection without response error

I made simple HTTP Server using BaseHTTPRequestHandler. The problem is, that when I want to post some data using requests from client, I get ConnectionError. I did simple request from requests lib documentation. Also interesting thing is, that HTTP…
martin1337
  • 2,384
  • 6
  • 38
  • 85
42
votes
2 answers

How to start http-server locally

I cloned angular seed which is using node http-server and it is working perfectly using following configuration. Command : npm start (from root of project) Following configuration in package.json file: "start": "http-server -a localhost -p 8000…
JS-JMS-WEB
  • 2,555
  • 3
  • 17
  • 26
37
votes
1 answer

Why are request.URL.Host and Scheme blank in the development server?

I'm very new to Go. Tried this first hello, world from the documentation, and wanted to read the Host and Scheme from the request: package hello import ( "fmt" "http" ) func init() { http.HandleFunc("/", handler) } func handler(w…
moraes
  • 13,213
  • 7
  • 45
  • 59
34
votes
2 answers

Simple HTTP server for logging requests only

I need to run a simple HTTP server that will only log incoming requests and nothing. It should log whole requests' content. Like headers, cookies, body.... I need just simple solution that I can run in a few minutes and will work. Implementation…
user4230508
32
votes
2 answers

Running http-server in background from an npm script

How do you start http-server in the background from an npm script so that another npm script, such as a Mocha test using jsdom, can make an HTTP request to http-server? The http-server package was installed with: npm install http-server…
Dem Pilafian
  • 5,625
  • 6
  • 39
  • 67
32
votes
7 answers

Are there languages/software that implements http status code 418?

I know that status code 418 was defined as a April Fools' joke, and "is not expected to be implemented by actual HTTP servers" as is stated on Wikipedia. But I would be interested if any of you knew of a language/webserver/IDE that supports it. I…
Levite
  • 17,263
  • 8
  • 50
  • 50
31
votes
5 answers

Java class for embedded HTTP server in Swing app

I wish to embed a very light HTTP server in my Java Swing app which just accepts requests, performs some actions, and returns the results. Is there a very light Java class that I can use in my app which listens on a specified port for HTTP requests…
CodeAndCats
  • 7,508
  • 9
  • 42
  • 60
1
2 3
85 86