Blitzy logo
OverviewUse-casesSecurity
Company
DocsBlogVideos
Pricing
OverviewUse-casesSecurity
Company
DocsBlogVideos
Pricing

C to Rust Refactor in 5 Days: Blitzy Autonomously Rewrote curl

Mar 17, 2026 • Michael Montanaro • 6 min read

C to Rust Refactor in 5 Days: Blitzy Autonomously Rewrote curl

640 Engineering Hours. 215,000 LoC. 7,312 Tests. Here's How.

In our first Blitzy Open Source Initiative post, we refactored dnsmasq from C to Rust: 86,000 lines with zero compilation errors.

This time, we went after curl, the most widely deployed data transfer tool in computing history.

curl ships in every Linux distribution, every macOS install, every Windows 10+ machine. curl is baked into cars, televisions, game consoles, and roughly ten billion software installations worldwide.

Refactoring curl in Rust is the kind of project that senior systems engineering teams estimate at 12 to 18 months. Everyone agrees it should be done. Nobody wants to do it.

Why curl?

The White House Office of the National Cyber Director called on the software industry to adopt memory-safe programming languages. The Cybersecurity and Infrastructure Security Agency (CISA) went further, calling development of new critical infrastructure software in C or C++ "dangerous and significantly elevating risk to national security."

curl falls directly under that guidance. Its C codebase carries every memory safety risk that Rust's ownership system eliminates:

  • Buffer overflows in protocol parsing
  • Use-after-free vulnerabilities in connection handling
  • Data races in multi-handle operations

These are the exact vulnerability classes responsible for 70% of CVEs in systems software.

Deep Codebase Understanding: Tech Spec

Before writing any Rust, Blitzy ingested and analyzed the entire curl 8.19.0-DEV C codebase and created a detailed technical specification:

  • 179 core library source files, 144,333 lines of code covering the transfer engine, connection cache, protocol handlers, and utility modules
  • 43 CLI source files, 19,344 lines handling argument parsing, configuration, callbacks, and output formatting
  • 7 TLS backends (OpenSSL, Schannel, GnuTLS, mbedTLS, wolfSSL, rustls, Apple Security Transport), all replaced by a single rustls implementation
  • 3 QUIC/HTTP3 backends (ngtcp2, quiche, OpenSSL QUIC), replaced by quinn + h3
  • 2 SSH backends (libssh, libssh2), replaced by russh
  • 106 public API symbols (CURL_EXTERN) that downstream C programs link against, every one requiring exact signature parity

The analysis also surfaced gaps that would trip up a less thorough approach: roughly 350 configuration directives with implicit behavioral contracts, C #ifdef conditional compilation that needed to map to Cargo feature flags, and a hand-rolled poll()-based event loop with manual state machines across every protocol handler.

What Blitzy Built

See our pull request and our project guide that recaps the work. Here are the numbers:

  • 640 engineering hours (80 work days) of autonomous development in 5 days by parallelizing work across specialized agents
  • 215,153 lines of production Rust code across 155 source files, organized in a 3-crate Cargo workspace
  • 7,312 tests (6,023 library, 833 CLI, 343 FFI, 113 doc tests) with a 100% pass rate. Zero compilation errors. Zero clippy warnings under strict mode.
  • Miri validation passed with zero memory safety violations across 1,500+ non-FFI tests
  • AddressSanitizer validation passed with zero violations across 7,012 tests including the FFI boundary
  • 80.05% line coverage on protocol and transfer modules
  • An 8.6 MB release binary and a 7.1 MB shared library exporting 100 curl_ function symbols*
  • Zero unsafe blocks outside the FFI crate
  • Clear project guide for the remaining work for humans to complete and deploy

The architectural decisions matter as much as the volume. Consider TLS. The C version of curl supports seven different TLS backends (OpenSSL, Schannel, GnuTLS, mbedTLS, wolfSSL, rustls, and Apple Security Transport), each with its own initialization, session management, and certificate validation code. That is seven surfaces for security bugs. The Rust version replaces all of them with a single rustls implementation: pure Rust, no C TLS library linkage at any build configuration.

C (one of seven TLS backends):

/* OpenSSL backend, manual session management */
SSL_CTX *ctx = SSL_CTX_new(TLS_client_method());
SSL *ssl = SSL_new(ctx);
SSL_set_fd(ssl, sockfd);
SSL_connect(ssl); // handshake, manual error checking
// ... who frees what? when? what if SSL_connect fails?
SSL_free(ssl);
SSL_CTX_free(ctx);

Rust (single backend, compiler-enforced safety):

// rustls: one backend, ownership-managed lifecycle
let config = rustls::ClientConfig::builder()
    .with_root_certificates(root_store)
    .with_no_client_auth();
let conn = rustls::ClientConnection::new(config, server_name)?;
// Connection cleaned up automatically when it goes out of scope
// TLS errors are Result<T, E>, the compiler won't let you ignore them

Seven backends with manual memory management become one backend with compiler-enforced safety. Error handling moved from C's silently ignorable return codes to Rust's Result<T, E> type, where the compiler refuses to let you skip an error check.

Performance Improvements

Startup and local transfers are 2-4x faster than system curl. Static linking eliminates the ~30 shared library loads the C version requires at launch.

CPU-bound internals hold up too:

Benchmark Throughput
Gzip decompression 4 GiB/s
SHA-256 hashing 2 GiB/s (hardware SHA extensions)
Base64 encoding 2.24 GiB/s

Remaining Work

HTTPS to the open internet is currently ~1.5x slower due to missing TLS session resumption, and 11 CLI flags (like -L, -d, -H, --compressed) are parsed but not yet wired to the transfer layer. These are scoped, well-understood gaps in plumbing, not logic. The foundation is solid.

What This Means for curl Users

curl runs on billions of devices, and every one of them inherits the memory safety risks baked into its C codebase. Buffer overflows in DNS parsing, use-after-free bugs in connection reuse, data races under concurrent transfers: these are the vulnerability classes that attackers actively exploit in production infrastructure.

A Rust refactor eliminates them at compile time. For users, that means fewer emergency patches, fewer CVEs to triage, and a fundamentally smaller attack surface on every router, server, and embedded device running curl. The 2-4x startup improvement and static linking also simplify deployment in containerized and embedded environments where dependency management is already a pain point. This is not an incremental improvement. It is a category change in how safe and deployable curl can be.

What's Next

curl was our second open source project, and significantly more complex than the first. With the launch of Blitzy Platform 4.0, we plan to push the boundaries of autonomous software development with each post.

To stay current on Blitzy's Open Source Initiative, follow us on LinkedIn.

More from the blog

View all
How Blitzy Optimized Our GTM Team

How Blitzy Optimized Our GTM Team

Jun 04, 2026 • Carly Levinsohn • 3 min read

A Quick Blitzy Chat:  3 Codebases’ Takes on Prompting

A Quick Blitzy Chat: 3 Codebases’ Takes on Prompting

May 28, 2026 • Carly Levinsohn • 7 min read

Frequently asked questions

What is Blitzy?

toggle button

Blitzy enables development teams to transform six-month software projects into six-day turnarounds using Blitzy OS, an agentic platform that enables thousands of AI Agents to 'think' and cooperate for hours to bulk build software with precision. The platform builds everything AI can deliver in a precise manner, around 80% of any roadmap or new product, supplemented with a human engineering guide to complete the remaining 20% needed for production. With over 27 patents and counting, Blitzy is actively hiring PhDs and senior developers in Cambridge, MA who have a passion for building AI that leverages 'System 2 Thinking' to solve problems at inference.

Who is Blitzy for?

toggle button

Enterprises that aim to dramatically accelerate their software development velocity, development agencies with enterprise clients, development teams with complex existing products, and individuals looking to accelerate their own velocity on complex builds.

How does Blitzy's technology work?

toggle button

Our patent-pending code ingestion framework maps a curated selection of robust, reliable, and secure open source software libraries that we track by version and update frequently. Combined with our proprietary code generation technology that specializes on enforcing enterprise-class software policies, Blitzy far exceeds the utility of typical chatbots and co-pilots in creating production-ready software at scale.

Is Blitzy a coding co-pilot?

toggle button

Nope. Blitzy surpasses traditional co-pilots with its ability to autonomously generate nearly-complete code repositories, not just snippets. It features a daily-refreshed knowledge base, avoiding the pitfalls of outdated information. Blitzy's proprietary codebase representation system enables deep understanding of generated code, offering highly contextual and relevant suggestions for your entire repository.

What's my role in Blitzy's development process?

toggle button

Your team is responsible for bringing the requirements, and as an approver during the technical specification stage. We ask you to edit/approve the Technical Specification. The document is editable, so you can edit and approve to get exactly what you had in mind.

How does Blitzy decide which tasks to delegate to human developers?

toggle button

Blitzy's multi-agent system is meticulously and rigorously trained to know what it can accomplish, and what needs to be left for the human engineers. This ensures you only receive quality code and have a clear picture of remaining tasks.

Does Blitzy do more than just autonomous code generation?

toggle button

Yes. Blitzy is a comprehensive platform that provides end-to-end development assistance. We support the entire development lifecycle by taking descriptive inputs and generating software requirements documents, technical design, code structure, and generative code within repos for your product.

Is this high quality and secure?

toggle button

Quality and security matter deeply to us — and they were our biggest frustration with the copilots already on the market. That frustration is what led us to build something different: a system designed to meet enterprise standards from the start. Every piece of work passes through multiple QA agents that review each other's output before any code reaches you, so what you receive is held to a consistent quality bar rather than the variable output typical of single-pass code generation. We deliver production-grade code repositories. As with any code entering your environment — written by humans or AI — your team should still run its own QA, QC, and security testing before deployment. We build to a high standard and give your reviewers a strong starting point; final validation stays with the team that owns the production environment.

What is the typical cost of your solution?

toggle button

Blitzy uses a two-phase pricing model: evaluation followed by deployment. This structure lets enterprises validate ROI at their preferred scale before committing to organization-wide implementation. The evaluation phase provides three options. Reverse Engineer ($0) offers an initial assessment with complete codebase reverse engineering and understanding up to 100K lines of code; Proof of Concept ($50K for a 2-month term), where Blitzy delivers a guided POC to demonstrate value; or Structured Pilot ($250K for a 6-month term), which fully deploys Blitzy in your environment with 5M lines onboarding and 1.25M lines generation to prove production readiness. Following successful evaluation, organizations choose between three deployment paths. Commercial ($500K typical investment per year) adopts Blitzy on one team to accelerate a defined initiative: the first 20M lines onboarded are included, with additional onboarding at $0.10 per line and generation at $0.20 per line starting at 2.5M lines, plus dedicated infrastructure and SAML-SSO. Enterprise ($5M typical investment per year) rolls Blitzy out across your engineering organization, with onboarding billed at $0.10 per line across the full codebase — a typical engagement onboards 50M lines — and generation at $0.20 per line as needed, adding a Dedicated AI Solutions Consultant, 2 Forward Deployed Engineers, org-wide onboarding and certification, and priority support. Transformation ($50M typical investment per year) supports your largest codebases, with a typical engagement onboarding 500M lines at the same per-line rates, custom deployment, and embedded teams including a Field CTO, a Dedicated AI Solutions Consultant, 6 Forward Deployed Engineers, and 2 Forward Deployed Designers for complete digital transformation. All tiers maintain SOC 2 Type II compliance, ISO 27001 certification, and guarantee no training on your code. Pricing follows a transparent two-rate model: $0.10 per line onboarded for reverse engineering and $0.20 per line generated for forward engineering. Because reverse engineering also produces complete technical documentation of your codebase, onboarding-only engagements are fully supported, and in every tier costs align directly with the value delivered.

After submitting my prompt, Blitzy added functionality in my tech spec that I did not expect. What do I do?

toggle button

The system defaults to taking advantage of all technology upgrades when modernizing or upgrading to the latest technology stack. For example, if you specify an upgrade to Java 21, the system will by default implement virtual threads, as it's generally seen as a superior technical approach. If you do not want this, you must simply tell the system to 'make as few changes as possible to achieve the desired request'. Being as specific as possible about what functionality is (and is not) desired helps yield results that will align with expectations.

What do Blitzy agents rely on as a source of truth to represent my existing codebase?

toggle button

Blitzy agents rely on the actual source code of your existing codebase—not the Tech Spec documentation—when performing refactors or extending functionality. However, an accurate Tech Spec significantly aids the system's efficiency in querying the underlying representation of the code. Therefore, investing time to ensure the Tech Spec reflects the core features of the application will yield expectation-aligned results and will save time with last-mile development.

Can Blitzy work with existing products and code bases?

toggle button

Yes! Blitzy excels at working with existing codebases, using them as a foundation to ensure consistent, high-quality development. The platform enables you to add new features to existing products, generate comprehensive documentation, and tackle technical debt by upgrading legacy systems to state-of-the-art technologies or refactoring complex codebases. Our platform deploys dedicated AI agents that map and understand your codebase before generation, ensuring intelligent, contextualized development that aligns with your existing patterns and standards.

What programming languages does Blitzy support?

toggle button

Blitzy's AI platform works with all programming languages.

How should I structure my prompts for Blitzy?

toggle button

Structure and organization are crucial when prompting Blitzy. The most effective prompts follow our prompting template with clear sections for WHY (vision & purpose), WHAT (core requirements), and HOW (technical details, user experience & implementation priorities). Each section should be detailed but concise, focusing on essential information while providing relevant context. Including structured frameworks and concrete examples - like data models, user stories, or feature templates - helps Blitzy deliver more precise and purposeful solutions.

What information does Blitzy need to compile and run my code?

toggle button

During code generation, Blitzy compiles your codebase and performs runtime validation to ensure the generated code works correctly. To enable this, we require: (1) Internal dependencies - any private packages, libraries, or binaries not publicly available that your code needs to build and run, (2) Environment variables and secrets - API keys, credentials, and configuration values required for compilation and runtime (shared securely through our encrypted UI, never exposed to AI agents), and (3) Build instructions - the specific steps or scripts needed to compile your code, typically found in your README or setup documentation. This information allows Blitzy to replicate your development environment and verify that all generated code functions properly before delivery.

How can I exclude certain files or folders from Blitzy's code generation?

toggle button

Create a .blitzyignore file in your repository's root directory to specify which files or paths Blitzy should exclude during tech-spec generation and code generation. This works similarly to .gitignore - simply list the file patterns, directories, or specific files you want Blitzy to skip, using standard gitignore syntax like *.log, /build/, or config/secrets.json. To ensure Blitzy respects these exclusions, mention in both your codebase context prompt and target state prompt that Blitzy should reference the .blitzyignore file and exclude those paths from processing.

Can I cancel my project/job (code gen) once in progress?

toggle button

At this time, jobs are not cancelable. Once you submit, it consumes the assigned quota.

Build enterprise software in days, not months.

Start buildingTalk to an expert
Blitzy

Blitzy

One Kendall Square,

Cambridge,

MA 02139

© 2026 Blitzy. All rights reserved

Product

  • Overview
  • Use-cases
  • Security
  • Pricing

Company

  • About us
  • Careers

Support

  • Help
  • Service status
  • Trust center

Resources

  • Docs
  • Blog
  • Videos

Social

  • YouTube
  • LinkedIn

Legal

  • Terms of use
  • Privacy policy