http-headers

How to determine the Content-Length of a gzipped file?

Right now I'm trying to serve CSS and JS files from a server that won't let me enable mod_gzip or mod_deflate. So I wrote a small PHP script to compress with GZIP and return to the user. Example Code: $filename = "style.css"; if (!file_exists($filename) || !($info = stat($filename))) { header("HTTP/1.1 404 Not Found"); die(); } ...

Which encoding is used by the HTTP protocol?

When a browser sends an HTTP request to a web server, what encoding is used to encode the HTTP protocol on the wire? Is it ASCII? UTF8? or UTF16? Or does it specify which encoding it uses in a predefined format (before any decoding takes place?) P.S I'm not asking about the actual payload (e.g. HTML) of the request/response. I'm asking ...

How to send an HTTP header in java

Hi, Is it possible to send a Http header via a URL connection in java? I had this working using sockets, but ran into issues with a firewall which don't seem to be a problem with URLConnection. From looking at the API I get the impression that the output methods in URLConnection are just for filling in forms etc, or can they be used to s...

What does the utmscr or utmcct values mean in reference to the Http cookie Server variable?

What does the utmscr and/or utmcct values mean in reference to the Http cookie Server variable? Are they acronyms or short for something? We are getting Elmah errors with the title "System.Web.HttpException: Unable to validate data." In each Elmah error message, the Http Cookie server variable value contains a property called utmscr s...

How can I access request headers that don't appear in $_SERVER?

I am attempting to create a REST API in PHP and I'd like to implement an authentication scheme similar to Amazon's S3 approach. This involves setting a custom 'Authorization' header in the request. I had thought I would be able to access the header with $_SERVER['HTTP_AUTHORIZATION'], but it's nowhere to be found in var_dump($_SERVER). ...

Reading HTTP Header in ActionScript2

In AS2, I need to get a URL. In the header of the HTTP response, a cookie is set. Is it possible to read the header of the HTTP response and get the cookie's data? ...

Intercept Http call to SSL certificate

Is there a way to intercept a call made by WebBrowser to SSL (within in an asp.net application)? I need to pass parameters to http-headers at runtime before the request is made. Example: if I type "http://test.com", the browser communicates with the server and returns "https://test1.com" as the secured url. I should be be able to inter...

Sending data in HTTP request's body fails

Hi I am using the HttpConnection class of J2ME in my BlackBerry app to send data to a web server. I need to send the contents of an image in the body of the HTTP request. This is what I do Get the bytes of the file in an array Open HTTP connection Set content type header as image/jpeg Get output stream of the connection Write the byt...

Disable Page Cache to force page load with browser back button

I have an asp.net website that is using update panels on the page that i cant get to reload from the server. I have this for the disable page cache on the master page. 'Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1)) 'Response.Cache.SetValidUntilExpires(False) 'Response.Cache.SetRevalidation(HttpCacheRevalidation.All...

How can I set a custom response header for pylons static (public) files?

How do I add a custom header to files pylons is serving from public? ...

Force string download with http-header

Hi, I'm having a problem with my function. The purpose of my function is to force a string to be downloaded. What it really happens is that the string is outputted to the screen and not downloaded. This is my function: function arrayToCSV($vectorDados, $cabecalho) { $arr = array(); $arr=$vectorDados; $csv = $cabecalho . "\...

Why does the Server HTTP header exist?

What is the Server HTTP response header useful for? I have yet to actually see a use for it. Why would someone that's requesting a webpage need to know what server a webpage is hosted on? ...

Force HTTP v1.0 request with NSURLConnection

NSURLConnection by default performs a GET request with HTTP v1.1. How do I get it to perform a GET request with HTTP v1.0? Or is there a HTTP header I can set that will do this for me? ...

Send Host header when accessing IP address in Firefox

This isn't really a programming question but more about programming and testing tools. Is there a way to get Firefox to send the header Host: mydomain.com when accessing a page at http://ip.address.goes.here/ so that Apache can route it to the correct VirtualHost? ...

How to set Content-Encoding with gzip

I am compressing html files with gzip. The browser (FF 3.0.10) does not decompress or display index.html.gz (pre-compressed on the server) when I request index.html Where can I confirm the zipped header "content-encoding" and the browsers "Accept-Encoding"? (I am using the zlib API in C for zipping) Thanks. ...

Supporting the "Expect: 100-continue" header with ASP.NET MVC

I'm implementing a REST API using ASP.NET MVC, and a little stumbling block has come up in the form of the Expect: 100-continue request header for requests with a post body. RFC 2616 states that: Upon receiving a request which includes an Expect request-header field with the "100-continue" expectation, an origin server M...

Servlet Filters and the OSGi HttpService

I'm working on an OSGi-based application that uses org.osgi.service.http.HttpService which does not support the use of Servlet Filters. Before I realised that I wouldn't be able to use Servlet Filters I was planning to apply a couple of existing Filters. These Filters set the appropriate HTTP headers to: prevent caching of responses c...

Return a PHP page as an image...

I am trying to read a image file (.jpeg to be exact), and 'echo' it back to the page output, but have is display an image... my index.php has an image link like this: <img src='test.php?image=1234.jpeg' /> and my php script does basically this: 1) read 1234.jpeg 2) echo file contents... 3) I have a feeling I need to return the outpu...

[HTTP Basic Auth] Is there a way to force the browser to always pass the Authorization header if credential is already available?

Using Basic Authentication, if the user has already logged in, the browser will include the username/password in the http request in the succeeding http requests ONLY IF it receives a 401 response containing an authentication challenge. Username/password is passed via Authorization header. Is there a way to force the browser to always i...

Why does livehttpheaders show my login and password and how can I prevent it?

I was looking at the livehttpheaders plugin for Firefox and decided to test my login page. I noticed that the parameters shown inside of it contain my login and password. For example: username=sarmenhb&password=thepassword&submit=Login in plain English. I don not see this on other sites. What can I be doing wrong? I see this as a se...