Giter Club home page Giter Club logo

cgibashopts's People

Contributors

colasnahaboo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

cgibashopts's Issues

File is truncated to nothing

Hi, need to run server to make my canon lbp-810 become wifi-printer, using busybox httpd, for cgi i use bash. found this lib, but when i upload pdf file, everything it have is:

%PDF-1.3

when i upload a txt, it is full (tho it is one line, will try something larger...). when i upload a jpeg, it is printing the blank page, will try to analyze the jpeg is it even have something.
so, why does it truncate the pdf to just header?
thanks

Can't get both a file upload and a text input

Hi,

I'm trying to convert a bash script to a CGI. This script takes a file and an text field as inputs.

My form looks like this:

<form method="POST" action="/backend.sh" enctype="multipart/form-data">
  <input type="file" name="file" />                                    
  <input type="text" name="text" />                                    
  <button type="submit">Go</button>                                    
</form>                                                                

On the backend I receive the file properly:

FORMFILE_file=/tmp/cgibashopts-files.8/file
FORMS=file

But I don't receive the text value.

If I remove the file input :

<form method="POST" action="/backend.sh" enctype="multipart/form-data">
  <input type="text" name="text" />                                    
  <button type="submit">Go</button>                                    
</form>                                                                

Then I get the text value:

FORMS=text
FORM_text=dqdfsq
FORMFILES=
FORMQUERY=

Is it possible to handle both? Am I using it a wrong way?

Error at multipart/form-data on CentOS Stream release 8

[version 4.1.1]

# ./tests/tewiba -v
== Sourcing __INIT__
All tests OK ==
# ./tests/RUN-ALL-TESTS
produce no output


POST http://e.com/cgi-bin/TEST HTTP/1.1
Host: e.com
Connection: Keep-Alive
Content-Type: multipart/form-data, boundary=ahp1bnc4hlafmnvyuay783qlh9k1uv76
Content-Length: 2334
Connection: close

--ahp1bnc4hlafmnvyuay783qlh9k1uv76
Content-Disposition: form-data; name="url"

https://some.url
--ahp1bnc4hlafmnvyuay783qlh9k1uv76
Content-Disposition: form-data; name="auth"

a0b50b5db9d
--ahp1bnc4hlafmnvyuay783qlh9k1uv76
Content-Disposition: form-data; name="method"

POST
--ahp1bnc4hlafmnvyuay783qlh9k1uv76
Content-Disposition: form-data; name="send_content_type"

application/xml
--ahp1bnc4hlafmnvyuay783qlh9k1uv76
Content-Disposition: form-data; name="receive_content_type"

application/xml
--ahp1bnc4hlafmnvyuay783qlh9k1uv76
Content-Disposition: form-data; name="json2xml"

Y
--ahp1bnc4hlafmnvyuay783qlh9k1uv76
Content-Disposition: form-data; name="data"; filename="file.xml"
Content-Type: application/xml

<?xml version="1.0" encoding="UTF-8"?><e...e>
--ahp1bnc4hlafmnvyuay783qlh9k1uv76--


source ./cgibashopts
echo "$FORMS"

will output
ahp1bnc4hlafmnvyuay783qlh9k1uv76ContentDispositionformdataname name name name name name name filename

Error at multipart/form-data on Oracle Linux Server release 7.5

[version 4.1.1]

tests/tewiba -v

== Sourcing INIT
== Test file: filefield-runaway.test:
== file field then text field
TEST ERROR file field then text field rest of params gobbled: 1,5d0
< Content-Disposition: form-data; name="foo"
<
< bar
< -----------------------------234854398038784223431883737325--
<
***ERRORS:1
== Test file: form-files.test:
== Form file upload from browser CBOgenf-Chromium62linux
== Form file upload from browser CBOgenf-ff57linux
== Form file upload from browser CBOgenf-ff57W10
== Form file upload from browser CBOgenf-GoogleChrome62W10
== Form file upload from browser CBOgenf-MicrosoftEdge40W10
TEST ERROR Form file upload from browser CBOgenf-MicrosoftEdge40W10 file 5 differ for browser CBOgenf-MicrosoftEdge40W10. See difference from expected to result by: diff /d02/cgi-bin/tests/files-dos2/file5 /tmp/CBOgenf-MicrosoftEdge40W10-file5
== Form file upload from browser CBOgenf-WindowsPhoneLumia
TEST ERROR Form file upload from browser CBOgenf-WindowsPhoneLumia file 5 differ for browser CBOgenf-WindowsPhoneLumia. See difference from expected to result by: diff /d02/cgi-bin/tests/files-dos2/file5 /tmp/CBOgenf-WindowsPhoneLumia-file5
***ERRORS:2
== Test file: form-nofiles.test:
== Form file upload from browser CBOgenf-Chromium62linux
== Form file upload from browser CBOgenf-ff57linux
== Form file upload from browser CBOgenf-ff57W10
== Form file upload from browser CBOgenf-GoogleChrome62W10
== Form file upload from browser CBOgenf-MicrosoftEdge40W10
== Form file upload from browser CBOgenf-WindowsPhoneLumia
== OK
== Test file: form.test:
== Form POST submit from browser CBOgen-Chromium62linux
== Form POST submit from browser CBOgen-ff57linux
== Form POST submit from browser CBOgen-ff57W10
== Form POST submit from browser CBOgen-GoogleChrome62W10
== Form POST submit from browser CBOgen-Microsoft
== OK
== Test file: query-string.test:
== Empty querystring
== Indexed search, legacy
== Single param
== Multiple params
== param function
== urldecode
== OK
== ***** Total tests failed: 3 *****

proper options parsing

Implement option parsing with getopts, so that we can add more customisations in the future

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.