<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -367,9 +367,9 @@ module EventMachine
       # correct location header - some servers will incorrectly give a relative URI
       if @response_header.location
         begin
-          location = URI.parse @response_header.location
+          location = Addressable::URI.parse @response_header.location
           if location.relative?
-            location = (@uri.merge location).to_s
+            location = (@uri.join location).to_s
             @response_header[LOCATION] = location
           end
         rescue</diff>
      <filename>lib/em-http/client.rb</filename>
    </modified>
    <modified>
      <diff>@@ -130,6 +130,10 @@ Stallion.saddle :spec do |stable|
         stable.response.status = 401
       end
 
+    elsif stable.request.path_info == '/relative-location'
+      stable.response.status = 301
+      stable.response[&quot;Location&quot;] = '/forwarded'
+
     elsif
       stable.response.write  'Hello, World!'
     end</diff>
      <filename>test/stallion.rb</filename>
    </modified>
    <modified>
      <diff>@@ -432,4 +432,16 @@ describe EventMachine::HttpRequest do
       }
     end
   end
+
+  it &quot;should complete a Location: with a relative path&quot; do
+    EventMachine.run {
+      http = EventMachine::HttpRequest.new('http://127.0.0.1:8080/relative-location').get
+
+        http.errback { failed }
+        http.callback {
+          http.response_header['LOCATION'].should == 'http://127.0.0.1:8080/forwarded'
+          EventMachine.stop
+        }
+      }
+  end
 end</diff>
      <filename>test/test_request.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>40c5fe89226dd93cfb663db1038182114cf132fe</id>
    </parent>
  </parents>
  <author>
    <name>Astro</name>
    <email>astro@spaceboyz.net</email>
  </author>
  <url>http://github.com/igrigorik/em-http-request/commit/9268ba468f2e9798c5c2684c9a7a1ec69f83abe4</url>
  <id>9268ba468f2e9798c5c2684c9a7a1ec69f83abe4</id>
  <committed-date>2009-11-07T15:17:56-08:00</committed-date>
  <authored-date>2009-10-30T19:02:48-07:00</authored-date>
  <message>Addressable::URI compatibility + test

Signed-off-by: Ilya Grigorik &lt;ilya@igvita.com&gt;</message>
  <tree>cb415e77195a09798315e35993bb22e16a067a62</tree>
  <committer>
    <name>Ilya Grigorik</name>
    <email>ilya@igvita.com</email>
  </committer>
</commit>
