Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Archive download request via CFML throws Request Line is too large error.

Alan Holden September 30, 2019

I'm trying the following ColdFusion code in order for our server to periodically download a zip archive of our repo for an executive backup request. Here's the basic code so far (an amalgam based on a lot of StackOverflow solutions I've found):

<cfset user = urlEncodedFormat("[my username]") />
<cfset pass = urlEncodedFormat("[redacted]") />
<cfhttp method="get"
url="https://bitbucket.org/[project]/[repo]/get/[branch].zip"
username="#user#"
password="#pass#"
path="#detinationPath#/"
file="repo.zip"
getasbinary="auto"
timeout="90"
/>

After about 10 seconds, the server records the following response:

Header HTTP/1.1 400 Bad Request Server: nginx Content-Type: text/html Strict-Transport-Security: max-age=31536000; includeSubDomains; preload Date: Tue, 01 Oct 2019 02:26:47 GMT Connection: close Content-Length: 163
Mimetype text/html
Responseheader
Connection close
Content-Length 163
Content-Type text/html
Date Tue, 01 Oct 2019 02:26:47 GMT
Explanation Bad Request
Http_Version HTTP/1.1
Server nginx
Status_Code 400
Strict-Transport-Security max-age=31536000; includeSubDomains; preload
Statuscode 400 Bad Request

The contents of the downloaded "repo.zip" file is the following:

<html>
  <head>
    <title>Bad Request</title>
  </head>
  <body>
    <h1><p>Bad Request</p></h1>
      Request Line is too large (4233 &gt; 4094)
  </body>
</html>

I've tried changing the url attribute so it begins with "https://#user#:#pass#@bitbucket.org" and there's no result until a security block is applied.

The CFML server is not running a Git daemon, and is hosted in a HIPAA compliant location.

Are all of these StackOverflow solutions out of date? Is there a basic problem or misunderstanding with this code, or another solution I can use - which does not involve a large installation for such a simple task?

1 answer

1 accepted

0 votes
Answer accepted
Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 30, 2019

Hello @Alan Holden,

Bitbucket returns this error when the URL is too large, specifically when takes more than 4094 bytes, which effectively means roughly the same number of characters. That's quite a large value. Can you check what exact URL is being fetched by that CFML script? Specifically, does the branch in your script come from some variable which might contain wrong value?

I assume you get the response in a zip because CF packs the response into specified file no matter what response it got. Normally Bitbucket just shows an HTML page: example link (note how huge the URL should be to hit this error).

Hope this helps.

Cheers,
Daniil

Alan Holden October 1, 2019

Thanks @Daniil Penkin 

I appreciate the swift response.

The url was altered only for this post. It is a static string otherwise, and is only 59 characters long. For example, the [branch] is simply 'development'.

You are correct that this CF tag puts the response into the file that I specify. Otherwise it would be contained in a cffile.fileContent element, but essentially the same.

The problem seemed to be in my URL encoding those user and pass variables prior to the request tag. My guess is that <cffile> is probably already encoding those, and further encoding that result may have created some long strings (although I would not have expected the final result to become THAT long!).

Here is the correct usage:

<cfhttp method="get" 
url="https://bitbucket.org/[project]/[repo]/get/[branch].zip"
username="[my username]"
password="[redacted]"
path="#detinationPath#/"
file="repo.zip"
getasbinary="auto"
timeout="[seconds]"
/>
Like Daniil Penkin likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events