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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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

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

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
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

1,926 views 0 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you