http

How to stop listening on an HTTP::Daemon port in Perl

I have a basic perl HTTP server using HTTP::Daemon. When I stop and start the script, it appears that the port is still being listened on and I get an error message saying that my HTTP::Daemon instance is undefined. If I try to start the script about a minute after it has stopped, it works fine and can bind to the port again. Is there a...

"Greater than" and "Lesser than" symbols in URL not working

i, I have the following URL which is successfully handled by an Apache Tomcat application: http://localhost:8080/ApplicationX/FileY/UpdateDocument(`&lt;add location="somewhere">ContentZ</add>`).xml?VIEW=RAW For some reason, when I try to handle the same request in IIS with an ASP.NET Http request handler (Class implementing IHttpHandl...

how to send JSON data with server error response code 500

I wanted to know if theres a way to send a JSON data along with HTTP response code 500. Basically I want my rest client to know that there is some error on the backend and along with it send a JSON error data structure like this. {"error" : [ {"code": "1001", "desc": "Some error description"}, {"code": "1002", "desc"...

What info is included with file on upload via http?

If I'm uploading via http, do I have to wait till the file is transferred to determine the size? Also, what other info is available that would be available on the local copy? Do Last Modified and Created get reset to the upload time or are they preserved? ...

(Weak) ETags and Last-Modified

As far as I understand the specs, the ETag, which was introduced in RFC 2616 (HTTP/1.1) is a predecessor of the Last-Modified-Header, which is proposet to give the software-architect more controll over the cache-revalidating process. If both Cache-Validation-Headers (If-None-Match and If-Modified-Since) are present, according to RFC 261...

Simulate Browser Resources Expansion Behavior With Python

I'm looking for a way to simulate browser resources expansion behavior. The flow I'm trying to address is the following: Access an initial URL (e.g. http://example.dmn/index.htm) Parse the html response received (e.g. index.htm) Find the resources that a browser will fetch as a result of the index parsing, e.g.: Images Flash ...

Can CFHEADER values be read by other code?

The code <cfheader name="Test" value="1"> <cfheader name="Test" value="2"> results in the header "Test: 2" being sent to the browser (as seen using HttpFox). Is there a way for the second line of code to determine if a header with the same name has already been written using CFHEADER? Thanks! ...

Perl: Value of response code in HTTP::Request

Hi, all! So, I am writing a code to get a document from the internet. The document size is around 200 KB. This is the code: #!/usr/local/bin/perl -w use strict; use LWP::UserAgent; my $ua = LWP::UserAgent->new; my $url = "SOME URL"; my $req = HTTP::Request->new(GET => $url); my $res = $ua->request($req); if($res->is_success){ print...

Pass value from one ASP.NET app to another via HTTP Header

We are implementing a single sign on mechanism in an enterprise environment, where the token is shared between applications using HTTP header. Now, in order to do the integration test, I need to write an application to simulate this. Is there any way in ASP.NET where I can redirect to another web-page and pass a custom HTTP header in t...

HTTP Post requests using HttpClient take 2 seconds, why?

Update: Found the answer myself, see below :-) Hi, I'am currently coding an android app that submits stuff in the background using HTTP Post and AsyncTask. I use the org.apache.http.client Package for this. I based my code on this example. Basically, my code looks like this: public void postData() { // Create a new HttpClient ...

Can I use a MIME type declaration to get an HTML file to open in MS Word?

Bill James wrote: I was able to render an HTML page with the MIME type set to "application/msword", which caused the browser to spawn Word which imported the html just fine, allowing edits and saving just as if I'd output a real Word doc. That sounds great to me, but I haven't been able to get it to work in any browser (Chrome/FF/S...

compressing non-binary data in java http client

I plan to use java.util.zip to compress http post data when sending it from a java client to the server(java servlet in this case). is this the best approach for reducing data load? should I use gzip as the compression alg? ...

Custom HTTP Request headers in HTML

Does anyone know if its possible to send out custom http REQUEST headers in HTML without having to use javascript (no xhr wrapper). Would it be possible to define them as meta tags within the head? Or may they be defined in the form somewhere? <meta http-equip="x-something-custom" name="custom value" /> this works, however, this is a...

Generic Open Source REST Client?

I want a simple client that takes a few parameters (Method, URL, Parameters), makes an HTTP request, and shows me the results that were returned. A browser obviously can easily send GET and POST requests, but I have no good ideas on DELETE and UPDATE. Did I miss something in browser 101, or is there a common freeware tool to do this?...

Simple HTTP Framework and time issue

I'm using Simple Framework for my recent project, and there is a problem with the date headers generated by the system. I can get my local time from Date class correctly, but setDate method of Simple's Response class sets date in milliseconds and when i do that by calling System.currentTimeInMillis, dates in response headers are incorrec...

sending binary data via POST on android

Android supports a limited version of apache's http client(v4). typically if I want to send binary data using content type= application/octet-stream via POST, I do the following: HttpClient client = getHttpClient(); HttpPost method=new HttpPost("http://192.168.0.1:8080/xxx"); System.err.printl...

How do I stop Safari from caching my Servlet response?

I'm having trouble testing a web app with Safari. My app returns wave audio data. The problem happens when I change the application and hit it again from Safari. Safari caches the original response so no matter how many times I hit refresh it seems like I've not updated anything. I can almost get around this using force refresh with Fire...

What HTTP status response code should I use if the request is missing a required parameter?

I am thinking 412 (Precondition Failed) but there may be a better standard? ...

Can WCF TCP and HTTP endpoints have the same port?

I'm interested in one WCF server exposing both HTTP and TCP interfaces. It'll be used with Silverlight clients, so the thinking is that the HTTP interface will be for secure communications while TCP will be used the rest of the time. Is it possible for these two interfaces to use the same port in their endpoints, e.g. http://localhost:...

Most efficient method of generating PNG as HTTP response

I've built an ASP.NET page whose output stream is a dynamically-generated PNG image containing only text on a transparent background. The text is based upon database IDs contained in the querystring. There will be a limited number of variations. Which one of the following would be the most efficient means of returning the image to the ...