292 questions
0
votes
0
answers
194
views
Python ThreadingHTTPServer interacting with the main thread how to?
I am using Python 3.9 on a Raspberry Pi. I'm using a http.server.ThreadingHTTPServer so that I can run other tasks concurrently while handling HTTP requests. My needs are simple, so I don't want to ...
0
votes
1
answer
135
views
Add Content-Type header to Very simple SimpleHTTPRequestHandler without extending the class
I have an extremely simple http server setup for local testing:
#!/usr/bin/env python
from functools import partial
from http.server import SimpleHTTPRequestHandler, test
import os
HTTP_DIR = os....
-1
votes
1
answer
156
views
Why can't my web client accept an image from my web server?
I this is my java HTTP server:
public class WebServer implements Runnable {
public static final int PORT = 80;
@Override
public void run() {
HttpServer $server;
try {
...
0
votes
1
answer
1k
views
How can I host the folder's content for anyone to access and have my device act as a server while it's running?
I'm trying to share a folder for anyone to access while running the code by making my local machine act as a server
PORT = 8000
DIRECTORY = "/content/sample_data"
class Handler(http.server....
0
votes
0
answers
20
views
error when trying to connect to my websitename(Centos)
I'm trying to set up very basic http server on my hosting(centos)
The script is:
#!/usr/bin/env python3.8
from http.server import HTTPServer, BaseHTTPRequestHandler
class SimpleHTTPRequestHandler(...
0
votes
1
answer
1k
views
How to read image from python http.server POST requests without downloading
I'm new to python and http.server, I'm doing a simple API which allow client to post an image and server can do something with that image.
Below is my do_POST method:
class Server(...
0
votes
0
answers
199
views
FileNotFoundError even though Absolute Path Specified
I am running a simple python webserver [SimpleHTTPServer] in my Linux . Wrote a python program to download all the files hosted in that server to my Windows Machine . But for some reason program is ...
2
votes
0
answers
1k
views
Page loading shows pending status in chrome dev tools network tab, for python SimpleHttpServer
I have created python http server using http.server.SimpleHTTPRequestHandler, below is the code for it
PORT = 8008
Handler = http.server.SimpleHTTPRequestHandler
with socketserver.TCPServer(("&...
4
votes
2
answers
5k
views
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 '/'.
...
1
vote
0
answers
318
views
Unable to access file on local http-server from javascript fs
I'm trying to access the directory listing of files from the http-server webserver listing configured on the localhost:4040.
I have uploaded files using the http-server to mimic a file server for ...
0
votes
1
answer
2k
views
I'm using http.server with python3 and I want to store a request as a variable
I have this code
httpd = HTTPServer(('127.0.0.1', 8000),SimpleHTTPRequestHandler)
httpd.handle_request()
httpd.handle_request() serves one request and then kills the server like intended. I want to ...
1
vote
0
answers
304
views
Javascript not functioning when conducting local testing
Good Morning/Afternoon/Evening all,
I'm working on developing a fairly simple webpage, I have index.html setting up the appearance of the page and in the header I have a link to a js file:
<script ...
0
votes
1
answer
2k
views
Simple http Server does not work when converted to exe
I wrote a simple python http server to serve the files(folders) of the present working directory.
import socketserver
http=''
def httpServer(hostIpAddress):
global http
socketserver.TCPServer....
0
votes
1
answer
1k
views
Running Python’s SimpleHTTPServer in a GUI
I am writing a GUI wrapper around Python’s SimpleHTTPServer. It looks like this:
The GUI uses tkinter. When I click on the OK button, it launches the web server.
The web server code is based on the ...
0
votes
2
answers
564
views
Send Javascript data to SimpleHTTPServer
I'm doing the xss challenge on tryhackme.com (https://tryhackme.com/room/xss). The 7th task asks me to use a simple keylogger
<script type="text/javascript">
let l = "";
...
1
vote
1
answer
3k
views
Save file received from POST request in Python
I'm trying to implement an upload feature to the basic http.server Python module.
So far, I've created a new class named SimpleHTTPRequestHandlerWithUpload which inherits from SimpleHTTPRequestHandler ...
1
vote
1
answer
2k
views
Create HTTP get response with attached binary data file and json formatted metadata
I'm using BaseHTTPServer.BaseHTTPRequestHandler in order to implement my server.
currently I repsonse to get request with merely binary data file.
self.send_response(200)
self.send_header("...
2
votes
1
answer
7k
views
How to run python with SimpleHttpRequestHandler
I'm using python3.
I want to show a one page but I got 404 not found file:
import pymysql.cursors
import http.server
import socketserver
from furl import furl
class MyServer(http.server....
0
votes
0
answers
135
views
changing text properties as part of html script
I want to build a simple http server which receives list of text strings and sends simple dynamic html page which presents them in loop (similar to RSS)
It works fine but now I want to control text ...
8
votes
1
answer
18k
views
Loading module from was blocked because of a disallowed MIME type (“”)
I am going through a three.js example and when I use import within a javascript module I get the error:
Loading module from “http://localhost:8000/build/three.module.js” was blocked because of a ...
1
vote
1
answer
1k
views
How to reliably know that HTTPServer in a separate thread is up and serving?
I'm starting a HTTPServer object in a new thread:
from http.server import HTTPServer, SimpleHTTPRequestHandler
import threading
with HTTPServer(("localhost", 8080), SimpleHTTPRequestHandler)...
0
votes
1
answer
665
views
Is closing http.server.HTTPServer guaranteed to be thread-safe?
from http.server import HTTPServer, SimpleHTTPRequestHandler
import threading
with HTTPServer(("localhost", 8080), SimpleHTTPRequestHandler) as httpd:
threading.Thread(target=httpd....
0
votes
1
answer
133
views
corrupted encoding of html message
I am building a simple server which responds to a GET request and sends html which contains table of utf-8 values.
The table is created from json object by using pandas DataFrame and to_html method
...
1
vote
1
answer
7k
views
Unable to download an existing file with wget and python http server
so I mounted an http server with python -m SimpleHTTPServer I get:
Serving HTTP on 0.0.0.0 port 8000 ...
But when I try to download with
wget http://192.168.100.65:8000/tmp/postgres_default_pass.txt
...
0
votes
1
answer
177
views
how create Java HttpsServer multi threaded?
I have HttpsServer:
public void startHttpsServer() {
try {
httpsServer = com.sun.net.httpserver.HttpsServer.create();
httpsServer.bind(new InetSocketAddress(httpsPort),...
1
vote
1
answer
52
views
Why does the SimpleHTTPServer not serve wav files when serving a node.js app?
When I do a
http://localhost:8090/
Most of the files in the root directory are displayed: e.g. .js and .py . But all of the .wav files are omitted. When trying to access it directly:
localhost:...
1
vote
1
answer
4k
views
Create web server using ONLY standard library
I would like to implement a web page in Python using ONLY the std library.
I have done it in PHP but I want to do it in Python and it is very difficult to me to understand the documentation.
This ...
0
votes
0
answers
1k
views
SimpleHTTPServer only works with localhost - "::" instead of <ip address>
I try opening a SimpleHTTPServer in windows and I can only access it with localhost:.
This is what I get:
python -m http.server 80
Serving HTTP on :: port 80 (http://[::]:80/) ...
Notice that my ...
4
votes
1
answer
4k
views
Can't Connect to my Simple Http Server on http://127.0.0.1:8000/ or external IP
I have python 3.8.1 installed on my Windows 10 PC.
I run the following command from PowerShell in the directory I want to set as server
python -m http.server 8000
I get the following response after ...
1
vote
2
answers
2k
views
Is it possible to create never crashing python code with exception handling?
I wonder if the below python code (specifically http server) ever crashes? Assuming that there is no grammer error in any of the library code(already compiled), what I think that handling the ...
1
vote
1
answer
2k
views
python http.server module not working over port 80 in Remote File Inclusion exercise
I am doing a pentesting challenge and I am working on one machine that requires gaining access through a Remote File Inclusion vulnerability. In the past I was able to get a webshell by including a ...
2
votes
0
answers
274
views
live.js vs. python SimpleHTTPServer
The idea
To speed up my development I want to automatically refresh the browser if I change the file test.html.
My setup
I'm on Linux and I start my server with
python -m SimpleHTTPServer
in a ...
19
votes
2
answers
23k
views
SimpleHTTPServer not found python3
I'm trying to write a simple server in python. I'm trying to import a few modules:
from http.server import HTTPServer
from http.server import SimpleHTTPServer
Because the doc says it has been moved.
...
3
votes
1
answer
5k
views
Python HTTP Server Serves Two Paths Using Different Kinds of Handlers
From other SO posts, it's clear how to serve content from a specific directory, and how to map an incoming path to different do_GET handlers.
To expand on the second question in a way relating to ...
1
vote
1
answer
2k
views
How to get IP address of the client who made request to python SimpleHTTPServer?
I am setting python local server using python -m SimpleHTTPServer, I made that server publicly available using ngrock and have some public IP address like http://2ee94---.ngrok.io. Now I am making the ...
0
votes
1
answer
225
views
Python Http Server: shut down server when shared queue has N items
I'm implementing an HTTP server using python BaseHttpServer.
I have a queue that is shared by different threads. And each time my handler receives a request, it puts it into the shared queue. When ...
0
votes
1
answer
160
views
Java ServerSocket/socket multiple chat with default web page
Hey all I am creating a chat program that can handle multipule clients to one server. Everything works just as it should on the chat side. I can have 3 clients open and talking to each other and it ...
1
vote
2
answers
1k
views
Cannot link index.html file to style.css file in another folder
I'm trying to link my style.css file to my index.html file. Both files are located in separate folders.
Folder structure:
/parent
/src/index.html
/css/style.css
Codes that I have tried using:
<...
0
votes
0
answers
103
views
Editing text on a http server hosted by esp8266
I have a simple http server hosted by an esp8266. I want to be able to write text to the web page that is displayed. However, I can't find an example of how to do this. Thanks for the help, just ...
0
votes
1
answer
1k
views
Website: Send data from javascript (client) to python (server)
I have wrote a website using html/css and javascript and I am running this site using a simple python script
import http.server
import socketserver
PORT = 8000
Handler = http.server....
1
vote
1
answer
2k
views
python 2 web server local host error. The server responded with a non-JavaScript MIME type of "text/plain"
(First time)
I used python -m SimpleHTTPServer 8000 using python 2.7.15 to generate a web server for my simple JavaScript game (still learning), but it seems that it has some error, which makes the ...
3
votes
1
answer
1k
views
Using Python SimpleHTTPServer to serve files without .html
I want to use SimpleHTTPServer to serve my local site while I'm developing. I'm using basic javascript, HTML, and CSS. I have this kind of project structure:
app (folder with src files)
dist (build ...
0
votes
0
answers
402
views
How do I modify the source files of a localhost SimpleHTTPServer from a different device on the network?
I have just started to use SimpleHTTPServers, and I was wondering how I can modify the source files from another device that is on the network. I want to keep it as simple as possible (right now I am ...
0
votes
1
answer
723
views
How to fix simple http server written in python 3 using Terraform on AWS EC2 Centos
I'm initiating new AWS EC2 instance using terraform main.tf for Centos AMI. I'm able to create and connect the AWS instance.
but I have below problem
When, I start simple python 3 based http server ...
1
vote
1
answer
1k
views
How to change SimpleHTTPServer code to an equivalent production server
I wrote the following code to accept a HTTP POST and then write out a temp file that includes the POST data and then send that temp file to a printer using subprocess and the UNIX lp command.
from ...
2
votes
2
answers
1k
views
FileNotFoundError: [Errno 2] CGI, python3
I've been searching for a solution to this but none helped me.
Key points:
OS: Ubuntu 18.04
File to run: /var/www/html/cgi_test/cgi-bin/hello.py (exists for sure)
which python3: /usr/bin/python3 (OS ...
0
votes
1
answer
3k
views
How to limit to specific directory access on Python simplehttpserver
Currently if I go to "http://localhost:8035/", I can see and have access to all the files, including root directory, client_files directory, and server_files directory(i.e. I have access to all files, ...
1
vote
0
answers
270
views
How to manage user session on Java Simple HTTPServer running on localhost?
I have an Java Simple Java HTTPServer running on localhost. I exported my Java application as jar file. And I am running it from console by writing. This java HTTPServer can work on either the nodejs ...
0
votes
0
answers
111
views
Sending buffer instead of file with SimpleHTTPServer
Is it possible to send binary data buffer via SimpleHTTPServer instead of a file? I'm generating some data that I rather not write to disk. If not is there any minimal python webserver that can do ...
4
votes
1
answer
3k
views
receive binary file from POST request with BaseHTTPRequestHandler
I have been experimenting with some code from this forum. It has worked okay so far to receive pieces of json delivered in curl POST requests, but am now trying to send it a small .jpg file. It is ...