问题标签 [basehttpserver]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
6 回答
27393 浏览

python - BaseHTTPRequestHandler 与自定义实例

这是我的 http 服务器:

我需要访问 myHander 中的实例 t1。

有什么办法吗?

谢谢!

0 投票
1 回答
7307 浏览

python - 如何从 Python 中的请求处理程序内部关闭 HTTPServer?

当我收到 StopIteration 异常时,如何关闭此服务器?sys.exit() 不起作用。

0 投票
1 回答
2205 浏览

python - 出现错误:[Errno 10053] 尝试在 http 响应中发送文件时

我试图通过在 Python 中写入wfile变量来在 http 响应中发送一个大文件BaseHTTPRequestHandler,当我尝试这样做时,我总是以我的 Python 代码中的以下异常结束。

error: [Errno 10053] An established connection was aborted by the software in your machine

谁能帮我解决这个问题??为什么会出现错误?如果在 HTTP 响应中发送大文件的方式不是很好,请建议我可以参考的地方。

提前致谢!!!

错误跟踪:

0 投票
1 回答
880 浏览

python - BaseHttpServer 返回带有西里尔字母的代码 404

我有以下问题。

我使用了 BaseHttpServer。

如果文件的路径包含西里尔字母。

我得到代码 404。

谢谢你。

截图浏览器

截图服务器

0 投票
1 回答
653 浏览

python - 在 Ubuntu 服务器上延迟获取对 basehttpserver 的请求

我的问题...

  1. 我们有一个本地网络。
  2. 我在带有 Ubuntu Server(12.04.2) 的虚拟机上运行 python basehttpserver。

当我在浏览器链接 192.168.101.3:8081/index.html 中打开时,请求处理了 10 秒,为什么?

示例库httpserver

服务器截图 日志服务器

带有ubuntu服务器192.168.101.3的IP机器

对不起我的英语不好。

我的解决方案 - 我在 ReqHandler 中添加了以下方法

0 投票
3 回答
8902 浏览

python - 您如何覆盖 BaseHTTPRequestHandler log_message() 方法以记录到文件而不是控制台(sys.stderr)?

我正在使用 BaseHTTPServer.HTTPServer 创建一个 Web 服务

我想记录以下内容以记录到文件而不是控制台。但我还没有设法找到这样做的方法。

我的代码如下所示:

我正在使用 Python 2.6

0 投票
1 回答
1595 浏览

python - CGI FieldStorage will only return None?

I put together the following script that i would like to return the "Hello World !('192.168.0.162', 48344)bob" when in my browser i have

however when i run the following program it returns Hello World !('192.168.0.162', 48344)None

What is wrong?

0 投票
4 回答
6033 浏览

python - Python HTTP 服务器和线程

我尝试使用 Threading 在 Python 中创建 HTTP 服务器:

服务器运行良好,但如果两个请求是同一时间,它们会按顺序执行。所以第二个请求在第一个请求完成之前不会执行。

0 投票
1 回答
4467 浏览

python-3.x - 使用 BaseHTTPRequestHandler 的重定向功能

这是我的代码:

如何编写函数以从路径重定向到另一个路径?

0 投票
1 回答
1062 浏览

python - Start daemon process within BaseHTTPServer

In order to allow helpdesk to restart an Oracle Instance, we are trying to implement a small python webserver that would start a shell script that starts the Oracle instance.

The code is done and it starts the instance but there is a problem: the instance is connected to the webserver, so the buffer to the browser is not closed until the instance has been stopped, and there is a ora_pmon_INSTANCE process listening on the webserver port.

I tried to launch the script with:

and

but it happens the same.

I also tried to launch a script with daemon (using daemon function from redhat's init scripts). The script starts the Oracle instance with the same result.

This is my code:

Can any of you help me?