提交 bb4ccdad 编写于 作者: K kohsuke

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
上级 66a34010
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();
......
......@@ -2712,6 +2712,7 @@ public final class Hudson extends Node implements ItemGroup<TopLevelItem>, Stapl
requirePOST();
UUID uuid = UUID.fromString(req.getHeader("Session"));
rsp.setHeader("Hudson-Duplex",""); // set the header so that the client would know
final Authentication auth = getAuthentication();
FullDuplexHttpChannel server;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册