http

How do I get a content-type of a file in Python? (with url..)

Suppose I haev a video file: http://mydomain.com/thevideofile.mp4 How do I get the header and the content-type of this file? With Python. But , I don't want to download the entire file. i want it to return: video/mp4 Edit: this is what I did. What do you think? f = urllib2.urlopen(url) params['mime'] = f.headers['content-type'...

IIS Files with No Extension

Hi, I recently saw a website in which the url was formulated like this: http://subdomain.domain.com/script/?var=value I was wondering how to do this in IIS, and how he put a slash in between the script and the GET variables, and how he had the script with no extension in the first place. Any help? ...

RESTful view counter

I would like to count the access to a resource, but HTTP GET should not modify a resource. The counter should be displayed with the resource. A similar case would be to store the last access. What is the REST way to realize a view counter? ...

twisted http client

I am after an example describing the usage of Twisted's HTTP Client. After reading the excellent blog post on the internals of Twisted, I understand how the "Factory" and "Protocol" components play their role but I am unclear on how to introduce "Request" in the overall Client flow. More specifically, I need to be able to perform HTTP...

Why use output buffering in PHP?

I have read quite a bit of material on Internet, where different authors suggest using output buffering. The funny thing is that most authors argument for its use because it allows to set HTTP response headers while also generating response output. Frankly, if for no other reason, I think that responsible web applications SHOULD NOT mix ...

Can a Java Applet use the browser's NTLM authorization header?

I have a Java Applet which needs to post some stuff to the web. The code, the author of which has long since disappeared, is currently using raw Java.net.Sockets to communicate with the server. On the server side, the client requests are authenticated with NTLM or Kerberos. For requests coming from the browser itself, each HTTP header g...

C# HTTP POST Method - Cookies issue

Hello, I'm trying to use C# to login to hotfile.com. The first big issue was to overcome the 417 Error, which this line solved it: System.Net.ServicePointManager.Expect100Continue = false; Now I'm getting this error as I try to login using POST: You don't seem to accept cookies. Cookies are required in order to log in. Help I've...

HTTP/.NET: How do I post some data and then work within that session?

I need to download a bunch of HTML pages programatically, but they are behind a login. SO what I need... I think... is to do the following. Use an HTTP POST to upload some form data including the username/password. Capture the session somehow. Cookies? Send a series of HTTP GETs to download the pages I need. #3 is easy, I do it all t...

Is it possible to use an HTTP PUT to submit form data?

Simple question: everyone knows you can POST data in a HTML form to the server, and the browser will handle serializing the data in the form. However, is it possible to do this using a PUT verb instead? Either through Javascript or some other means. ...

.NET: What's the difference between HttpMethod and RequestType of HttpRequest?

The HttpRequest class defines two properties: HttpMethod: Gets the HTTP data transfer method (such as GET, POST, or HEAD) used by the client. public string HttpMethod { get; } The HTTP data transfer method used by the client. and RequestType: Gets or sets the HTTP data transfer method (GET or POST) used by the client...

HTTP request dispatch from Web Server to a CGI/FastCGI process

To gain more understanding of how HTTP requests are handled in case of web apps, how does a web server like Apache, dispatch a request to one of its Virtual Hosts? What are the initial programs executed irrespective of the framework (Rails/PHP/Java)? I would appreciate if someone can list the steps taking example of Rails (as I know Rail...

Is there an HTTP header to instruct the browser what host to use for relative href and src attributes?

I am retrieving a page from another host and then initializing the FORM with data from a DB, before sending it on to the end user; but I need to make the URLs in hrefs and srcs absolute so my browsers load them from the right place. Can I set a HTTP header to cause this to happen without modifying the HTML? ...

How do I do sessions with a Flash client?

Since the Flash Player (or, more exactly, the URLLoader class) will not let you read HTTP response headers or cookies set by the server, and if you get hold of a session cookie through some workaround like reaching out to the browser and run JS, you can't send it to the server, because, among others, the Cookie header will be blocked. N...

Rails' page caching vs. HTTP reverse proxy caches

I've been catching up with the Scaling Rails screencasts. In episode 11 which covers advanced HTTP caching (using reverse proxy caches such as Varnish and Squid etc.), they recommend only considering using a reverse proxy cache once you've already exhausted the possibilities of page, action and fragment caching within your Rails applicat...

Mapping HTTP requests to HTTP responses

If I make multiple HTTP Get Requests to the same server and get HTTP 200 OK responses to each one how do I tell which request maps to which response using Wireshark? Currently it looks like an http request is made, and the next HTTP 200 OK response is quickly received so everything is in a the proper sequence. I have seen things to the...

http object status question

I am using http object in javascript on a hand held device, running Win CE. When the device looses connection to the network, the javascript does not report an error (status = 12007) for 60-90 sec. When connected to the network, the status (200) is returned immediately. In both cases the readystate = 4. ...

Can cookies set using HTTP be read using HTTPS?

Title says it all: Can cookies set using HTTP be read using HTTPS? ...

Can I 'bounce' a file upload posted to one server directly to another?

I've got a Java REST based web service sitting on a server which is accessed via a PHP web application on a separate server. The PHP app delegates the actions performed by browser clients to the web service. I want to perform a file upload function to the web service via HTTP POST and PUT. The browser clients will use POST to upload a f...

C: Addressing the case of partial headers when using select in the context of HTTP...

This is in reference to a previous question of mine which was already answered: http://stackoverflow.com/questions/2159628/c-using-a-select-call-when-i-am-reading-how-do-i-keep-track-of-the-data My protocol actually sends how much data it is about send initially before it sends any other data. But yesterday, when testing out this code ...

Which Ruby web server?

Historically I have used Thin as an application server (for Ramaze apps, but it could easily be for Rails), which receives requests from an Nginx web server. Does anyone have experiences between using Thin/Mongrel/anything else to server Ruby applications to a web server? I am keen to keep things lean and fast. ...