Browse code

Merge branch 'master' of ssh://github.com/dotcloud/docker

Solomon Hykes authored on 2013/06/15 03:58:46
Showing 2 changed files
... ...
@@ -328,7 +328,7 @@ func (r *Registry) PushRegistryTag(remote, revision, tag, registry string, token
328 328
 	return nil
329 329
 }
330 330
 
331
-func (r *Registry) PushImageJSONIndex(remote string, imgList []*ImgData, validate bool) (*RepositoryData, error) {
331
+func (r *Registry) PushImageJSONIndex(remote string, imgList []*ImgData, validate bool, regs []string) (*RepositoryData, error) {
332 332
 	imgListJSON, err := json.Marshal(imgList)
333 333
 	if err != nil {
334 334
 		return nil, err
... ...
@@ -347,6 +347,9 @@ func (r *Registry) PushImageJSONIndex(remote string, imgList []*ImgData, validat
347 347
 	req.SetBasicAuth(r.authConfig.Username, r.authConfig.Password)
348 348
 	req.ContentLength = int64(len(imgListJSON))
349 349
 	req.Header.Set("X-Docker-Token", "true")
350
+	if validate {
351
+		req.Header["X-Docker-Endpoints"] = regs
352
+	}
350 353
 
351 354
 	res, err := r.client.Do(req)
352 355
 	if err != nil {
... ...
@@ -364,7 +367,9 @@ func (r *Registry) PushImageJSONIndex(remote string, imgList []*ImgData, validat
364 364
 		req.SetBasicAuth(r.authConfig.Username, r.authConfig.Password)
365 365
 		req.ContentLength = int64(len(imgListJSON))
366 366
 		req.Header.Set("X-Docker-Token", "true")
367
-
367
+		if validate {
368
+			req.Header["X-Docker-Endpoints"] = regs
369
+		}
368 370
 		res, err = r.client.Do(req)
369 371
 		if err != nil {
370 372
 			return nil, err
... ...
@@ -503,7 +503,7 @@ func (srv *Server) pushRepository(r *registry.Registry, out io.Writer, name stri
503 503
 		srvName = fmt.Sprintf("src/%s", url.QueryEscape(strings.Join(parts, "/")))
504 504
 	}
505 505
 
506
-	repoData, err := r.PushImageJSONIndex(srvName, imgList, false)
506
+	repoData, err := r.PushImageJSONIndex(srvName, imgList, false, nil)
507 507
 	if err != nil {
508 508
 		return err
509 509
 	}
... ...
@@ -527,7 +527,7 @@ func (srv *Server) pushRepository(r *registry.Registry, out io.Writer, name stri
527 527
 		}
528 528
 	}
529 529
 
530
-	if _, err := r.PushImageJSONIndex(srvName, imgList, true); err != nil {
530
+	if _, err := r.PushImageJSONIndex(srvName, imgList, true, repoData.Endpoints); err != nil {
531 531
 		return err
532 532
 	}
533 533
 	return nil