// HandleAcquire handles a '600 Acquire URI' message from apt.
//
// This attempts to get a token for the given host and make a request for the
// resource with the cf-access-token headers.
//
// TODO: Figure out what an IMS-Hit indicates, and if that applies to this method
HandleAcquire handles a '600 Acquire URI' message from apt.

This attempts to get a token for the given host and make a request for the
resource with the cf-access-token headers.

Figure out what an IMS-Hit indicates, and if that applies to this method
// HandleAcquire handles a ' 600 Acquire URI ' message from apt . // // This attempts to get a token for the given host and make a request for the // resource with the cf - access - token headers . // // TODO : Figure out what an IMS - Hit indicates and if that applies to this method
func (cfd *CloudflaredMethod) HandleAcquire(msg *Message) {
	requestedURL := msg.Fields["URI"]
	filename := msg.Fields["Filename"]
	uri, err := url.Parse(requestedURL)
	if err != nil {
		cfd.mwriter.StartURI(requestedURL, "", 0, false)
		cfd.mwriter.FailedURI(requestedURL, "", fmt.Sprintf("URI Parse Failure: %v", err), false, false)
		return
	}
	err = cfd.Acquire(uri, requestedURL, filename)
	if err != nil {
		cfd.mwriter.FailedURI(requestedURL, err.Error(), err.Error(), false, false)
	}
}
func ( cfd * CloudflaredMethod ) HandleAcquire ( msg * Message ) { requestedURL := msg . Fields [ " " ] filename := msg . Fields [ " " ] uri , err := url . Parse ( requestedURL ) if err != nil { cfd . mwriter . StartURI ( requestedURL , " " , 0 , false ) cfd . mwriter . FailedURI ( requestedURL , " " , fmt . Sprintf ( " " , err ) , false , false ) return } err = cfd . Acquire ( uri , requestedURL , filename ) if err != nil { cfd . mwriter . FailedURI ( requestedURL , err . Error ( ) , err . Error ( ) , false , false ) } }
HandleAcquire handles a '600 Acquire URI' message from apt.
HandleAcquire handles a ' 600 Acquire URI ' message from apt .
// TODO: Handle empty URI or Filename // This shouldn't happen, but it's best to be absurdly fault tolerant if possible // Have to have started the Acquire before we can fail the acquire