Detect if the remote server is really Hudson.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@17605 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2009-04-29 04:46:14 +00:00
1 parent 66a340105b
commit bb4ccdad87
2 files changed
+4 -3

No files matched your search

@@ -1,8 +1,5 @@
package hudson.cli;
import hudson.cli.SequenceOutputStream.Block;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -45,6 +42,9 @@ public class FullDuplexHttpStream {
con.addRequestProperty("Side","download");
con.getOutputStream().close();
input = con.getInputStream();
// make sure we hit the right URL
if(con.getHeaderField("Hudson-Duplex")==null)
throw new IOException(target+" doesn't look like Hudson");
// client->server uses chunked encoded POST for unlimited capacity.
con = (HttpURLConnection) target.openConnection();