http

What mime-type should I return for a python string

I have a web API that returns python dictionaries or lists as a response that I eval() in python scripts that use the API, for completness I wanted to set a proper content-type but not sure what would be best to use "text/x-python" or maybe "application/python", or something else? [edit] I'm also outputting JSON, I'm doing Python as an...

Light weight HTTP Server library in .NET

I'm looking for a small and fast library implementing an HTTP server in .NET My general requirements are: Supports multiple simultaneous connections Only needs to support static content (no server side processing) HTTP only, HTTPS not needed Preferably be able to serve a page from an in memory source. I want to integrate it into anoth...

How can I write a simple HTTP proxy in Perl?

I don't want to use the HTTP::Proxy package because I want to dump out a couple requests. My one liner looks like this, but breaks on trying to pass the header in: perl -MData::Dumper -MHTTP::Daemon -MHTTP::Status -MLWP::UserAgent -e 'my $ua = LWP::UserAgent->new;my $d=new HTTP::Daemon(LocalPort=>1999);print "Please contact me at: <", $...

HTTP status for functional redirect

Right now we've got web pages that show UI elements, and web pages that just process form submissions, and then redirect back to the UI pages. They do this using PHP's header() function: header("Location: /other_page.php"); This causes a 302 Found response to be sent; according to the HTTP 1.1 spec, 302 is for cases where "The reques...

How to show the visitor a moved web page AND return a 301 redirect HTTP response status code in Django?

When a webpage has moved to a new location, how do I show the moved web page AND return a 301 permanent redirect HTTP response status code in Django? ...

PHP_SELF vs PATH_INFO vs SCRIPT_NAME vs REQUEST_URI

Hi All, I am building a PHP app in CodeIgniter. CI sends all requests to the main controller, /index.php. However, I don't like to see the index.php in the URL, so I've used mod_rewrite, as per the CI documentation. The rule is as follows: RewriteEngine on RewriteCond $1 !^(images|inc|favicon\.ico|index\.php|robots\.txt) RewriteRu...

Size of uploaded file

Do web browsers send the file size in the http header when uploading a file to the server. And if that the case, then, is it possible to refuse the file just by reading the header and not wait for the whole upload process to finish? ...

What embedded HTTP server library options should I look at?

I'm looking to write a small proxy server for kicks and giggles. Apart from the options in libWWW, can anyone recommend any opensource options for the HTTP server and client code? Thinking of a library of some kind similar to libWWW. Chosen language is C/C++ but open to Java, C#, Python... etc. :-) ...

Returning redirect as response to XHR request.

What happens if the browser receives a redirect response to an ajax request? ...

How can I use JavaScript on the client side to detect if the page was encrypted?

Is it possible to detect, on the client side, whether the user is using an encrypted page or not? Put another way -- I want to know if the URL of the current page starts with http or https. ...

Choosing buffer size for FTP and HTTP transfers

Hello, How to choose the size of buffer (bytes that I read from or write to socket) for the maximum throughput when I'm implementing a low-level HTTP and FTP transfer? My application should transfer data with HTTP or FTP on connections varying from 130 Kbps to 3 Mbps (I know expected speed beforehand). Sometimes it's one way transfer, s...

Conflict with squid and ajax

I have a user who gets an error from ajax calls on our site. The error is pasted below. They get the error in FF3 Windows, but not IE. Based on some searching it seems this issue is often caused by the client protocol squid (you'll notice at the end of the error, squid is mentioned). My ajax code is the same used here: http://www.w3...

'Refresh' HTTP header

I'm automating a web application (the Mantis bug tracker) and I'm getting an interesting response header from it, called Refresh: HTTP/1.x 200 OK ... Refresh: 0;url=my_view_page.php It seems to be acting the same way that meta refresh does, and the meta refresh technique implies that it is an equivalent of a header in HTTP. Problem i...

REST: Correct HTTP Response Code For a POST Which Is Ignored

We have a REST API which clients routinely POST and PUT data to. When they do this, sometimes they POST data which results in no change on our system. The POSTs and PUTs are well-formed, but they data they're sending is identical to the data in our database. When this happens, I've just found out that we're returning a 400 HTTP statu...

Processing chunked encoded HTTP POST requests in python (or generic CGI under apache)

I have a j2me client that would post some chunked encoded data to a webserver. I'd like to process the data in python. The script is being run as a CGI one, but apparently apache will refuse a chunked encoded post request to a CGI script. As far as I could see mod_python, WSGI and FastCGI are no go too. I'd like to know if there is a wa...

Trying to send an HTTP request over sockets.

I'm having trouble sending out a simple HTTP request using Actionscript 3's Socket() object. My onConnect listener is below: function sConnect(e:Event):void { trace('connected'); s.writeUTFBytes('GET /outernet/client/rss/reddit-feeds HTTP/1.1\r\n'); s.writeUTFBytes('Host: 208.43.71.50:8080\r\n'); s.writeUTFBytes('Connect...

How can I programmatically test an HTTP connection?

Using Java, how can I test that a URL is contactable, and returns a valid response? http://stackoverflow.com/about ...

Are socket connections faster than http on Blackberry?

I'm writing an app for Blackberry that was originally implemented in standard J2ME. The network connection was done using Connector.open("socket://...:80/...") instead of http:// Now, I've implemented the connection using both methods, and it seems like some times, the socket method is more responsive, and some times it doesn't work at...

How can I emulate PUT/DELETE for Rails and GWT?

I would like to make my application somewhat REST compliant. I am using Rails on the backend and GWT on the frontend. I would like to do updates and deletes. I realize I can do something like mydomain.com/:id/delete (GET) and accomplish the same thing. However, as I stated previously, I would like to have a REST compliant backend. T...

Large file download in background, initiated from the browser

Is there any reasonable method to allow users of a webapp to download large files? I'm looking for something other than the browser's built-in download dialog - the requirements are that the user initiates the download from the browser and then some other application takes over, downloads the file in background and doesn't exit when the ...