House Republican leaders are within striking distance of securing enough GOP votes to pass a stopgap spending bill to prevent a government shutdown, which would shift the funding fight to the Senate.

But they aren't out of the woods just yet. Many members of the House Freedom Caucus are vowing to oppose the spending measure unless leadership commits to putting a conservative immigration bill on the floor and boosting defense spending, which could make Thursday's floor vote on the continuing resolution (CR) a nail-biter.

Still, rank-and-file lawmakers and GOP leaders alike expressed confidence throughout Wednesday that their party would find the votes necessary to carry their legislation through the House.

Rep. Mark Walker (R-N.C.), chairman of the Republican Study Committee, estimated in the afternoon that the whip count for the short-term funding bill was "somewhere between 210 and 215" votes.

Leadership can only afford to lose 21 Republican votes and pass the funding bill without Democratic support, according to the majority whip's office.

The House CR, which would fund the government through Feb. 16, includes a six-year extension of funding for the Children's Health Insurance Program (CHIP). It would also delay three ObamaCare taxes, something that was added to attract more conservative support.

"There's still some work to do, but I think it will pass," Rep. Tom Cole (R-Okla.), a top appropriator, said Wednesday.

Passage of the bill would shift pressure from House Republicans to Senate Democrats in the shutdown fight.

While Senate Democrats have been taking a tough line, it could be hard for the party to block a bill that was passed out of the House and includes CHIP funding.

Democratic senators up for reelection in red states are particularly wary of forcing a government shutdown over immigration.

The White House expressed support for the House's continuing resolution Wednesday, which could help sway some undecided Republicans.

Speaker Paul Ryan (R-Wis.) and his top lieutenants feel they are moving in the right direction, but they have little room for error as most Democrats are vowing to oppose any spending bill that doesn't include relief for immigrants who came to the United States illegally as children.

Leaders gave themselves a safety valve in case things don't go according to plan on Thursday. late Wednesday evening, the House Rules Committee granted lawmakers the authority through Saturday to bring any bill to the floor the same day that it is considered by the Rules panel - a process meant to speed up a measure's consideration in the House.

Chief Deputy Whip Patrick McHenry (R-N.C.), who is acting as the GOP's top vote counter this week, was seen furiously working the House floor Wednesday night rounding up the votes for the continuing resolution. He huddled with Freedom Caucus members, House Armed Services Committee members and Rep. Carlos Curbelo (R-Fla.).

The Freedom Caucus, a group of roughly 30 conservative hard-liners, has railed against the short-term funding patch - the fourth since September - and expressed skepticism over broader immigration negotiations on Capitol Hill.

Some Freedom Caucus lawmakers are putting pressure on leadership to pass an immigration measure authored by Judiciary Committee Chairman Bob Goodlatte (R-Va.) and Freedom Caucus member Raúl Labrador (R-Idaho) in exchange for their support on the CR.

"We're making progress, yet still, at this point, if the vote were to happen today, there's not the votes to fund it with Republican-only votes," said Rep. Mark Meadows (R-N.C.), chairman of the House Freedom Caucus, as he emerged from a meeting with McHenry in the Speaker's office on Wednesday evening.

The Goodlatte legislation, which has attracted support from both the conservative and moderate wings of the GOP conference and has buy-in from key committee chairmen, includes more conservative immigration priorities than are expected to be included in any bipartisan deal on the Obama-era Deferred Action for Childhood Arrivals (DACA) program.

"We don't wanna get rolled by the Senate on DACA and the budget," said Freedom Caucus member Rep. Dave Brat (R-Va.).

Homeland Security Committee Chairman Michael McCaul (R-Texas), another lead sponsor on the Goodlatte bill, said a commitment from leadership on his immigration bill could help win more support for the stopgap bill.

"That certainly would help, in terms of whipping votes on the CR," McCaul said.

But leadership, while supportive of the Goodlatte approach, has so far resisted calls to put the bill on the floor. It's unclear whether the legislation could pass the House, and even if it does, it's likely dead on arrival in the Senate. There is also concern the vote could roil the sensitive, high-level negotiations on a bipartisan DACA deal.

"We're working on the Goodlatte bill," said Majority Leader Kevin McCarthy (R-Calif.), when pressed by The Hill on whether leadership has committed to a floor vote yet.

Some Freedom Caucus members are also pushing leadership to fund the Pentagon at higher levels for the rest of the 2018 fiscal year and pass a short-term CR for the rest of the government - an idea favored by some defense hawks, but that went nowhere during the previous debate over a CR.

Both Reps. Bradley Byrne (R-Ala.) and Liz Cheney (R-Wyo.), two members of the House Armed Services Committee, said Tuesday night they may vote against the CR because it harms military readiness and puts U.S. troops at risk.

Meadows acknowledged that a full year of funding for the Pentagon is unlikely to be added to the CR at this point, but said money for defense spending anomalies and a pay raise for the troops could help sway some members into the "yes" column.

If some Freedom Caucus members band together with enough defense hawks, they could tank GOP leadership's strategy to avert a government shutdown.

Other Republican votes could also be hard to get. Curbelo has also threatened to vote against the CR without a DACA deal in place, while Rep. Thomas Massie (R-Ky.) is a perennial "no" vote on short-term funding bills.

Still, GOP leadership may be able to pass the funding bill without boosting defense spending or promising a vote on Goodlatte's immigration bill.

A Republican leadership aide said that vote counters were pleased with where things stood as of Wednesday evening, noting that conversations were still ongoing.

The growing sense is that most of the GOP conference will end up grudgingly supporting the CR because it's better than the alternative, which would either be shutting down the government or giving leverage to House Minority Leader Nancy Pelosi (D-Calif.).

And Rep. Gerry Connolly (D-Va.), who represents a large swath of the federal workforce, told WJLA he would ultimately support the CR if he were the decisive vote to keep the government open. Rep. Henry Cuellar (D-Texas) expressed a similar sentiment.

"We'll build support, and we'll get there. We always get there," Rep. Frank Lucas (R-Okla.), a member of the Republican whip team, told reporters Wednesday morning. "Sometimes, some of my friends want to make it more exciting than it has to be."

House Republicans may also be eager to hand off the political football to the Senate, where the fate of a CR is less certain. Sen. Lindsey Graham (R-S.C.) vowed to oppose a CR, while Sen. Jeff Flake (R-Ariz.) is undecided, meaning support from at least 10 Democrats will be needed to overcome a filibuster.

Senate Majority Leader Mitch McConnell (R-Ky.) said the House continuing resolution seems like it should be "a rather attractive package" for Democrats.

"I'm certainly going to take up what the House sends us. The Democrats in the Senate have been very consistent in clamoring for addressing the children's health care program. This does it with a six-year reauthorization," McConnell said.

"I believe we have a good chance of passing it," he said.

Scott Wong, Mike Lillis, Jordain Carney and Alex Bolton contributed.