Using gb.web in my own gambas web server

View: New views
6 Messages — Rating Filter:   Alert me  

Using gb.web in my own gambas web server

by guiodic :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Benoit, hi to all.

You kwon I'm the author of BaShare, a simple web server with a GUI useful in file sharing.

I'm trying to implement file reception in BaShare from a web form like this:

<form method='post' action='http://localhost:65001' name='Upload' enctype='multipart/form-data'>
<input name='File' type='file'><br><br><input value='Invia' name='SubBtn' type='submit'><br>
<input type='hidden' name='action' value='upload'>
</form>

So it was very useful if was possible to use gb.web in my application. I tryed this:

PUBLIC SUB Socket_Read()
 
   
    PRINT Request.Fields.Count
   
     TRY LAST.Close
     TRY client.Remove(client.Find(LAST))
 
END

but Request.Fields.Count is 0

The alternative is to parse manually the stream... but is very tedious.

Have you some suggests?

Thank you very much.




Re: Using gb.web in my own gambas web server

by Benoît Minisini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Hi Benoit, hi to all.
>
> You kwon I'm the author of BaShare, a simple web server with a GUI useful
> in file sharing.
>
> I'm trying to implement file reception in BaShare from a web form like
> this:
>
> <form method='post' action='http://localhost:65001' name='Upload'
> enctype='multipart/form-data'>
> <input name='File' type='file'><br><br><input value='Invia' name='SubBtn'
> type='submit'><br>
> <input type='hidden' name='action' value='upload'>
> </form>
>
> So it was very useful if was possible to use gb.web in my application. I
> tryed this:
>
> PUBLIC SUB Socket_Read()
>
>
>     PRINT Request.Fields.Count
>
>      TRY LAST.Close
>      TRY client.Remove(client.Find(LAST))
>
> END
>
> but Request.Fields.Count is 0
>
> The alternative is to parse manually the stream... but is very tedious.
>
> Have you some suggests?
>
> Thank you very much.

As stated in the documentation, gb.web allows you to implement *CGI* scripts,
i.e. executables that are run by the HTTP server and that return the HTTP
response on their standard output stream.

Regards,

--
Benoît

------------------------------------------------------------------------------
_______________________________________________
Gambas-user mailing list
Gambas-user@...
https://lists.sourceforge.net/lists/listinfo/gambas-user

Re: Using gb.web in my own gambas web server

by guiodic :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Benoît Minisini wrote:
As stated in the documentation, gb.web allows you to implement *CGI* scripts,
i.e. executables that are run by the HTTP server and that return the HTTP
response on their standard output stream.

Regards,

--
Benoît
yes, of course. So, the solution could be to make a separate executable which I send the raw stream and receive the output. Is it a good idea in you opinion?

Best regards and thank you.


Re: Using gb.web in my own gambas web server

by Benoît Minisini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Benoît Minisini wrote:
> > As stated in the documentation, gb.web allows you to implement *CGI*
> > scripts,
> > i.e. executables that are run by the HTTP server and that return the HTTP
> > response on their standard output stream.
> >
> > Regards,
> >
> > --
> > Benoît
>
> yes, of course. So, the solution could be to make a separate executable
> which I send the raw stream and receive the output. Is it a good idea in
> you opinion?
>
> Best regards and thank you.

Why shouldn't be a good idea? It depends on what you will do with your CGI
script.

--
Benoît

------------------------------------------------------------------------------
_______________________________________________
Gambas-user mailing list
Gambas-user@...
https://lists.sourceforge.net/lists/listinfo/gambas-user

Re: Using gb.web in my own gambas web server

by guiodic :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Benoît Minisini wrote:
It depends on what you will do with your CGI script.
my CGI must save the file that browser send via the form.


Re: Using gb.web in my own gambas web server

by guiodic :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Well, I wrote the parsing of multipart form. But I have another issue.

I must read from the socket strem and write to a file stream.
But I must insert a pause (a very long pause...). If not, the socket stream ends before the file is written.
I must use SLEEP, not WAIT, because this read/write operation is into a socket_read sub.
Then the GUI freeze.

I think the solution is a separate process.
I would like to use gb.web for it, but I have no idea how to use it in my own "mini-server".

Best regards and thank you in advance.


guiodic wrote:
Benoît Minisini wrote:
It depends on what you will do with your CGI script.
my CGI must save the file that browser send via the form.