Jump to content

the DtTvB's AutoIt Web Server


the DtTvB
 Share

Recommended Posts

Guest JRowe_1

Of course, me playing any more with it would require me knowing how to forward a port internally through the network, which is beyond me at this point in time.

anyway, I'll have a local version of this running soon, I've already looked into displaying some of my own pages, it seems to work just fine ;)

Link to comment
Share on other sites

  • Replies 171
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

piccaso: I would like to give you a huge thanks for helping, but posting here is too annoying, so here you go! thanks.htmlI got a lot of knowledge from you!

thenewkid: I updated the first post with some manuals.

Link to comment
Share on other sites

for the pre-rpocessor, im making some UDFs just like the autoit gui functions exept these ones will allow you to easly make stuff in the web browser, that will be outputted by the server to the end user.

Link to comment
Share on other sites

I don't mean to be stupid...

how should i know?

no really, i didnt understand your request so i answered just something basic ;)

if you still need info on something specific just ask...

I would like to give you a huge thanks for helping, but posting here is too annoying, so here you go! thanks.htmlI got a lot of knowledge from you!

your welcome :lmao:

Actually i have to thank you.

I allways wanted to write a http server in autoit but never was motivated enough to start it.

so i hope you dont mind when i continue contributing.

and here is a list of things i would like to do in the near future:

  • 'Connection: Close' Should be in the Reply if i understand the rfc's right
  • Maybe Resume support. the Range Header looks tricky but maybe..
  • put the pre into the Preprocessor and support '<?au3 ?>' tags based on extension like:

    • au3,a3x -> Process as Usual
    • au3s -> syntax highlighting
    • ahp,aha,... Preprocess
  • Max Execution time for scripts
  • script output in a seperate thread
are you sure you don't want to get familiar with subversion?

it ain't that hard :evil:

CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map
Link to comment
Share on other sites

Ive been coding POST into the web server. I figured out that it errors bad when a POST is sent.

Link to comment
Share on other sites

Ive been coding POST into the web server. I figured out that it errors bad when a POST is sent.

POST is not implemented yet.

or is it that what you are trying to do? implementing post?

I could code in max execution time really quickly if anyone wants me to...

i know you can do that ;)

how about supporting <? ?> tags?

do you want to do that too?

i am going to setup a svn repository anyway, and if its just for me...

if someone wants to use it too pn me your email OR preferred login/pass

CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map
Link to comment
Share on other sites

As Chip said, the script will error when sending the POST request, which is too hard for me to handle.

About <? tags, it's a good idea also..... Please use <?au3, not just <?, because it should confuse with <?xml or <?php

And having SVN is a really good idea!

Connection: Close, wow, I forgot about this!

Link to comment
Share on other sites

POST is just for cgi right?

but what should happen when someone uses POST on a static page?

act like get or throw an error?

... these rfc's are hard to read ;)

@spyrorocks

did you read that

hope it isn't to late...

post should be ignored if used on a static page, I think.

By the way, if you need help implementing cgi, just look at my web-based autoit, which is cgi complient. Unless of course you already found the info for it.

Just do everything the reverse of how my UDFs do it.

The entire query, everything after the url, including the question mark, in raw form, should be sent to

EnvSet ("QUERY_STRING", $query)

As for POST, you need to write the raw POST data in the same form as get (maybe without the question mark, not sure) to ConsoleWrite. And EnvSet ("CONTENT_LENGTH") to the length of the POST data.

here is a full list of env vars in cgi. Have fun :lmao:

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
Share on other sites

damn that's a bunch off variables to do...

so i wrote a header parser ;)

but it looks awful.

any idea how this could be done with regex?

Dim $sHeaders, $aHeaders

$sHeaders &= "GET /shadowright.gif HTTP/1.1" & @CRLF
$sHeaders &= "Host: 127.0.0.1:27643" & @CRLF
$sHeaders &= "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1) Gecko/20061010 Firefox/2.0" & @CRLF
$sHeaders &= "Accept: image/png,*/*;q=0.5" & @CRLF
$sHeaders &= "Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3" & @CRLF
$sHeaders &= "Accept-Encoding: gzip,deflate" & @CRLF
$sHeaders &= "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7" & @CRLF
$sHeaders &= "Keep-Alive: 300" & @CRLF
$sHeaders &= "Connection: keep-alive" & @CRLF
$sHeaders &= "Referer: http://127.0.0.1:27643/" & @CRLF & @CRLF

$aHeaders = StringSplit($sHeaders, @CRLF, 1)

ConsoleWrite(_GetHeader($aHeaders, "user-agent:"))

; ---
Func _GetHeader($aHeaders, $sHeader)
    Local $iSize = StringLen($sHeader)
    $sHeader = StringUpper($sHeader)
    For $i = 0 To UBound($aHeaders) - 1
        If StringUpper(StringLeft($aHeaders[$i], $iSize)) = $sHeader Then _
            Return StringStripWS(StringMid($aHeaders[$i], StringInStr($aHeaders[$i], $sHeader) + $iSize), 1 + 2)
    Next
    Return SetError(1, 0, "")
EndFunc
CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map
Link to comment
Share on other sites

I got my POST working, although the way i coded it is disgusting. ;)

When I clean it up, I'll post it. (Get it POST it) lol

Link to comment
Share on other sites

For header processing, I would split the entrie header into lines.

Then, go through each line. Call a function to check string.

That function would check if the string starts with [argument]:

Then trim the value. And if it does match, it should set the global variables.

Link to comment
Share on other sites

Hello, I made a really simple GUI for this web server.

you may download it from there: WebServer.zip

Edited by Dhilip

[u]My Projects[/u]:General:WinShell (Version 1.6)YouTube Video Downloader Core (Version 2.0)Periodic Table Of Chemical Elements (Version 1.0)Web-Based:Directory Listing Script Written In AutoIt3 (Version 1.9 RC1)UDFs:UnicodeURL UDFHTML Entity UDF[u]My Website:[/u]http://dhilip89.hopto.org/[u]Closed Sources:[/u]YouTube Video Downloader (Version 1.3)[quote]If 1 + 1 = 10, then 1 + 1 ≠ 2[/quote]

Link to comment
Share on other sites

For header processing, I would split the entrie header into lines.

Then, go through each line. Call a function to check string.

That function would check if the string starts with [argument]:

Then trim the value. And if it does match, it should set the global variables.

I've already done this but my code needs serious improvement.

It gives post, get and cookie support, however.

It's not fully compatible with web.au3.

For example GET and POST vars become GQUERY_STRING and PQUERY_STRING

Note that _EnvSet() is a function, it can be integrated seamlessly.

Just put it after you got $recv :

$recv = _SockRecv($sock)
_EnvSet()oÝ÷ Ø:'ßÛ_¢¸¶Ú+zÇ­²z{ïj»"~z-Ê°Yaj÷¡×¶¦zÖ¬º«Zj[²È¨
Úvæ­y×(ºW[yû§j[a¢è!")zØb³¥¥¤
s¡«­¢+ÙÕ¹}¹ÙMÐ ¤(%¹ÙMÐ ÅÕ½Ðí
=9Q9Pµ19Q ÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì¤(%¹ÙMÐ ÅÕ½ÐíAEUIe}MQI%9ÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì¤(%¹ÙMÐ ÅÕ½ÐíEUIe}MQI%9ÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì¤(%¹ÙMÐ ÅÕ½Ðí!QQA}
==-%ÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì¤(%¹ÙMÐ ÅÕ½ÐíI
XÅÕ½Ðì°ÀÌØíÉؤ(%¹ÙMÐ ÅÕ½ÐíI5=Q}HÅÕ½Ðì°M½­ÑQ½%@ ÀÌØíͽ¬¤¤(%}¥¹¹MÐ ÅÕ½Ðí

AQ}19UÅÕ½Ðì°ÅÕ½ÐíÁе1¹ÕèÅÕ½Ðì¤(%}¥¹¹MÐ ÅÕ½Ðí!=MPÅÕ½Ðì°ÅÕ½Ðí!½ÍÐèÅÕ½Ðì¤(%}¥¹¹MÐ ÅÕ½ÐíUMI}9PÅÕ½Ðì°ÅÕ½ÐíUÍȵ¹ÐèÅÕ½Ðì¤(%}¥¹¹MÐ ÅÕ½ÐíMIYI}95ÅÕ½Ðì°ÅÕ½Ðí!½ÍÐèÅÕ½Ðì¤(%}¥¹¹MÐ ÅÕ½Ðí
=9Q9Pµ19Q ÅÕ½Ðì°ÅÕ½Ðí
½¹Ñ¹Ðµ1¹Ñ èÅÕ½Ðì¤(%}¥¹¹MÐ ÅÕ½Ðí!QQA}
==-%ÅÕ½Ðì°ÅÕ½Ðí
½½­¥èÅÕ½Ðì¤((%1½°ÀÌØí!PôMÑÉ¥¹IáÀ ÀÌØíÉØ°ÅÕ½Ðì¡!QQ@¼Ä¸¸¤ÅÕ½Ðì°Ä¤(%¹ÙMÐ ÅÕ½ÐíMIYI}AI=Q=
=0ÅÕ½Ðì°ÀÌØí!QlÁt¤((%1½°ÀÌØí5Q ôMÑÉ¥¹IáÀ ÀÌØíÉØ°ÅÕ½Ðì¡A=MQñP¤ÅÕ½Ðì°Ä¤(%1½°ÀÌØíM8(%%ÀÌØí5Q!lÁtôÅÕ½ÐíPÅÕ½ÐìQ¡¸($$ÀÌØíM8ôMÑÉ¥¹IáÀ ÀÌØíÉØ°ÅÕ½Ðì¡A=MQñP¤ ¸¨¤ ÀäÈìü¸¨¤¡!QQ@¸¨¤ÅÕ½Ðì°Ä¤(%¹%(%%ÀÌØí5Q!lÁtôÅÕ½ÐíA=MPÅÕ½ÐìQ¡¸($$ÀÌØíM8ôMÑÉ¥¹IáÀ ÀÌØíÉØ°ÅÕ½Ðì¡A=MQñP¤ ¸¨¤¡!QQ@¸¨¤ÅÕ½Ðì°Ä¤(%¹%(%%%ÍÉÉä ÀÌØíM8¤Q¡¸($%1½°ÀÌØíM8ôU ½Õ¹ ÀÌØíM8¤($%¹ÙMÐ ÅÕ½ÐíM
I%AQ}95ÅÕ½Ðì°ÀÌØíM9lÅt¤($%%ÀÌØí5Q!lÁtôÅÕ½ÐíPÅÕ½ÐìQ¡¸($$%%ÀÌØíM8ÐìôÌQ¡¸($$$%1½°ÀÌØíEHôMÑÉ¥¹QÉ¥µ1Ð ÀÌØíM9lÉt°Ä¤($$$%¹ÙMÐ ÅÕ½ÐíEUIe}MQI%9ÅÕ½Ðì°ÀÌØíEH¤($$%¹%($%¹%($%%ÀÌØí5Q!lÁtôÅÕ½ÐíA=MPÅÕ½ÐìQ¡¸($$%1½°ÀÌØíEHôMÑÉ¥¹I¥¡Ð ÀÌØíÉØ°¹ÙÐ ÅÕ½Ðí
=9Q9Pµ19Q ÅÕ½Ð줬Ȥ($$$ÀÌØíEHôMÑÉ¥¹QÉ¥µI¥¡Ð ÀÌØíEH°È¤($$%¹ÙMÐ ÅÕ½ÐíAEUIe}MQI%9ÅÕ½Ðì°ÀÌØíEH¤($%¹%(%¹%)¹Õ¹()Õ¹}¥¹¹MÐ ÀÌØí¹Ù9µ°ÀÌØíݡФ(%1½°ÀÌØí0ôMÑÉ¥¹IáÀ ÀÌØíÉØ°ÀÌØíݡеÀìÅÕ½Ðì ¸¨¤ÀÌØìÅÕ½Ðì°Ä¤(%%9½ÐÉɽȹ%ÍÉÉä ÀÌØí0¤Q¡¸($$ÀÌØí1lÁtôMÑÉ¥¹1Ð ÀÌØí1lÁt°MÑÉ¥¹%¹MÑÈ ÀÌØí1lÁt°
I1¤´Ä¤($%¹ÙMÐ ÀÌØí¹Ù9µ°ÀÌØí1lÁt¤(%¹%)¹Õ¹(
Link to comment
Share on other sites

small fix. This is for the last version that spyrorocks? uploaded with timeout support.

There is an issue were after it processes the au3 script it does not close the socket and so it appears as though the server hangs. The fix is to remove the continueloop after you output the data.

Here is a fixed version that I have also added debuging to(right now only for the preprocessing) and it also includes reduce memory function. Reduce mem cut's it's memory usage in about half. Also there seems to be a slow leak someplace as the memory usage goes up and up the more pages that are viewed and does not ever come back down without the reducemem function.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...