cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Long URLs (up to 1000 characters) - should I worry?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 14 Jan 2011 11:51:18 +0100 (CET)

On Fri, 14 Jan 2011, Felix E. Klee wrote:

> The new web-service, though, requires sending the request XML encoded, and
> in a strange way: The XML is the content of a parameter called "xml". The
> demo application provided by the web-service provider uses POST to send the
> request. However, implementing POST requests would require a major redesign
> of our current application. So, I tried if I can send the request via GET.
> And, I'm lucky: It works!
>
> That GET URL looks like this, and it will *always* be below 1000 characters:
>
> http://xml.example.com/?xml=%3C%3Fxml+version...
>
> The client is always "libcurl" and the server is also clearly defined.
>
> So, I shouldn't be worried about the long URL - right?

Correct!

libcurl has _no_ length limit in the URL at all so you can in fact send as
long URLs as you want. Your system memory is the only limiter, as libcurl will
strdup() the URL and it will build the request in a malloc'ed memory area
before it is sent off.

You should however be cautioned that every web server software I know of have
a limit to what maximum length URL they accept, and that limit tends to be in
the 5K area or so.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2011-01-14