问题标签 [http-error]
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.
php - 在 PHP curl_exec 中读取错误正文
当使用 PHP 的 curl_exec 调用 RESTful API 时,文档说http://php.net/manual/en/function.curl-exec.php
成功时返回 TRUE,失败时返回 FALSE。但是,如果设置了 CURLOPT_RETURNTRANSFER 选项,它将在成功时返回结果,在失败时返回 FALSE。
当 curl_exec 失败时,它返回 false。但是,远程服务器可能已尝试返回有用的消息来解决该错误。当它只返回 false 时,我们如何使用 curl_exec 访问此消息?
例如,远程 API 可能会返回此消息和 HTTP 400 状态代码:
目前我无法阅读已返回的此错误消息,而是我得到的都是错误的。我也看过 curl_info 。我确实设置了returntransfer。
在 C# 中,我将使用该exception.Response.GetResponseStream
方法并编写:
如何在 PHP 中做到这一点?curl_exec 是正确的方法还是应该使用其他方法?
exception - 状态码异常 (com.google.gwt.user.client.rpc.StatusCodeException: 404 )
运行登录应用程序(使用 GWT-RPC)时出现此错误。我该如何解决这个问题?我也提供了错误列表。我错过了什么?
------ VinLog.html
------ web.xml
------错误列表
asp.net - HTTP Error 503, the service is unavailable
I'm really new to setting up web servers in general. I've got IIS 8 on Windows 8, and I'm trying to set up a little site locally, while doing some development. In IIS I choose Add Site, give a name, points to a location where I have a index.html file (I've tried different locations, latest in a c:\inetpub\wwwroot\test -folder) and otherwise use all default settings. However, when I try to browse to localhost I get
HTTP Error 503. The service is unavailable.
I've verified the pool is started, and I've given IIS_IUSRS Full Control on the target folder
I've search around but not found anything that solved my issue, and there's nothing helpfull in the EventLog or in the C:\Windows\System32\LogFiles\HTTPERR folder
Could anyone tell me what's wrong?
http - 可以压缩对 http 请求错误的响应吗?
当尝试执行导致 400 Bad Request 错误的 http 请求时,nginx 服务器返回“400 Bad Request”、Content-Encoding: gzip 和非编码格式的响应。
所以由于 Content-Encoding: gzip 我的代码用 GZIPInputStream 包装了响应,这会引发错误。
我的问题是:当状态码不是“200 OK”时,gzip 是有效的编码吗?如果没有,我可以简单地检查状态代码,如果返回 200 以外的任何内容,则不要尝试 gzip。
是否有关于此的规则/指南?这在任何地方都有记录吗?
TIA
http - 在 HTTP 标头或响应正文中休息错误消息?
我有一个向 iPhone 和 Android 客户端公开的 REST 服务。目前我遵循 HTTP 代码 200、400、401、403、404、409、500 等。
我的问题是放置错误原因/描述/原因的推荐位置在哪里?REST API 总是像这样在标题中包含自定义原因是否更有意义?
还是通过 JSON 将它放在响应正文中更好?
python - Web Crawler HTTP Error 403:Forbidden
I am a newbie trying to write a script of a web spider. I want to go to a page, enter a data in a textbox, go to the next page by clicking the submit button and retrieve all data on the new page, iteratively.
The following is the code I am trying:
The following is the error:
How can I solve this?
php - php脚本上的502网关错误
我收到错误消息
502 Bad Gateway 网关收到无效的 HTTP 响应或意外断开与原始服务器的连接。
在执行一段时间后(例如 30-40 秒)在我的服务器上运行一些 PHP 脚本时。我检查了 cpanel 中的错误日志,但那里没有任何反映。我确定这不是因为我的脚本崩溃,因为它在我的 localhost 上运行良好。顺便说一句,我正在使用共享主机。
PS-正如你们中的一些人所问的那样,这是脚本,我正在使用 curl 从 Microsoft Academic 网站上抓取有关研究论文的数据,这纯粹是出于学术目的。
java - 访问 Socialcast API 时出现 HTTP 错误 401
我在尝试连接到 Socialcast API(演示)时收到 401 Unauthorized。这是我的代码:
错误信息:
它有什么问题?
response - 来自 mollom 验证码的 502 错误网关
我的应用程序在一些基于表单的页面上使用了 Mollom 验证码。突然,在一台服务器上,mollom 请求需要很长时间才能返回图像和音频 url。同时,服务器在浏览器中抛出 502 Bad Gateway or Network Error (TCP Error)。问题在于以下几行:
在日志中,我可以在 12-14 分钟后看到响应,但到那时那已经没有用了。而且它只发生在一台服务器上(即使在那里它工作正常,直到上周)
我改写。有没有办法让我的 jboss 应用服务器等待响应直到它真正到来?
servlets - HttpServletResponse#sendError 如何更改 ContentType
我正在创建一个简单的 Servlet 来回答表单提交。此 servlet 接收 POST 请求并应响应 Application/JSON 数据。这运作良好。我现在想为我的 servlet 添加错误管理:如果 servlet 接收到错误的请求参数,我希望它用一个简单的{"error":"ERROR MESSAGE"}
JSON 响应来回答客户端一个 400 - “Bad Request” 响应。
我正在使用HttpServletResponse#sendError(int,String)
来正确发送错误,但ContentType
响应的 始终设置为text/html
,即使我以前使用HttpServletResponse#setContentType("application/json")
过。
这是使用 Servets 发送错误的好方法吗?我怎样才能强制ContentType
响应application/json
?
我的测试 Servlet 的 doPost() 方法的示例代码: