http-headers

Parse an HTTP request Authorization header with Python

I need to take a header like this: Authorization: Digest qop="chap", realm="[email protected]", username="Foobear", response="6629fae49393a05397450978507c4ef1", cnonce="5ccc069c403ebaf9f0171e9517f40e41" And parse it into this using Python: {'protocol':'Digest', 'qop':'chap', 'realm':'[email protected]', '...

How can I send a file AND the page in an HTTP response?

I have an ASP.NET page where I'm generating an Excel spreadsheet and sending that in the response (content-disposition header). That part works great, but I have a button that never becomes re-enabled because the original page isn't part of the response. Here's the function I'm using: Public Shared Sub WriteToResponse(ByVal theWorkBook...

HTTP: What are the best headers for rarely changed images

I have many many small images that are displayed on a user's profile and the loading of this page is horrible. The best solution is to sprite them all, but sadly I have too many images for that and only a few hundred are used per profile. So, I'm trying to get the second best solution. What headers should I send? ETag? Expires? Cache-Co...

Fetch HTTP response header/redirect status with PHP

Hej there, I am currently working on a PHP-based Tool to monitor a rather large number of URLs and their redirect status. I have spent quite some time on finding the best way to fetch the content of the HTTP response headers to extract the current redirect code and location. This is how it's done at the moment: $resource = fopen( $url,...

How to encode UTF8 filename for HTTP headers? (Python, Django)

Hi, I have problem with HTTP headers, they're encoded in ASCII and I want to provided a view for downloading files that names can be non ASCII. response['Content-Disposition'] = 'attachment; filename="%s"' % (vo.filename.encode("ASCII","replace"), ) I don't want to use static files serving for same issue with non ASCII file names but...

Is HTTP header Referer sent when going to a http page from a https page ?

Hi, After a few tests, I'm starting to reach the conclusion that a browser does not send a Referer HTTP header when one clicks to a http page from a https one. What security reason is that for? Is is defined somewhere in the standard? ...

WCF Content-Length HTTP header on outbound message

I'm in a tough situation in which a Java web service endpoint hosted on an IBM HTTP Server (IHS) requires a Content-Length header, although it supposedly conforms to HTTP/1.1. If I send the header, everything works. If I leave it off, I get a 500 error response informing me that my POST entity body was empty (even though it was not). We...

Change the charset attribute in the html header

My whole app is serving stuff in utf-8, only one page (xml) should return a ISO-8859-1 page <?xml version="1.0" encoding="ISO-8859-1"?> Now, how can I change the header attribute in order to have the ISO-8859-1 served. The result of wget --save-headers http://79.125.52.185/kdb/jobs/jobs_ch is HTTP/1.0 200 OK ... Content-Length...

HttpServletRequest and getHeader(): How to handle case insensive headers properly?

Hi! Since is made aware of the fact that HTTP headers are case-insensive according to the RFC, i wonder how to handle this problem with Servlets. There is a #getHeader(String) method to obtain a header but it turned out that this method treats the header fields case sensive which is quite... annoying? Is there a proper way to obtain ...

Unable to View Source of an XML file using IE7

I am enhancing our web framework to use web services and one of features I would like is the ability to view XML that has been submitted. I am using our Java servlet to launch a popup and serve the XML and this works - in IE7 I get the expected behaviour when of a nicely formatted and folding view of the XML. The problem is if I select '...

Content-Disposition:What are the differences between "inline" and "attachment"?

What are the differences between Response.AddHeader("content-disposition", "attachment;filename=somefile.ext") and Response.AddHeader("content-disposition", "inline;filename=somefile.ext") I don't know the differences , because when I use one or another I always get a window prompt asking me to download the file for both of them. I...

Interpreting Accept Headers as intended in IE and Webkit

I developed a web app that responds with data in the format as specified by the client in the HTTP Accept Headers. Everything worked fine while using Firefox, but when I wanted to check my CSS / HTML on Chrome and IE, both of them wanted to download the index page, as if it's an unknown content type. After some research I found this art...

HTTP Post fields are not received by PHP script

I feel stupid asking this question, but I've been wrestling with it for hours and I don't know where else to turn. I have a flash form that is making a POST request to a php script, and then displays the output of the said script. For the sake of simplicity, let's say this is the php script: echo 'Mail sent to: ' . $_POST['recipientEm...

HttpURLConnection in android doesn't send correct User-Agent header

Hello, I have found an issue. I have a server that uses User Agent header to identify the device that is connecting to it. But when i connect to the server using HttpURLConnection i get no User Agent header, but when i connect with the browser it sends the correct User Agent. For testing i am using an echo server that replies with the ...

Using the HTTP Range Header with a range specifier other than bytes?

The core question is about the use of the HTTP Headers, including Range, If-Range, Accept-Ranges and a user defined range specifier. Here is a manufactured example to help illustrate my question. Assume I have a Web 2.0 style application that displays some sort of human readable documents. These documents are editorially broken up int...

Redirect user to authenticated page that uses forms authentication, using HTTP Location Header, HttpWebRequest/Response and Response.Cookies.Add()

I need to autheticate on a site using forms authentication and then redirect the user to that site along with the session cookie. I have not figured out how to successfully do this. Here's my code so far.. I still get redirected to that apps login page. Any help is much appreciated! protected void Button1_Click(object sender, EventA...

How can I add expire headers for scripts that are not on my server?

Hey I was wandering if you could help me with this. I have a website and I put the expire headers on all pages/img’s and scripts but I don’t kno how I could add expire headers to scripts not on my page. For example Google Analytics it has expire headers set to 1 day. But not Google is my problem. Some other adds from a website are the re...

How to send a file via HTTP, the good way, using Python?

If a would-be-HTTP-server written in Python2.6 has local access to a file, what would be the most correct way for that server to return the file to a client, on request? Let's say this is the current situation: header('Content-Type', file.mimetype) header('Content-Length', file.size) # file size in bytes header('Content-MD5', file.hash...

Can Java omit sending some headers in HTTP requests?

I'm using the HttpConnection class in Java to send HTTP requests. How do I omit unwanted HTTP headers? like: User-Agent Accept Accept-Language Accept-Encoding Accept-Charset Keep-Alive Connection Referer If-Modified-Since ...

HTTP Bad Request - Browser Hook

Hello, I am hooking firefox's send and WSARecv. Send should remove the gzip header (=> Accept-Encoding: none) and WSARecv hook shall edit the data. At the moment the WSARecv function doesn't change any data, but only prints it out for the debug log. Many sites work, but sometimes images do not get loaded or the page doesn't. I could f...