问题标签 [httpserver]

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 投票
0 回答
445 浏览

java - 具有基本授权的简单 apache mina http 服务器

我知道 asyncweb,但是 2.0 版本的文档不存在(或者今天可能是 Internet 禁止我)。

所以,如果有人对 Apache Mina 和具有基本身份验证的 Http 服务器有相同的经验,请告诉我。

谢谢。

0 投票
1 回答
572 浏览

java - 无法使用 AVD 绑定 Window7 上的端口 1131

我在 Windows7 上的 Android AVD 中使用以下 Java 代码来创建我的服务器,其中 serverPort = 1131;

我得到以下异常:-

我机器上的防火墙已关闭,我也为此添加了特殊规则。我需要为在 Window7 上的 AVD 上运行服务器做一些特别的事情吗?

请帮忙。

谢谢

0 投票
0 回答
373 浏览

module - NGINX 模块退出线程/主回调

我的小 nginx 模块遇到了一些麻烦(和头痛)。我最近看到了很多模块代码,还有很多关于 nginx 模块的东西,但我无法做我需要做的事情。这是我的问题:我创建了自己的名为“mymodule”的 nginx 模块。它的 loc_conf 结构如下所示:

它的命令结构如下所示:

在 ngx_http_mymodule 函数中,我做了一些事情并在 ngx_http_mymodule_loc_conf_t 中设置 serverConf 指针。问题是我想在线程/进程退出时检索该 serverConf 指针。但是在退出线程进程或主进程时给 ngx_module_t 的唯一参数是 ngx_cycle_t*,我找不到如何从中检索 ngx_http_mymodule_loc_conf_t 以便在该 serverConf 指针上工作。

[编辑] 我在线程退出回调中尝试了这个,但没有运气,没有一个非空的 serverConf 指针:

任何帮助或想法将不胜感激:) 在此先感谢。

0 投票
1 回答
266 浏览

web - 基于 Grand Central Dispatch(GCD)的 Web 框架?

是否有可能在 Grand Central Dispatch 的 dispatch_* API 的帮助下制作一个像 Node.js(在非阻塞异步友好的意义上)这样的 Web 框架?由于 GCD 以及 llvm 和 clang 是开源的,并且已经或正在被移植到 BSD 和 Linux,我在想是否有可能从头开始构建这样的框架。

0 投票
7 回答
23071 浏览

node.js - node js监听简单httpserver的EADDRINUSE错误

我有简单的节点 js http 服务器。

如果我跑

我明白了

我看过这篇文章,但那篇文章似乎特定于 TCP 服务器而不是 http 服务器。谁能帮忙。

0 投票
0 回答
745 浏览

java - HttpServer 与 Servlet - 显示更新的 BufferedImage 的方法

我有一个 Java 应用程序,并且想向 Web 客户端提供一个 BufferedImage(每秒更新几次)。

我首先查看了 HttpServer(JDK 6 的一部分)。我已经实现了一个 HttpHandler,并在句柄(HttpExchange 交换)调用中获取最新的 BufferedImage 并使用交换引用将其发送出去。

我可以使用我的网络浏览器查看通过交换发送的图像,当我刷新浏览器时,我可以观察到图像更新(因为我的应用程序正在更新 BufferedImage)。

对于下一步,我想在浏览器中不断更新图像(无需手动刷新网页)。似乎带有关联 HttpHandler 的 HttpServer 并没有真正设置为执行此操作(只是一次请求/响应)。我已经开始阅读有关 Servlet 的信息,并且正在研究使用 Jetty。

我想知道我在研究 Servlet 方面是否走在正确的轨道上,或者有没有办法将 BufferedImage 更新“驱动”到连接到我的 HttpServer 的 Web 客户端?

提前致谢。

我的句柄方法的代码片段打击:

0 投票
1 回答
1426 浏览

ajax - HTTP server for Windows Mobile 6

I have a mobile web app running as client-side JavaScript using Opera Mobile 10 on Windows Mobile 6.5 Professional (on a Motorola MC9500). (I've tried IE Mobile 6, but it doesn't support the canvas element nor enough JavaScript to be useful for my purposes.) I need this app to exchange messages with a native app on the same device. Because JavaScript is sand-boxed and I don't have access to ActiveX, it seems that one way to do this is to send/receive messages via AJAX through an intermediate server on the same device. Does anyone have a recommendation for an HTTP server that will run on Windows Mobile 6.5 Professional? This server should be able to cache the messages with persistent storage, e.g., SQLite.

I'm currently looking at PocketHPH, a PHP server. I have also found Padarn, an ASP.NET web server. I welcome any suggestions on small web servers that are better suited to this task.

Thanks.

Here's some clarification of my original question. The original web app is running on iPhone using Safari. It's a pretty complicated JavaScript app which I didn't write. So I'm trying to move it to Windows Mobile without having to rewrite the thing as a native app. The reason I'm moving it is because we're partnering with another company that has an existing native app that must run on an MC9500 which runs Windows Mobile 6.5 Pro. So I don't have any control or access to the code of the native app. However, our web app must exchange messages with the other company's app. Hence, many of the constraints, e.g., I can't use IWebBrowser2 from the native app. The other company's developer could try, but it doesn't look like he's going to go for that because there are much smaller things that he won't do. My understanding is that I can only use ActiveX from IE Mobile, not from Opera Mobile. However, there are several JavaScript features that IE Mobile 6 doesn't support. So I might be able rewrite the entire JavaScript app to make IE happy (I had already done quite a bit of rewriting before switching to Opera Mobile which has a much better JavaScript engine), but it would probably be easier to just rewrite it as a native app. It might be possible to engineer out the canvas element, but again if I'm going to do that, I might as well bite the bullet and rewrite the whole thing as a native app. So much for trying the "easy" route of porting to another web browser.

0 投票
1 回答
5767 浏览

c# - 用于生产中的简单 Http Server 的 HttpListener

我在 Windows 服务中使用 HttpListener 实现了一个非常简单的 C# Http Server,它等待请求并在收到请求时将它们发送到 ZMQ。它与这里的 HTTP 服务器非常相似 -生产就绪、多线程 c# http 服务器,只是它异步执行 RunServer 委托,然后一旦服务启动,就会处于 HttpListener 正在侦听的连续循环中。我想我有一些大部分工作的东西,但是当我停止服务器时,如果请求未完成,那么它会引发错误

由于线程退出或应用程序请求,I/O 操作已中止

在处理方法中。我担心我也忽略了生产环境所需的其他东西。

0 投票
1 回答
4265 浏览

.htaccess - .htaccess - 从 URL 中删除查询字符串(无重定向)

我的网址是http://www.example.com/eg1?redirect=xyz,应该是http://www.example.com/eg1

为此编写的重写规则如下:

重定向工作正常,但查询字符串仍然附加。当我把[R]标志放在最后的问号(?)很好用并删除了查询字符串,但带有[L]标志它不起作用。在我的情况下,我没有重定向,只是将它传递到另一个包含内容的目录。

0 投票
4 回答
1377 浏览

objective-c - Objective-C:[ClassName self] 是什么;做?

我正在查看CocoaHTTPServer 项目的源代码,更具体地说是HTTPServer.m文件,我只是不明白这一行:

这是做什么的(在任何地方都有记录)?它甚至是如何编译的?不应该