Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6349571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:38:35+00:00 2026-05-24T21:38:35+00:00

First, a bit of context: I’m trying to implement a URL shortening on my

  • 0

First, a bit of context:

I’m trying to implement a URL shortening on my own server (in C, if that matters). The aim is to avoid long URLs while being able to restore a context from a shortened URL.

Currently I have a implementation that creates a session on the server, identified by a certain ID. This works, but consumes memory on the server (and is not desired since it’s an embedded server with limited resources and the main purpose of the device isn’t providing web pages but doing other cool stuff).

Another option would be to use cookies or HTML5 webstorage to store the session information in the client.

But what I’m searching for is the possibility to store the shortened URL parameters in one parameter that I attach to the URL and be able to re-construct the original parameters from that one.

First thought was to use a Base64-encoding to put all the parameters into one, but this produces an even larger URL.

Currently, I’m thinking of compressing the URL parameters (using some compression algorithm like zip, bz2, …), do the Base64-encoding on that compressed binary blob and use that information as context. When I get the parameter, I could do a Base64-decoding, de-compress the result and have hands on the original URL.

The question is: is there any other possibility that I’m overlooking that I could use to lossless compress a large list of URL parameters into a single smaller one?


Update:
After the comments from home, I realized that I overlooked that compressing itself adds some overhead to the compressed data making the compressed data even larger than the original data because of the overhead that for example zipping adds to the content.
So (as home states in his comments), I’m starting to think that compressing the whole list of URL parameters is only really useful if the parameters are beyond a certain length because otherwise, I could end up having an even larger URL than before.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T21:38:37+00:00Added an answer on May 24, 2026 at 9:38 pm

    You can always roll your own compression. If you simply apply some huffman coding, the result will always be smaller (but then base64 encoding it, it’ll grow a bit, so the net effect may perhaps not be optimal).

    I’m using a custom compression strategy on an embedded project I work with where I first use a lzjb (a lempel ziv derivate, follow link for source code, really tight implementation (from open solaris)) followed by huffman coding the compressed result.

    The lzjb algorithm doesn’t perform too well on very short inputs, though (~16 bytes, in which case I leave it uncompressed).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

To first give a little bit of context, my use-case is that my partner
A bit of context is probably necessary first, Basically I've been using the VS2008
First, a bit of context: web.xml: I match all /app/* requests to my dispatcher:
I understand that the first bit is the sign and that the next 8
I'm working on a bit of c# code that first has the user click
First, a little bit of context to explain why I am on the UDP
I have first to explain a little bit my context, then the question: I
I have an entity context that includes three tables. The first is a table
Just first off I'll say that the context here is Actionscript 3.0 (IDE: Flashbuilder)
Context: Windows7 64bit, ActiveDirectory, Windows Server 2003 I'm trying to get the code given

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.