http

Best way to disable client caching

I'm using a simple servlet filter that forces the browser to skip caching for some server resources: Cache-Control: private Pragma: This works fine in Internet Explorer but it doesn't works well with Firefox 3.0.10. I ended to write this code: Cache-Control: no-cache, no-store, must-revalidate, max-age=-1 Pragma: ...

How to receive post data(XML) in .NET like java servlet doPost

I want to receive the HTTP POST data(XML), the XML data post by other webServer(Tomcat, shttpd). On Java I can use servlet doPost receive post data, I'm a newbie on C#, I don't know how to write it on c#. ...

What content length should I send when I am encoding data with gzip?

I am writing a small web server and would like to send gzipped data. In the http header for the Content-Length field do I set the length of the compressed data or the length of the uncompressed data? ...

Is there a good reference guide for deciphering http user-agent strings?

We're getting some odd errors reported on our website, and are trying to find out some details on who is doing the looking. I'm looking at a sample user-agent strings and seeing things like: Mozilla/5.0 (Windows; U; Windows NT6.0; en-US; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6 Now some of this is obvious, but some of it is less so ...

Routing image requests to separate subdomains

First, a bit of background info: The HTTP 1.1 specification, circa 1999, recommends that browsers and servers limit parallel requests to the same hostname to two. (more) If you carry on reading that article the author suggests "fooling" browsers by having multiuple subdomains all pointing to the same thing. If I was to serve my im...

HTTP response was too large: 10485810. The limit is: 10485760.

i have written an online brainfuck interpreter ..!! the problem is when i take the text input , it gives an error !!... HTTP response was too large: 10485810. The limit is: 10485760. it seems the max limit of gae is 1mb.. how can i get around it !1 ...

Confusion with mail.google.com, cURL and http://validator.w3.org/checklink

Hello. I am building a basic link checker at work using cURL. My application has a function called getHeaders() that returns an array of HTTP headers: function getHeaders($url) { if(function_exists('curl_init')) { // create a new cURL resource $ch = curl_init(); // set URL and other appropriate options ...

How to GET data from an URL and save it into a file in binary in C#.NET without the encoding mess?

In C#.NET, I want to fetch data from an URL and save it to a file in binary. Using HttpWebRequest/Streamreader to read into a string and saving using StreamWriter works fine with ASCII, but non-ASCII characters get mangled because the Systems thinks it has to worry about Encodings, encode to Unicode or from or whatever. What is the ea...

Parsing POST from Gnip.com via PHP

Hello! I've set up a filter at Gnip.com. In the field "POST URL" I've typed in my script URL. The URL is correct since Gnip.com really calls it. But when the script is called, I don't get any data. I've tried to parse $_GET and $_POST but both are empty arrays. getallheaders() gives me some data but no XML. How do I get the XML sent by ...

User Authentication And Text Parsing in Python

Well I am working on a multistage program... I am having trouble getting the first stage done.. What I want to do is log on to Twitter.com, and then read all the direct messages on the user's page. Eventually I am going to be reading all the direct messages looking for certain thing, but that shouldn't be hard. This is my code so far ...

Separate ASP.NET session ids for http and https

I'm working on a website that uses a non-secured asp.net session cookie. The session is shared between http and https. We want to use different sessions for http and https (because of security reasons). Is this configurable in ASP.NET, the httpCookies config element in system.web isn't specific enough. I'd rather not programatically bui...

Restrict HTTP requests to 'POST' only in Struts 1.x

Hello, Is there a configurable way in Struts 1.x so my action classses are only executed on HTTP 'POST' only. I understand I can use request.getMethod() within my action class and then do certain 'stuff' based on that. Regards, Jonathan ...

Which HTTP Errors Should Be Custom Handled?

In my web site, I am currently custom handling two HTTP errors: 404 Not Found and 403 Forbidden. This "handling" consists of redirecting the user to a custom error page specific to the particular error. Are there any other HTTP (or, in fact, other kinds) errors that occur often enough to warrant a custom redirect and page? ...

Testing methods that make http requests

I have some methods in my app that make http requests. Is there a good way to simulate network failures and bad responses for the unit tests? ...

if-modified-since vs if-none-match

Hi, What could be the difference between if-modified-since and if-none-match? I have a feeling that if-none-match is used for files whereas if-modified-since is used for pages? ...

what is better redirecting user from restricted area and not informing him what happend or telling him that its restricted??

For example : user "is trying" to enter restricted area ( i.e. admin area on webpage ) , what is better kick him out from there without a single word or inform him that this is admin area and he is forbiden to enter. ...

Detecting whether a user is behind a proxy

Hello all, I'm trying to figure out how I could detect whether people logging into my site are behind a proxy or not. I've read that you can detect a person's real IP address through embeddable objects (Flash and Java). However, I haven't been able to actually find any examples or source for this. I'm using PHP and I've read that loo...

Is this the best way to make an API request using PHP CURL?

Hello all, I have a site that has a simple API which can be used via http. I wish to make use of the API and submit data about 1000-1500 times at one time. Here is their API: http://api.jum.name/ I have constructed the URL to make a submission but now I am wondering what is the best way to make these 1000-1500 API GET requests? Here is...

how to get a the value of an http post as a whole? parsing restful post

Is it my ideea or in rest-web services a post comes "with no name", so say something... I mean, is the post the whole body, minus headers??? so, how can I parse such a post message with java? do I have to use HttpServletRequest.getInputStream? http://www.softlab.ntua.gr/facilities/documentation/unix/java/servlet2.2/javax/servlet/htt...

iPhone NSData/NSUrl with cookie

Hi, I'm trying to play/stream a mp3 hosted on a website. The site requires a cookie header to be set, but I'm having trouble setting that or getting the container to do that for me. NSURL *sampleUrl = [NSURL URLWithString:@"http://domain/files/sample.mp3"]; NSData *sampleAudio = [NSData dataWithContentsOfURL:sampleUrl]; Up until ...