http

Java: stopping long HTTP operations

I'm using Apache Common library for HTTP operations: HttpClient client = getClient(); PutMethod put = new PutMethod(url); FileRequestEntity countingFileRequestEntity = new FileRequestEntity(file, "application/octet-stream"); put.setRequestEntity(countingFileRequestEntity); client.executeMethod(put); put.releaseConnection(); I wonder h...

How to perform an action when a remote (Http) file changed?

Hi, I want to create a script that checks an URL and perform an action (download + unzip) when the "Last-Modified" header of the remote file changed. I thought about fetching the header with curl but then I have to store it somewhere for each file and perform a date comparison. Does anyone have a different idea using (mostly) standar...

Redirecting before POST upload has been completed

I have form with file upload. The files to be uploaded actually are pictures and videos, so they can be quite big. I have logic which based on headers and first 1KB can determine if the rest will be processed or immediately rejected. In the later case I'd like to redirect client to error page without having to wait for upload to finish. ...

I get error when trying to write response stream to a file

I am trying to test a rest webservice but when I do a post and try to retreive the save the response stream to a file I get an exception saying "Stream was not readable." What am I doing wrong? Public Sub PostAndRead() Dim flReader As FileStream = New FileStream("~\testRequest.xml", FileMode.Open, FileAccess.Read) Dim flWriter A...

What's the difference between /123 and /?123?

I've noticed that some sites (including http://jobs.stackoverflow.com) have query strings that look like this: http://somewebapp.example/?123 as compared to: http://somewebapp.example/123 or http://somewebapp.example/id/123 What are the reasons that developers choose to implement their web apps' URLs using the first example instead...

HTTP Cache Control max-age, must-revalidate

I have a couple of queries related to Cache-Control. If I specify Cache-Control "max-age=3600, must-revalidate" for a static html/js/images/css file, with Last Modified Header defined in HTTP header, a. Does browser/proxy cache(liek Squid/Akamai) go all the way to orgin server to validate before max-age expires? Or will it serve cont...

Parsing content-disposion header's filename in multipart/from-data

Hello According to RFC, in multipart/form-data content-disposition header filename field receives as parameter HTTP quoted string - string between quites where character '\' can escape any other ascii character. Problem web browsers don't do it. IE6 sends: Content-Disposition: form-data; name="file"; filename="z:\tmp\test.txt" Inste...

Sending images using Http Post

I want to send an image from the android client to the Django server using Http Post. The image is chosen from the gallery. At present, I am using list value name Pairs to send the necessary data to the server and receiving responses from Django in JSON. Can the same approach be used for images (with urls for images embedded in JSON resp...

HTTP headers: Last-Modified - how can it mimimize server load?

Imagine the following use case: I use an AJAX request for getting some info about Item and use this URL: http://domain/items/show/1 In my database all items have a field called modified_at where we store the moment when this item was previously modified. How can Last-Modified server HTTP header in response can minimize load/reduce req...

iPhone Mobile Safari, How many max parallel http connections?

I would like to use parallel AJAX HTTP requests with iPhone Mobile Safari (OS4). What is the max number of parallel connections? ...

HTTP Header - ntCoent-Length

I get the following HTTP response headers in a particular response. All looks okay. However I have noticed that the content-length appears twice... Content-Length: 2424 ntCoent-Length: 2424 Is there a particular reason why the content-length is returned a second time as ntCoent-Length? HTTP/1.0 200 OK Date: Wed, 26 May 2010 09:38:1...

Mod_rewrite on all website images

I'm designing an image repository. I want to uncouple the filename from the image html link. For instance: image in filesystem is called images/items/12543.jpg HTML is <img src="images/car.jpg" /> Does anyone strongly discourages me to rewrite all image requests using PHP so when retrieving images/car.jpg, Apache really replies conte...

Is Webhooks a style/pattern or a specification?

I've been reading about Webhooks and I'm trying to determine if it's a specification vs a style/pattern. By "specification" I mean that the implementation details, e.g. headers, payload and so on are well defined. By "style" or "pattern" I mean in the sense that REST is a style (as opposed to a spec) or a pattern which describes usage ...

How to receive HTTP messages using Socket

I'm using Socket class for my web client. I can't use HttpWebRequest since it doesn't support socks proxies. So I have to parse headers and handle chunked encoding by myself. The most difficult thing for me is to determine length of content so I have to read it byte-by-byte. First I have to use ReadByte() to find last header ("\r\n\r\n" ...

Why should i POST data rather then GET?

I know you dont want to POST a form with a username and password where anyone could use the history to see or situations where repeat actions may not be desired (refreshing a page = adding an item to a cart may not be desired). So i have an understanding when i may want to use one over the other. But i could always have the server redire...

Visual Studio reports that not all code path return a value, even though they do

I have an API in NETMF C# that I am writing that includes a function to send an HTTP request. For those who are familiar with NETMF, this is a heavily modified version of the "webClient" example, which a simple application that demonstrates how to submit an HTTP request, and recive a response. In the sample, it simply prints the response...

Connect android to database

I am doing a school project where we need to create an android application which needs to connect to a database. the application needs to gain and store information for people's profiles on the database. But unfortunatly we are a little bit stuck at this point because there are numerous ways to link the application such as http request t...

best way to know the time of upload/download of a file from/onto iPhone

Hi I'm trying to get the time interval I need to download/upload something to/from a server with no password/proxy. I found a method used by ericasadun. Which actually prints the time iPhone needed to download a certain file. - (void) getData: (NSNumber *) which { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init...

Getting targetFeedReadOnly error in simple YouTube search query

Hello im beginner in the YT api , i trying to query YT api with search query from c++ http client with post request the request string looks like this : http://gdata.youtube.com/feeds/api/videos?max-results=10&amp;orderby=published&amp;q=Skinny%20puppy&amp;start-index=1&amp;v=2 no headers and no autontication has bean made and the e...

Alternative for PHP mail

In relation to an earlier question I'm looking for an alternative way to send an order from my website to the division in my company that processes the order. Currently I use PHP mail(), but frequently this gives problems. Big delays occur. Are there alternatives to PHP mail() that pushes the order to my company? So I prefer not to poll...