ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Aditya Mahajan <adityam@umich.edu>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Downloading long urls
Date: Sun, 16 Jan 2011 00:12:52 -0500 (EST)	[thread overview]
Message-ID: <alpine.LNX.2.01.1101160003420.4635@ybpnyubfg.ybpnyqbznva> (raw)

Hi,

While downloading urls, context santizes the filename but does not check 
the length of the url. So, one can end up with a situation where the 
filename is too long for the operating system to handle. For example, the 
following fails on 32bit linux.

\enabletrackers[resolvers.schemes]
\startluacode
   local report_webfilter = logs.new("thirddata.webfilter")

   local url = 
"http://www.bing.com/search?q=AreallyreallylongstringjusttoseehowthingsworkordontworkAreallyreallylongstringjusttoseehowthingsworkordontworkAreallyreallylongstringjusttoseehowthingsworkordontworkAreallyreallylongstringjusttoseehowthingsworkordontworAreallyreallylongstringjusttoseehowthingsworkordontworkkAreallyreallylongstringjusttoseehowthingsworkordontwork"

   local specification = resolvers.splitmethod(url)

   local file       = resolvers.finders['http'](specification) or ""

   if file and file ~= "" then
     report_webfilter("saving file %s", file)
   else
     report_webfilter("download failed")
   end
\stopluacode

\normalend

Is there a robust way to avoid this problem? One possibility is that in 
data-sch.lua instead of

     local cleanname = gsub(original,"[^%a%d%.]+","-")

use

     local cleanname = md5sum(original)

What do you think?

Aditya

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


             reply	other threads:[~2011-01-16  5:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-16  5:12 Aditya Mahajan [this message]
2011-01-21 17:15 ` Aditya Mahajan
2011-01-21 22:53   ` Hans Hagen
2011-01-22  0:20     ` Aditya Mahajan
2011-01-23 20:22       ` Hans Hagen
2011-01-23 20:34         ` Aditya Mahajan
2011-01-23 20:54           ` Hans Hagen
2011-01-23 21:10             ` Aditya Mahajan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LNX.2.01.1101160003420.4635@ybpnyubfg.ybpnyqbznva \
    --to=adityam@umich.edu \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).