logo       

Re: application/octet-stream and empty fileinputs: msg#00002

Subject: Re: application/octet-stream and empty fileinputs
"Eric Kolve" <ekolve@xxxxxxxxx> writes:

> I noticed that if you submit an HTML::Form that it doesn't set the
> content-type for empty fileinputs to application/octet-stream.  I am not
> sure if this is legal or not.

The reported content type is determined by looking at the file name
extension and if not recongnized by what perl's -T builtin thinks.  On
my system -T regards empty files as text, so empty files are reported
as text/plain.

This program:

 use HTML::Form;
 my $f = HTML::Form->parse(<<EOT, "http://www.example.com";);
 <form method="POST" enctype="multipart/form-data">
   <input name=f value="/dev/null" type="file">
 </form>
 EOT
 print $f->click->as_string;

will for instance print:

 POST http://www.example.com
 Content-Length: 114
 Content-Type: multipart/form-data; boundary=xYzZY

 --xYzZY
 Content-Disposition: form-data; name="f"; filename="/dev/null"
 Content-Type: text/plain


 --xYzZY--

Your message seems to indicate that you get no Content-Type at all.
Please provide some example code that demonstrates how you use the
module.

>                                  I compared dumps of firefox vs. LWP and it
> looks like firefox does set the content-type even if you don't have anything
> for the input stream.  I suppose since the content is empty you *SHOULDN'T*
> have to set a content-type, but I am curious to hear opinions on whether
> this should be changed.

If you find differences that make real world applications break with
LWP that works with Firefox then I would certainly like to fix LWP.

Regards,
Gisle



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
audio.irate.dev...    yellowdog.gener...    ietf.ips/2002-0...    xfree86.fonts/2...    busybox/2003-07...    emacs.jdee/2004...    linux.mandrake....    hardware.microc...    user-groups.lin...    science.analysi...    version-control...    db.filemaker.de...    cluster.openmos...    mail.eyebrowse....    text.xml.xerces...    kde.devel.kwrit...    finance.moneyda...    gcc.regression/...    network.routing...    os.freebsd.deve...    recreation.radi...    qnx.openqnx.dev...    python.xml/2002...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe