http-status-codes

A distinct HTTP status for not logged in vs. not authorized in a RESTful API

So send a few different status headers in my API including 404, 409, 201, 302 and the like. Now I'm running into issues with 401 Unauthorized. I'm currently sending it if a user is not logged in (the entire API is rights managed) or if a user doesn't satisfy the specific access requirements for the particular resource being retrieved/mod...

How to check if a webpage exists. jQuery and/or PHP

I want to be able to validate a form to check if a website/webpage exists. If it returns a 404 error then that definitely shouldn't validate. If there is a redirect...I'm open to suggestions, sometimes redirects go to an error page or homepage, sometimes they go to the page you were looking for, so I don't know. Perhaps for a redirect th...

ASP.NET 4 Get description for HTTP status code

In ASP.NET you can set the Response.StatusCode to for example 404. Should the status line / description always be set? (to in this case "404 Page Not Found") How do you get the description if you only have the code (404)? Is this somewhere in the framework or do you manually have to hardcode the descriptions? ...

Correct HTTP status code when resource is available but not accessible because of permissions

I am building a RESTful protocol for Dynamic Carpooling applications, for my Computer Science thesis. In the Protocol I also have to formally specify the HTTP status code for each operation. I've got this "privacy related" problem. Suppose the following: GET /api/persons/angela/location Retrieves the current position of user "angela"...

Handling various types of URL redirects

Generally, when writing HTTP client software, the HTTP protocol provides sufficient information for how to handle redirected URLs. Specifically, if an HTTP request returns a redirect code of 302 or 307, the redirect should be considered temporary and the client should continue to use the original URL. However, a redirect code of 301 in...

PHP Get Content of HTTP 400 Response

I am using PHP with the Amazon Payments web service. I'm having problems with some of my requests. Amazon is returning an error as it should, however the way it goes about it is giving me problems. Amazon returns XML data with a message about the error, but it also throws an HTTP 400 (or even 404 sometimes). This makes file_get_contents...

My client queries my server. If the response is negative (e.g. error) how should I communicate it?

Should I rely on http status codes? Or should I use some kind of special response? My server is running PHP and producing simple JSON responses. ...

How to get the status header for a website programmatically

Hi All, I am writing a win32 service in Delphi (should be able to translate any other code if you don't know delphi) that needs to fetch the status of a website. I know how to do this in .NET but am not sure with normal windows based programming. So, I need to query a website and return the Status Code 200, 301 ect. My plan is then to p...

$.post form with facebox and redirect

Using Facebox with .NET (Web Forms) is painful--this primarily HTML site was designed by someone else. I may have IIS (7.5) issues as well. This Facebox pop-up is in a separate file, login.html, that is called from index.html: $k('a[rel*=example_2]').facebox_1({ loading_image : '/images/loading.gif', close_image : '/images/closela...

Parsing HTTP status codes for interacting with API

I'm building a script in PHP to interact with an API and need to be able to parse the HTTP status code the API is giving me. For the most part, it gives one of the following responses: HTTP/1.1 401 Unauthorized HTTP/1.1 403 Forbidden HTTP/1.1 404 Not Found HTTP/1.1 410 Gone I need to be able to recognize which response is being gi...

Authentication Problem..!! ON ANDROID WITH HTTPURLCONNECTION

"Basic YWRtaW46YW RtaW4=" is right code for my address.I check on j2me project. And on android my getbase64 method returns "Basic YWRtaW46YW RtaW4=" its true. and ı use it on: httpConnection.setRequestProperty("Authorization",getBase64Encode()); Finally responce code is 401 any idea??? protected void connect() { InputStream i...

What's the best HTTP status code for a redirect from / to /home?

I have a web application where the requested URL is used in a REST-like fashion. However, if no URL is entered (just the domain) I re-direct to http://www.example.com/home and then my home controller is loaded. What HTTP status code should I use for this re-direct? This process takes place in my index.php script using a simple header('L...

Is it OK to return a HTTP 401 for a non existant resource instead of 404 to prevent information disclosure?

Inspired by a thought while looking at the question "Correct HTTP status code when resource is available but not accessible because of permissions", I will use the same scenario to illustrate my hypothetical question. Imagine I am building a a carpooling web service. Suppose the following GET /api/persons/angela/location retrieves t...