http-headers

Cookies turned off with Java URLConnection

I am trying to make a request to a webpage that requires cookies. I'm using HTTPUrlConnection, but the response always comes back saying <div class="body"><p>Your browser's cookie functionality is turned off. Please turn it on. How can I make the request such that the queried server thinks I have cookies turned on. My code goes some...

windows-1252 character 146 is stopping POST data reaching servlet in glassfish v2

An HTTP POST request is made to my servlet. There is a posted form parameter in the http request that my code in the servlet retrieves for further processing named "payload". When the value of the payload includes the windows-1252 character "’" (ascii value 146), HttpServletRequest instance method getParameter("payload") returns null. ...

NSTask returning HTTP Headers

I'm running /usr/bin/perl or /usr/bin/php via an NSTask and want to retrieve the HTTP headers of the program. I've properly formatted the environment (Perl requires env vars to be prefixed with HTTP_), but neither of the task are returning anything other than raw output. I've been through the documentation on NSTask and the man pages f...

Is there a reliable way to create an error on web requests?

Sorry if the question is ambiguous, I wasn't sure how to word it succinctly. Anyway, here's the deal. I am creating a browser extension with an upload manager for doing some processing of POST uploads. So before I pass along the POST request I send an intermediate POST request to the same URL with some special headers which will retur...

HTTP Content-Type header to serve a font file

Hi, I'm making an online EOT converter... What 'Content-Type' header should I set to serve a font file? Thank you. ...

What is the definition of HTTP_X_PURPOSE?

Recently we've been looking at a few exceptions captured in our Stack Overflow logs and have discovered an issue for Safari users. I noticed this HTTP header in one of the exceptions we have captured: HTTP_X_PURPOSE preview Does anyone know what action triggers this header or the meaning of HTTP_X_PURPOSE? ...

What is the best way to "fake" DELETE and PUT methods using JAX-RS?

I've just started to use Jersey to create a RESTful API for my site. Its a wonderful change from having to roll my own support for RESTful services in Java. One thing I just can't seem to figure out is how to "fake" a DELETE and PUT method. Jersey supports the annotations @PUT and @DELETE, however many Load-Balancers will not allow th...

php headers - post and follow

Hi all. Could someone help me on how to post variables and follow the post to that page? Regards Phil ...

IO::Socket timing out when getting response

I'm trying to connect to a web service using IO::Socket::INET (yes, I know that there are lots of better modules for doing this, but I don't have them and can't add them, so please don't suggest it), but I'm timing out (I think that's what it's doing) waiting for a response. Here's the basic crux of my code (I previously populate the co...

Can I serve MP3 files with PHP?

In the same way that it's possible to serve up images with php, for use in CAPTACHAS and such, is it possible to do the same with audio files? I've tried this <?php $track = "sometrack.mp3"; if(file_exists($track)) { header('Content-type: audio/mpeg'); header('Content-length: ' . filesize($track)); header('Content-Disposition: filena...

HTTP/1.1 Cache-Control no-cache problem

I do not want my Java SWT application to cache temporary internet files. Currently I am dealing with IE (because SWT uses the native browser), and the browser cannot be changed. The "Cache-Control: no-cache" seems to work fine for every file type I display, except wmv. My "Expires" is set to 0. I have tried all kinds of cache control co...

http headers to send file to html5 <audio>

I want use html5's new tag to play a wav file (currently only supported in FF.) https://developer.mozilla.org/En/HTML/Element/Audio I"m using php's readfile command to get the wav file off the hdd, and write it to the http response. But its not working. The audio widget in firefox just has the loading animation running constantly. T...

Sending estimate HTTP Content-Length from Servlet etc

I often need to generate content dynamically from a servlet / restlet or whatever, and don't know the length ahead of time. If the client is a browser, the progress bar doesn't work properly, because I haven't set the Content-Length header. Is there any way of setting an estimated content length, so the progress bar works "more or less"?...

404 response header using struts forward

Is it possible to set the http response header with a status of 404 instead of 200 when using struts forwards? We have a generic error page that goes out with a status of 200OK. We want to update the header to show a 404 instead. Is that possible? ...

PHP form validation + cookies = Firefox cache problem?

I have a simple form validation class in PHP. It works like this: A: form page that POSTs results to VALIDATION page VALIDATION: checks results. If wrong, set cookies with the name of the fields that are wrong and the message for each input error. Go back to A form page by using headers location property. A: if the cookies are present...

304: Not modified and front end caching

I am using a PHP script to serve files. I would like to be able to send back a 304 not modified header in my http response if the file has not changed since the client last downloaded it. This seems to be a feature in Apache (and most other web servers), but I have no clue how this can be implemented through PHP. I have heard of using ...

Should HTTP 304 Not Modified-responses contain cache-control headers ?

Hi. I've tried to understand this, and searched SO for similar questions, but I still don't have a 100% understanding on how this is supposed to work. I get this response on a request for an image resource: Response Headers Server Apache-Coyote/1.1 Date Mon, 19 Oct 2009 09:04:04 GMT Expires Mon, 19 Oct 2009 09:06:05 G...

how do tell if a user hits my site from my free domain name

I've registered two free domain names, one at .co.nr and the other at .tk (yeah I realise the .co.nr one is really a subdomain) Anyway I have both pointing to the same site mysite.com. I want to find out which one brings in more traffic. Not knowing much about how dns and the above sites operate, how do I go about telling in mysite.co...

Socket programming with PHP

I am connecting to a remote website via sockets. I am expecting a specific string 'XXX' from the remote site. Upon receipt of the string, I want to send back an 'ACK' 200 OK response back to the remote server. This is what I have so far (assume socket successfully opened); $fp is resource (pointer) to the socket: while (!feof($fp)) { ...

Google Chrome; refresh doesn't send If-Modified-Since header

Hi there, As I am currently developing a website that simply must be able to perform more or less flawlessly under a lot of stress and switching from an automated test scenario, I would try the simple press-and-hold-F5-for-several-seconds-in-my-favorite-browser, and here I found an odd observation with Google Chrome: If you do the abov...