http

httplib in Python to get the status code...but it is too tricky?

>>> import httplib >>> conn = httplib.HTTPConnection("www.google.com") >>> conn.request("HEAD", "/index.html") >>> res = conn.getresponse() >>> print res.status, res.reason 200 OK This code will get the HTTP status code. However, notice that I split up "google.com" and "/index.html" on 2 lines. And it's confusing. What if I want to ...

Tunneling A Protocol Through HTTP - Advice

What are the best examples of real life protocols that tunnel through HTTP? XMPP/Jabber? I'm looking for actual links to documentation? or specs for how they tunnel. I'm in working on project where I'm wondering if I should start with REST, XML-RPC, or SOAP and then have a fast TCP flavor of the protocol. Or start at the low level and t...

HTTP proxy server

I am beginning work on a very basic HTTP proxy server written in C (Edit: something that just forwards my requests). At this point I am having difficulty in understanding how to proceed. Any help would be beneficial. ...

Receiving REST response on local machine

I use a web service to convert files. The service returns the converted file as an HTTP POST, along with identifier data. My app receives the response, updates its database and saves the file to the appropriate location. At least that's the idea, but how do I develop and test this on a local machine? Since it isn't publicly facing, I ca...

Using ip addresses in place of domain names for cookies

Our servers that processes REST client requests currently is not mapped to a public domain name. Is it mandatory to have a domain name when generating Client side cookies ? ...

HTTP: max length of etag

Does the HTTP protocol specify a max length for the ETag? ...

HTTP Session Tracking

Since HTTP is a stateless protocol, when a client makes a number of requests to the server, how does the server uniquely identify a particular client's requests over a period of time say t1, t2, t3.. I browsed the web and came across terms like session id, URL rewriting and cookies. But it would be great if someone explains it in a bett...

How to set response filename without forcing saveas dialog

I am returning a stream in some response setting the appropriate content-type header. The behavior i'm looking for is this: If the browser is able to render content of the given content-type then it should display it in the browser window. If the browser doesn't know how to render the content then it should display the saveas dialog wh...

Using HTTP POST for login forms

I regularly use a standard form to send login information through the HTTP POST method and then validate it using php to check if the details are correct. I use an md5 hash on the passwords (and sometimes usernames) to give some degree of security, so I'm not storing a raw password in my code in case it's viewed by an unauthorised person...

CoverageInfo.getCoverageStatus() vs CoverageInfo.isCoverageSufficient(), are they the same?

In trying to determing a if a specific connection is supported, I'm cofused about the difference between CoverageInfo.getCoverageStatus() and CoverageInfo.isCoverageSufficient(). For example: // check mds with getCoverageStatus() and bitwise check boolean hasMdsCoverage1 = (CoverageInfo.getCoverageStatus() & CoverageInfo.COVERAGE_MDS) =...

cheat prevention for browser based xmlhttp/js/perl/php game

Lets say that in a browser based game, completing some action (for simplicity lets say someone clicks on a link that increases their score by 100) clicking on this link which would have a url for example increase_score.pl?amount=100 what kind of prevention is there from someone simply sending requests to the web server to execute this co...

PHP http handling

Is there a way to prevent a php script from sending a http response when the script is finished executing? If not in php is it possible in any-other common web scripting langues? ...

Authoritative position of duplicate HTTP GET query keys

I am having trouble on finding authoritative information about the behavior with HTTP GET query string duplicate fields, like http://example.com/page?field=foo&field=bar and in particular if the order is kept or not. Most web-oriented languages produce an array containing both foo and bar associated to a key "field", but I would ...

Recommended Way to Control Making HTTP requests?

Hypothetically, if the user clicks "save,save,save,save" a bunch of times on a text file, making single character changes at a time and managing to resave 5 times before the first save is processed, what is best practice in that situation? Assuming we don't have a "batch process" option... Or maybe they push save,save,save,save on 4 fi...

Is there any way to read the header codes without downloading the file at all?

import httplib conn = httplib.HTTPConnection(head) conn.request("HEAD",tail) res = conn.getresponse() print res.status I am currently using this to get the HTTP header code of a file. However, it seems like this code DOWNLOADS the file, and then gets the code. However, some files are actually video files...and it would be ineffi...

In Python, what does getresponse() return?

import httplib conn = httplib.HTTPConnection(head) conn.request("HEAD",tail) res = conn.getresponse() I can get the res.status , which is the http status code. What other elements can I get? Why is it that when I do print res, it won't print the dictionary? I just want to see the keys that are in that dictionary... ...

How to get the true URL of a file on the web. (Python)

I notice that sometimes audio files on the internet have a "fake" URL. http://garagaeband.com/3252243 And this will 302 to the real URL: http://garageband.com/michael_jackson4.mp3 My question is...when supplied with the fake URL, how can you get the REAL URL from headers? Currently, this is my code for reading the headers of a f...

http and threading

http is stateless...variables and objects are destroyed in every request...we have sessions to maintain state... but how does threading apply to http anyway? does that mean I can only fiddle around with cookies and session data if any number of users each use one account or try to update one record in my database (I know about lockings ...

Why am I getting a redirect loop?

I have a website with a for example (http://example.com). I want any requests for / i.e. http://example.com to be redirected to http://example.com/stuff. I added a .htaccess file with the following line: redirect 301 / http://example.com/stuff Any suggestion? ...

Open Source PHP script for HTTP streaming?

Open Source PHP script for HTTP streaming? Does anyone know something about such things? ...