http

Read POST request parameters properly in PHP for request more than 1450 B?

I receive POST request on my api.php script. The content red using this code: $fp = fopen('php://stdin', 'r'); $all = ""; while($line = fgets($fp, 4096)) { $all .= $line; } echo $all; looks like this: ------------V2ymHFg03ehbqgZCaKO6jy Content-Disposition: form-data; name="intro" O ------------V2ymHF...

REST HTTP status codes

I'm building an application with a REST-based API and have come to the point where i'm specifying status codes for each requests. What status code should i send for requests failing validation or where a request is trying to add a duplicate in my database? I've looked through http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html but n...

Help Conceptualizing XML HTTP POST Automation through Application Layer

Hey everyone, For this post, I'm looking for more conceptual help than a specific technical solution (although anything helps). Basically, I've been asked to automate an XML HTTP POST through an application layer. I've never done anything like this before, so I'm a bit confused where to even start on a high level. It would be great...

Making a GET call before leaving page - Javascript

Hi folks, performing a GET in order to send data to an API before a user leaves the page can be seen as a performance issue. Is there an alternative or a way a developer can optimize the client side javascript? One of the great examples is: Google Analytics! ...

how to checksum a file transfer with java servlet and HttpURLConnection

Hi! I'm trying to guarantee a file transfer. I guess that I could do it with some kind of checksum. Also, because of some inner issues, I need to do it with streaming. I thought of calculating a digest before and after the transfer but the error would appear only at the end of the transfer. I'm searching for some kind of chunked checks...

RESTful web service Logins with PHP

I'm trying to create a RESTful web service in PHP. According to Roy fielding, communication betweenn client and server must be stateless in nature. So is storing login information, as in the currently logged-in user's username, in the PHP $_SESSION variable the wrong way to go, since it means storing session state? This is for the purp...

Javascript HTTP GET html/text returning null/empty?

I am trying to get the html of a website using this code: function catchData(req) { console.debug("i got a reply!"); var returnXML = req.responseXML; console.debug(returnXML); if (!returnXML) { console.debug("html is bad"); return; } if (speed != currentSpeed) moveToNewSpeed(speed); currentSpeed = sp...

Cross-domain calls from a webbrowser

I would like to execute a cross domain http request from a website. What are my options? Javascript is out, because most browser don't allow cross domain calls. Generally the solution is to use a proxy, but that isn't an option for this project. The other things I was thinking about would be to use Flash or maybe Java. Are there any...

Google blobstore and HTTP 206 responses

The Google Blobstore recently added support for serving partial byte ranges from a blob. When this method is invoked the response is generated with a HTTP 206 (Partial Content) status code. So it looks like app engine assumes that it is always serving a Range request in this case. However, in my case I have bundled many files into one b...

What does Google Analytics use to keep track of user activity?

Hi folks, just wondering if anyone knows what technologies are used by the tracking software? Edit: I meant client-side. How is data sent to the Google API? Long polling? Streaming? =) Thanks guys! ...

HTTP 406 and 415 error codes

I am writing a web service that accepts only json, and also outputs only json. So I need to return the appropriate status code if any other format is requested. It appears that I have two choices: 406 415 It would be great if someone could enlighten me as to the semantics of the two codes. ...

How do I create a Mule ESB Service to HTTP POST using name/value pairs?

I need to create a mule service that will POST data to a web service that expects name/value pairs (not xml), then process the XML response from that service. I cannot find a good example on how to prep the payload for an http POST. Can someone provide some insight or examples? What I have so far is (I don't know if 'PathToTransforme...

HTTP 1.1 Pipelining

Hi, I have to implement an HTTP client in Java and for my needs it seems that the most efficient way to do it, is implement HTTP pipeline (as per RFC2616). As an aside, I want to pipeline POSTs. (Also I am not talking about multiplexing. I am talking about pipelining i.e. many requests over one connection before receiving any response-...

How to get HTTP status from JavaScript

How to get HTTP status code of another site with JavaScript? ...

does DOM order determine the order of form parameters posted?

If I have a form like this: <form> <input name="param[]" /> <input name="param[]" /> <input name="param[]" /> </form> Can expect to receive these parameters in the same order when the form is submitted? I've noticed that Chrome, Rails, and Webrat preserve the order of the parameters, but that may be caused by implementation det...

How to measure HTTP cache hit rates?

Is it possible to detect HTTP cache hits in order to calculate a cache hit rate? I'd like to add a snippet of code (JavaScript) to a HTML page that reports (AJAX) whether a resource was available from a client's local cache or fetched from server. I'd then compile some stats to give some insight on the effects of my cache tuning. I'm p...

Generate headers in Twisted client

Hi All, i'm using the Twisted web "HTTPClient" protocol to dialogue with a http server (using twisted app as a client), the problem is that most of my request do not accept my header. Is there some sort of way (maybe using certain libraries) to generate header?? I'll post some code so you can have a look class Local(HTTPClient): def gen...

Deal with download interruptions in Tcl

I'm downloading a list of files using tcl's http package and was wondering what the best way to handle interruptions are. Right now the outline to my download procedure looks like this: proc downloadFiles {url_list folder_location} { foreach {i} $url_list { regsub {.*/(.*)$} $i {\1} $name set out [open $folder_locati...

Firefox build a tree of all requests originating from the first GET request.

Hello Everyone, I'm new to Firefox development, and really what I'm looking for is documentation to look at/where to start in regards to the problem below: I'm writing a firefox plugin, and what I'm trying to figure out is how to get a set of all requests that are triggered due to the first GET request. An example would be when one to...

Http Range header

I was reading http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35 and trying to figure out how to continue a file download. For example, suppose a file is of length 100 bytes and I have all the 100 bytes. However, I don't know what the expected file size should be, so I ask for the file and specify a Range header that looks ...