http-headers

What HTTP headers do I need to stream an ASF file?

I have a simple PHP script that will either serve up a streaming ASF file or not, depending on whether you're logged in and have access to the file. It basically does this: <?php header('Content-Type: video/x-ms-asf'); header('Content-Disposition: inline; filename="file.asf"'); readfile('file.asf'); ?> This already works fine in Fir...

php: geting ip addres

i want to get an ip addres of visitors. could you tell me what element of $_SERVER[] i should use? $_SERVER['HTTP_CLIENT_IP']; $_SERVER['HTTP_X_FORWARDED_FOR']; or $_SERVER['REMOTE_ADDR']; thanks UPDATE: If your client is connected to the Internet through Proxy Server then $_SERVER['REMOTE_ADDR'] in PHP just returns the the IP addre...

Accept-Encoding headers being sent by browser but not received by server

I have been trying to debug this for weeks. All of the browsers on all of the clients on my home network are sending 'Accept-Encoding: gzip,deflate'. However, that header is somehow, somewhere being dropped before the request makes it to a web server. For example, http://www.whatsmyip.org/http_compression/ says 'No, your browser is not r...

HTML Meta CACHE-CONTROL Vs input element autocomplete

Hi, This question refers Where does setting the CACHE-CONTROL HTML meta tag come into the autocomplete argument? Is it necessary to explicitly set autocomplete=off for sensitive inputs if you have told the browser not to cache anything by setting CACHE-CONTROL=NO-CACHE? I assume that if the browser has been told not to cache anything, ...

Java - How to find the redirected url of a url?

I am accessing web pages through java as follows: URLConnection con = url.openConnection(); But in some cases, a url redirects to another url. So I want to know the url to which the previous url redirected. Below are the header fields that I got as a response: null-->[HTTP/1.1 200 OK] Cache-control-->[public,max-age=3600] last-modif...

Is it ethical to let users see the request headers from visitors to a url shortening service?

I'm currently in the progress of making a url shortening service that will let the creator see the http request headers that the browser has made when visitors visit the url. The visitors won't be made aware that they are being tracked, but obviously nothing is personally identifiable. Is there anything I should be made aware of ethica...

Removing X-Powered-By

How can I remove X-Powered-By header in PHP? I am on an Apache Server and I use php 5.21. I can't use the header_remove function in php as it's not supported by 5.21. I used Header unset X-Powered-By, it worked on my local machine, but not on my production server. If php doesn't support header_remove() for ver < 5.3, is there an alterna...

Reading a client's header from Python CGI script?

I'm writing a very simple web service, written in Python and run as CGI on an Apache server. According to Python docs (somewhere... I forgot where), I can use sys.stdin to read the data POSTed by a random client, and this has been working fine. However, I would like to be able to read the HTTP header information as well - incoming IP, u...

How to send a HTTP "Bad Request" Response

Hi, I am writing a C program which needs to send back a HTTP Bad Response. This is what I write to socket. HTTP/1.1 400 Bad Request\r\n Connection: close\r\n \r\n My question is why the broswer still spinning (like appear it is still loading something? Am I missing header in the Http response? OR I miss something else? Thank you. ...

Html validation error for property attribute

I am using few facebook social plugins and I am using the meta header. When validating the page, the W3C validator is throwing the error -> "Error: there is no attribute "property". I am using the XHTML Transitional doctype - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transiti...

What is the difference between HTTP_USER_AGENT and HTTP_X_USER_AGENT?

I sometimes see one or the other in my server logs. Thank You ...

Remove HTTP headers from a raw response

Let's say we make a request to a URL and get back the raw response, like this: HTTP/1.1 200 OK Date: Wed, 28 Apr 2010 14:39:13 GMT Expires: -1 Cache-Control: private, max-age=0 Content-Type: text/html; charset=ISO-8859-1 Set-Cookie: PREF=ID=e2bca72563dfffcc:TM=1272465553:LM=1272465553:S=ZN2zv8oxlFPT1BJG; expires=Fri, 27-Apr...

When sending headers to download a PDF, Safari appends .html

Here is the request and response headers http://www.example.com/get/pdf GET /~get/pdf HTTP/1.1 Host: www.example.com User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-E...

Redirects in RoR: Which one to use out of redirect_to and head :moved_permanently?

Hello, we are making a website that takes a generated incoming link and forwards the user who is clicking on it to another website while saving a record of the action in our DB. I guess it's basically what ad-services like AdSense do. However, what is the best way to redirect the user? I think html-meta-tag-redirects are out of questi...

HTTP Content-type header for cached files

Hello, Using Apache with mod_rewrite, when I load a .css or .js file and view the HTTP headers, the Content-type is only set correctly the first time I load it - subsequent refreshes are missing Content-type altogether and it's creating some problems for me. I can get around this by appending a random query string value to the end of e...

Anyone knows what the code snippet means below?

header('P3P: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"'); I've never seen such headers,what's it for? ...

how to create http headers from scratch

So, I made a simple socket server using python. And now I'm trying to structure a proper http response. However, I can't seem to find any sort of tutorial or spec that discusses how to format http responses. Could someone point me to the right place? ...

What's the "Content-Length" field in HTTP header?

What does it mean? Byte count of encoded content string with encoding specified in header. Character count of content string. Especially in case of "Content-Type: application/x-www-form-urlencoded". ...

I'm confused, how do I control cache so my clients can see website edits.

I host about 10 websites for clients. Every so often a client will ask for an update to their website. It may be a simple image change, new PDF or a simple text change. I make the change and then send them a link to the web page with the update. About an hour later I will get an email back from the client telling me they still see the ol...

Issue with remote IP address retrieval when using a proxy

This is a followup for this question. When I used the proxy flag with mod_rewrite, I did not know all of its effects. Now I have two more problems, which need to be fixed! The main problem is with user IP addresses, everyone appears to use the server IP. I can't trust http-x-forwarded-for because it is easy to forge headers, and the RE...