http

HTTP Transfer-Encoding and requests

Hi, the HTTP specification states that the Transfer-Encoding header is allowed for requests - but what error code should a server respond if it doesn't understand that given Transfer-Encoding. As far as I know the HTTP standard doesn't cover this possibility, but maybe I have just overlooked it. ...

How do you implement simple website redirects?

If you go to www.codinghorror.com, it is automatically redirected to www.codinghorror.com/blog How does one re-direct to the "/blog/"? I'm using Dreamhost Shared Hosting, so my options of configuring the server are limited. ...

How do HTTP proxy caches decide between serving identity- vs. gzip-encoded resources?

An HTTP server uses content-negotiation to serve a single URL identity- or gzip-encoded based on the client's Accept-Encoding header. Now say we have a proxy cache like squid between clients and the httpd. If the proxy has cached both encodings of a URL, how does it determine which to serve? The non-gzip instance (not originally serve...

Most efficient way to retrieve the source of a website through PHP? (GET Request)

I know that file_get_contents can be used to retrieve the source of a webpage, but I want to know the most efficient way. I have an old class I made a long time ago that uses something like this: $this->socket = fsockopen($this->host, 80); fputs($this->socket, 'GET ' . $this->target . ' HTTP/1.0' . "\n"); fputs($this->socket, '...

HTTP Verbs and Content Negotiation or GET Strings for REST service?

I am designing a REST service and am trying to weight the pros and cons of using the full array of http verbs and content negotiation vs GET string variables. Does my choice affect cacheability? Neither solution may be right for every area. Which is best for the crud and queries (e.g. ?action=PUT)? Which is best for api version pickin...

Java: HTTP Post to create new "Product" in a Ruby on Rails application

Using the Apache HttpClient on android, how do I send data to a RESTfull Ruby on Rails app using HttpPost. This is my Controller: # POST /products def create @product = Product.new(params[:product]) respond_to do |format| if @product.save flash[:notice] = 'Product was successfully created.' format.html...

What is an acceptable time to first byte?

This is the waterfall view I'm seeing on my blog: http://www.webpagetest.org/result/090330_1A67/1/details/ It seems to me that 4 seconds for the time to first byte would indicate a server issue. Any thoughts on what is going on or what I can do to fix this initial delay? ...

Relaying a request in asp.net (Forwarding a request)

I have a web application that communicates between two different web applications (one receiver and one sender, the sender communicates with my application, and my application communicates with both). A regular scenario is that the sender sends a HttpRequest to my application, and I receive it in an HttpHandler. This in turn sends the H...

Finding Uploads in Parameters on Submit in Rails

I'm trying to figure out which of these parameters contains an uploaded file. This code works params[:upload].each do | uploaded_image | if (uploaded_image[1] != "") # do something with uploaded_image[1]; end end but my way of moving through the parameters (with the [1], for instance) seems wrong. What's the right wa...

Are the chunk sizes in an HTTP response with "Transfer-Encoding: chunked", significant to protocols that sit on top of HTTP?

Does anything carried inside HTTP care about chunk sizes? Some sort of RPC protocol perhaps? EDIT: Here's the Wikipedia sample response Date: Mon, 30 Mar 2009 22:22:21 GMT HTTP/1.1 200 OK Content-Type: text/plain Transfer-Encoding: chunked 23 This is the data in the first chunk 1A and this is the second one 0 The response coul...

Shoes crashing when downloading with :method => "POST" on Vista x64

I try the following on vista x64 (latest shoes version): Shoes.app { stack do download "http://www.gooogle.com", :method => "POST" do |goog| para goog.response.headers.inspect end end } The program crashes, and under the event viewer I get the following: Faulting application shoes.exe, version 0.0.0.0, time sta...

I am using a comet server and I want it to interact with C++

I am using persevere for an application I am writing that controls remote hardwere. Persevere is written in Java and doesn't supply an alternative API. I am using a web-based GUI as the control panel. So far, so good. I can get and set data using REST channels like dojo does but the problem is that I don't really know how to use REST c...

How can I read an HttpServletReponses output stream?

Hi there. I want to make a Servlet filter that will read the contents of the Response after it's been processed and completed and return that information in XML or PDF or whatever. But I'm not sure how to get any information out of the HttpServletResponse object. How can I get at this information? ...

UTF-8 characters mangled in HTTP Basic Auth username

I'm trying to build a web service using Ruby on Rails. Users authenticate themselves via HTTP Basic Auth. I want to allow any valid UTF-8 characters in usernames and passwords. The problem is that the browser is mangling characters in the Basic Auth credentials before it sends them to my service. For testing, I'm using 'カタカナカタカナカタカナカ...

What raises HTTP 503 and how to change timeout?

I have inherited an application (internal to my company) that uses javascript running in Internet Explorer which makes Ajax calls to a Struts-based application running in WebLogic Server v10. Certain server-side operations in the system are taking longer than 3 minutes. Users consistently noticed that the Ajax call returns 503 error at...

HTTP response with redirect, but without roundtrip?

I want the browser to reflect some other URL than the one used to create the request, but without roundtripping to the server. I would maybe do this: POST /form HTTP/1.1 ... ...and then return: HTTP/1.1 200 OK Location: /hello But that would cause a redirect, the browser will again, request URL /hello. I would like to just tell ...

Why shouldn't data be modified on an HTTP GET request?

I know that using non-GET methods (POST, PUT, DELETE) to modify server data is The Right Way to do things. I can find multiple resources claiming that GET requests should not change resources on the server. However, if a client were to come up to me today and say "I don't care what The Right Way to do things is, it's easier for us to us...

How to do an http get in cocoa on the iPhone

Hi, can anyone paste some code on how to do a simple http get in cocoa? ...

extract data from cocoa http get request

I implemented the following code: NSURL *url = [ NSURL URLWithString:[ NSString stringWithFormat: @"http://www.google.com/search?q=%@", query ] ]; NSURLRequest *request = [ NSURLRequest requestWithURL: url ]; I want to extract the body from what I receive back from the url above. I attempted: NSData *data = [request HTTPBody]; The ...

How do I make the web browser log all activity, including requests, responses, cookie activity, to a log file that I can inspect?

I am debugging a session mismatch problem in a web application. There are several servers involved, and the user is passed between them while holding session tokens and cookies. The coordinating point is the browser. I want to know in detail what actions the browser is taking, basically a client equivalent to the server log. It would ...