http

What's the difference between a 302 and a 307 redirect?

What's the difference between a 302 FOUND and a 307 TEMPORARY REDIRECT HTTP response? The w3 spec seems to indicate that they're both used for temporary redirects, and neither can be cached unless the response specifically allows it. Thanks! ...

2 connections per server?

i´ve read somewhere that you can just have 2 connections (eg. ajax requests) to the same server. is this correct? so you can´t run 3 ajax requests simultaneously? what will happen to the 3rd one? and if I´ve got one iframe, then i can just run 1 ajax request at the time? what is the easiest way to get around this? what keywords could...

REST best-practice for overlong URIs

I have REST services which should receive really long queries via GET. Say for example I want to query a service with many geographical coordinates to find out something about all this coordinates. 1) My first thought was to use long URIs and increase the max URI length of the servlet container. It would look like this: GET http://so...

Rails controller testing - Validation errors do not raise a HTTP error response

I have an ActionController derived Test which sends a 'post' request to the controller under test with incorrect data. The controller tries to create a new object and save it. The model has validation methods that get triggered on save and they generate a validation error detecting the incorrect data sent by test. So far so good. Now, c...

PHP using session_cache_limiter() and session_cache_expire() or multiple header()

I want my PHP pages to be cached. To allow cache I use: session_cache_limiter('private'); session_cache_expire(180); session_start(); Since I'm only using sessions for these cache headers, should I just drop these 3 line and replace them with (I'm never using $_SESSION): header('Expires: <some GMT date>'); header('Cache-Control: priv...

writing a http sniffer

Hi all, I would like to write a program to extract the URLs of websites visited by a system (an IP address) through packet capture.. I think this URL will come in the data section ( ie not in any of the headers - ethernet / ip / tcp-udp ).. ( Such programs are sometimes referred to as http sniffers , i'm not supposed to use any availab...

Is HTTP/1.0 still in use?

Say one is to write an HTTP server/client, how important is it to support HTTP/1.0? Is it still used anywhere nowdays? Edit: I'm less concerned with the usefullness/importance of HTTP/1.0, rather the amount of software that actually uses it for non-internal (unit testing being internal use, for example) purposes in the real world (brows...

What does this Rewrite rule mean?

Im installing phpancake, there is a folder there shema like this application/ install/ library/ public/ sql_schema/ install.html install.php What does this rule mean? RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRu...

PHP PECL_HTTP vs cURL Extension

I'm working on a PHP Client for CouchDB. While browsing through the php.net documentation regarding HTTP and cURL, I came across the PECL_HTTP Extension. At first glance, I think I would like to use this PECL extension instead of cURL because it's much simpler to use, and I'm not doing very complicated HTTP work anyways. Plus I always li...

Rails: Return a 401?

I'd like to return a HTTP 401 error as part of my permission_denied method for declarative_authorization. # triggered when a user accesses a page that they don't have access to def permission_denied # render my default 401 error page? end How would I do this? (Pardon the question if it's stupid... I know how to render the 401.html p...

How large can a HTTP form parameter string be?

How large can a HTTP form parameter string be? If I want to pass say a couple of pages worth of XML will a form parameter be ok? Or if not would I need to treat it as a file upload to be sure? Thanks ...

What form param values can be used for TRUE in a ruby on rails app with mysql db for a BOOLEAN field?

Hi, when contructing a http form parameter for a Boolean, what value ca be used to represent true? That is, ruby on rails database field set to BOOLEAN for a mysql database. ...

Is the cookie "metadata" (expires, path,...) transferred to the server?

When you set a cookie, you set the raw cookie data, and some metadata. This metadata includes the path for where the cookie is valid, the expiration time of the cookie, and so on. When a browser performs a request, what exactly will the browsers send with it? Will it send the full cookie, with all the "metadata"? Or only the actual data...

redirecting browser to a new image, with content type image/png in PHP

I have a php script which generates an image, and is used (mainly) like this: <img src="user_image.php?id=[some_guid]" /> The script uses a class I wrote to display an image matching that ID. There are a number of things that could go wrong though, and each of them throws an exception. So I have something like this: <?php try { ...

Must a server read the body of a PUT request, even when generating a '401 Not Authorized' response?

Is a HTTP server expected to read the whole request body from a PUT request, even if access is denied? Or is it compliant to return a 401 Not Authorized, without reading anything or only a small part of the body. (And add 'Connection: close' to prevent the connection from being reused) ...

bad ETag value in test and production environment

i'm using the new caching solution for Rails as described here. the development environment works fine, but the test and production sends invalid ETag header ignores the parameter of the stale? function. heres is the corresponding part of one of my controllers: def index @categories = Category.all if stale?(:etag => @categories) ...

Differences between type="image" and type="submit"?

(This question is related to this question) I've a simple form: <html> <head> </head> <body> <form name="aspnetForm" method="post" action="http://www.startupseeds.com/Default.aspx"&gt; <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="..." /> <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVAL...

How does client-machine/browser handle unrequested HTTP response?

Imagine the following: User goes to script (http://sample.org/test.php), Script sends an HTTP request to some other page (http://google.com/). For this example, we'll say using curl. The script sets the IP address of the request to the user's IP, via CURLOPT_INTERFACE. I know already that the requesting script will not receive the re...

Starting two WebClient.UploadStringAsync calls subsequently

When calling WebClient.UploadStringAsync twice, without waiting for the WebClient.UploadStringCompleted event, the following exception is thrown: "WebClient does not support concurrent I/O operations" Apparently, this is not supported. The reason for wanting to start multiple HTTP POST requests without having to wait for the previous...

How to initiate multiple HTTP requests asynchronously?

I'd like to start multiple HTTP requests rapidly after each other, without having to wait on the previous response to arrive. I've tried this using WebClient.UploadStringAsync, but this doesn't work. I'd like to efficiently implement the following scenario: Send request 1 Send request 2 Send request 3 And in another thread: Receive...