Questions tagged [http.server]

41 questions
4
votes
1 answer

Python http.server - how to serve HTML from directory above cwd

I've got a question that I could really use some guidance with. I am simply trying to serve HTML from a directory that is not the same directory as the server itself. Ideally, I'd like to move one level above the server's directory, and serve a file…
4
votes
1 answer

http.server not responding until after the connection closes

I have an application which uses the requests package to POST to a server. In my testing environment, I want to stand up a simple server so that I can validate the client's requests. However, when I call requests.post, it just hangs. The server…
Daniel Walker
  • 6,380
  • 5
  • 22
  • 45
2
votes
0 answers

How to detect client disconnection when servicing a streaming endpoint with http.server

We have a simple web server written in Python's http.server. One of its endpoints serves streaming data - a series of events, with new events sent as they occur. We've successfully set up this endpoint so that it delivers the data as expected.…
macdjord
  • 517
  • 2
  • 4
  • 13
2
votes
2 answers

Python server showing html as text rather than rendering it

I'm trying to make a server the long way for more control/ learning. when i try to make a simple one with bash i get mimetype errors. I must be looking at this the wrong way but my server seems to make the browser render the html as text. the html i…
Lo_
  • 41
  • 7
2
votes
1 answer

How to remove .html extension from a site localhosted using python 3 http.server

Okay so first off let me be clear that I have "BASIC" knowledge of (HTML, CSS and JS) and a little bit of Python and am not much aware of various technologies and programming stuffs. So I hope the answer would be easy. I created a sample folder…
Programmer
  • 31
  • 2
2
votes
0 answers

Disable directory listing, python http Server

I have written a webUi in python (which is safely isolated from the internet, but I do not want the directory to be searchable). How can I disable the directory listing if I use e.g. this link? https://localhost:8080///
user17658201
2
votes
2 answers

http.server (SimpleHTTPServer) serve file.html instead of dir (using cmd)

Is it possible to serve not a index of a directory but rather an html file using Python SimpleHTTPServer on path '/'? Having directory with one file login.html serves a directory index on path '/'. python -m SimpleHTTPServer 7800 I want a content…
Milano
  • 18,048
  • 37
  • 153
  • 353
1
vote
0 answers

Python http.server options

Recently I was trying to developing my DownloadManager , cause of that I created test server by this command in Terminal: python3 -m http.server 8080 but when I was trying to take range of a specific file , it always give me whole of file ! , when…
H.M
  • 425
  • 2
  • 16
1
vote
0 answers

Fix "SharedArrayBuffer is not defined" on local http.server

I use python3 -m http.server --bind localhost to quickly host local versions of web content for testing. I was using this to host a web version of a game I was working on and ran into this error: Uncaught ReferenceError: SharedArrayBuffer is not…
idbrii
  • 10,975
  • 5
  • 66
  • 107
1
vote
0 answers

Run http.server in background (python, not bash)?

I need to start a server on localhost:3000 when starting python TestCase and then close it after TestCase finished. I just realized that http.server does not detach the server so after starting the server, the TestCase does not continue until the…
Milano
  • 18,048
  • 37
  • 153
  • 353
1
vote
0 answers

Running python -m http.server does not load localhost

Previously when I ran the python -m http.server command from a folder it would show the link as something like "http://localhost:5500", but after I accidentally installed npm install http-server it no longer correctly shows localhost and instead…
NatMargo
  • 21
  • 3
1
vote
0 answers

Python http.server module on Termux (Android terminal emulator app) cannot serve on local network ip address

I am trying to run: python -m http.server --bind 192.168.xxxxx #my local network ip address on Termux, an Android terminal emulator app. However, I get the OSError: [Errno 99] Cannot assign requested address exception. The same code works on my…
1
vote
1 answer

Python 3 Server command update

I am new to Python so i wanted to ask you for help. In old versions of Python to create a server which would not store any logs and its standard output was redirected to dev/null to avoid saving information, we executed the following…
Antuanct
  • 23
  • 7
1
vote
1 answer

HTTP POST with axios: net::ERR_EMPTY_RESPONSE

I am trying to make a HTTP Post request through axios: const onSubmit = (values) => { console.log("submit", values); // ctx.$i18n.locale = "en"; axios.post("http://192.168.3.2:8081", { // HTTP POST name: state.name, …
TaihouKai
  • 133
  • 11
1
vote
2 answers

What errors are outputted to http.Server's ErrorLog struct field?

I'm trying to understand the purpose of an ErrorLog struct field in http.Server struct. By its name I suspect that those are some kind of errors, but which ones? What would trigger errors being outputted there? Broken network? Too large http…
IvanD
  • 2,728
  • 14
  • 26
1
2 3