http-status-codes

How to turn off default HTTP status code errors in Zend Server?

谁说我不能喝 提交于 2019-12-06 04:45:00
Every time I return some status code in my PHP code, Zend Server gives me following error appended on the bottom of my website (with the message of HTTP code I returned). So for example, if I return 401, it gives me another 401 error appended to my 401 page: Is there any way to turn it off? I use Zend Server Community Edition 5.0 with PHP 5.2 . EDIT: It seems to be default Apache error handling. Is there a way to disable it? Preferably without having my own error pages. ADDITIONAL EDIT: I tried to edit my .htaccess with ErrorDocument directives. It still gives me my error page (blank page) +

Setting Context.Response.StatusCode does not seem to work

て烟熏妆下的殇ゞ 提交于 2019-12-06 04:02:51
问题 I have an HttpHandler with the following code: using System; using System.Web; using Company.Cms; using Company.Web.Handlers.Console; namespace Company.Web.Handlers { /// <summary> /// Summary description for AdminHandler /// </summary> public class AdminHandler : IHttpHandler { public bool IsReusable { get { return false; } } public void ProcessRequest(HttpContext context) { HttpRequest request = context.Request; HttpResponse response = context.Response; string action = request.QueryString[

$.getScript returns status canceled and the application does not execute the callback function?

最后都变了- 提交于 2019-12-06 02:51:42
Environment To automate the compression and the junction of my js files, I use this tool. Once installed and configured, the code below returns a js compressed and concatenated with all the JS folder project <script src="@BundleTable.Bundles.ResolveBundleUrl("~/Scripts/pages/project-projectPhotos/js")"></script> Problem In my page, have the following code: loaderPhotosPage = function(url) { $.getScript('/Scripts/pages/project-projectPhotos/js', function() { alert(url); //This code is not executed!! Here's the problem; }); }; alert is never executed! Tests To simulate a test tool using Google

How to send http-status using JBuilder Gem

有些话、适合烂在心里 提交于 2019-12-05 23:01:25
问题 Am using Rails 3.0.19 and JBuilder Gem 2.0.6 to render JSON responses. JBuilder: https://github.com/rails/jbuilder Following is the code am using to send error-messages for a specific API. render :json, :template=>"/api/shared/errors.json.jbuilder", :status=> :bad_request For some reason, the client receives 200-ok status. While, I have expected 400 (bad_request). Any help, please? Here is my code in detail: def render_json_error_messages #render :template=> "/api/shared/errors.json.jbuilder"

Conditionally setting the HTTP status without directly manipulating the HttpServletResponse

假装没事ソ 提交于 2019-12-05 20:24:22
问题 How can I conveniently conditionally set the HTTP status code in an Spring MVC request handler? I have a request handler that responds to POST requests, for creation of a new resource. If the request is valid I want it to redirect to the URI of the new resource, returning a 201 (Created) HTTP status code. If the request is invalid I want it to give the user a chance to correct the error in the submitted form, and should not give a status code of 201. @RequestMapping(value = { "/myURI/" },

HTTP 401 Unauthorized when not using HTTP basic auth?

最后都变了- 提交于 2019-12-05 09:19:17
When building a REST API that doesn't use HTTP basic authentication (but something else like an api-key) and the client provides invalid credentials, what HTTP Status Code are you supposed to return? 401 Unauthorized or 403 Forbidden? The IANA HTTP Status Code Registry lists RFC7235, Section 3.1 as responsible for "401 Unauthorized", where it states: The server generating a 401 response MUST send a WWW-Authenticate header field Does that mean that a REST API should only ever return a 401 when using HTTP basic authentication but not when for example using authentication via an api-key? Django

Response.Redirect() vs Response.RedirectPermanent()

╄→гoц情女王★ 提交于 2019-12-05 08:44:49
I am new to ASP.Net 4.0, and have seen a new feature called Response.RedirectPermanent() . I have checked a few articles, but I'm unable to understand clearly the actual meaning and difference of Response.RedirectPermanent() over Response.Redirect() . According to Gunnar Peipman , Response.Redirect() returns 302 to browser meaning that asked resource is temporarily moved to other location. Permanent redirect means that browser gets 301 as response from server. In this case browser doesn’t ask the same resource from old URL anymore – it uses URL given by Location header. Why do I need to check

Http2 protocol and status messages

这一生的挚爱 提交于 2019-12-05 05:31:21
So i just found out the hard way that the http2 protocol does not support http status messages like 404 Not Found in the old http1.1 protocol. One of our web Api's is using the http status message to return a readable message to the end user. Now my question is, is there a new way of returning status messages in http2 or do we have to return the message in the http response body? There is no new standard way, thus either a custom response header or the message body are your only choices. (For the record: I argued against this change) 来源: https://stackoverflow.com/questions/36567489/http2

Why does the 304 status code count as a “redirect?”

 ̄綄美尐妖づ 提交于 2019-12-05 05:30:44
I am currently trying to understand how exactly 304/Not modified qualifies for the 3xx-range class of HTTP status codes. RFC 1945, sec. 9.3 and RFC 2616, sec. 10.3 both read: This class of status code indicates that further action needs to be taken by the user agent in order to fulfill the request. While "loading from the client's local cache" clearly is a "further action," I am struggling to see how this is a redirect in the sense of HTTP. Am I reading this too literally? See http://greenbytes.de/tech/webdav/draft-ietf-httpbis-p2-semantics-26.html#rfc.section.6.4.p.2 : There are several types

IIS7 and HTTP status code handling

痴心易碎 提交于 2019-12-05 05:23:14
I'm having a hardcore head-ache from trying to get complete programmatic control over rendering of an error in IIS7 (integrated mode). What I want to do is given an error (page not found, internal server error, not authenticated, etc), transfer the whole request to a custom ASPX or HTML (I prefer the latter) with the correct HTTP status code. What I want is IIS7 to don't give a crap about what I set the HTTP status code to. I don't want its error handling. When I set Response.StatusCode = (int)HttpStatusCode.NotFound , what I want is not IIS to render its own error page, but perhaps transfer