Git Product home page Git Product logo

webserver's People

Contributors

mscholtes avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

webserver's Issues

Binding parameter

$LISTENER.Prefixes.Add($BINDING) method requeres a trailing "/" in URL.

Exception calling "Add" with "1" argument(s): "Only Uri prefixes ending in '/' are allowed.
Parameter name: uriPrefix"

Fix

$binding = $binding.trimend('/ ') + '/'

[Suggestion] Finding pair pattern

Using regex would be easier to parse PSP files. I did not test complex files but your example works perfect.

$psp = @'
<%Param($first,$second)%>
<!doctype html>
<html>
	<head>
		<title>Powershell Server Pages (PSP) demo</title>
		<meta charset="utf-8">
	</head>
	<body>
		<H3>Powershell Server Pages (PSP) demo</H3>
		<hr />
		Hello <% = $first %>,
<%
Write-Output "<br />"
Write-Output $second
%>
		<hr />
	</body>
</html>
'@

[regex]::matches($psp,'<%([^%]+)%>','IgnorePatternWhitespace,Multiline')

Groups   : {0, 1}
Success  : True
Name     : 0
Captures : {0}
Index    : 0
Length   : 25
Value    : <%Param($first,$second)%>

Groups   : {0, 1}
Success  : True
Name     : 0
Captures : {0}
Index    : 224
Length   : 14
Value    : <% = $first %>

Groups   : {0, 1}
Success  : True
Name     : 0
Captures : {0}
Index    : 241
Length   : 51
Value    : <%
           Write-Output "<br />"
           Write-Output $second
           %>

Could not install package 'WebServer 1.0.2' from within Visual Studio

Severity Code Description Project File Line Suppression State
Error Could not install package 'WebServer 1.0.2'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

Can'T download big files >2GB

I can download smaller files (in megabytes) but not for bigger files /tested with 2.3GB and others

On the logs I see:

... deliver static content

                                                    try {
                                                            $BUFFER = [System.IO.File]::ReadAllBytes($CHECKFILE)
                                                            $RESPONSE.ContentLength64 = $BUFFER.Length
                                                            $RESPONSE.SendChunked = $FALSE
                                                            if ($MIMEHASH.ContainsKey($EXTENSION))
                                                            { # known mime type for this file's extension available
                                                                    $RESPONSE.ContentType = $MIMEHASH.Item($EXTENSION)
                                                            }
                                                            else
                                                            { # no, serve as binary download
                                                                    $RESPONSE.ContentType = "application/octet-stream"
                                                                    $FILENAME = Split-Path -Leaf $CHECKFILE
                                                                    $RESPONSE.AddHeader("Content-Disposition", "attachment; filename=$FILENAME")
                                                            }
                                                            $RESPONSE.AddHeader("Last-Modified", [IO.File]::GetLastWriteTime($CHECKFILE).ToString('r'))
                                                            $RESPONSE.AddHeader("Server", "Powershell Webserver/1.5 on ")
                                                            $RESPONSE.OutputStream.Write($BUFFER, 0, $BUFFER.Length)
                                                            # mark response as already given
                                                            $RESPONSEWRITTEN = $TRUE
                                                    }
                                                    catch
                                                    {
                                                            # just ignore. Error handling comes afterwards since not every error throws an exception
                                                    }
                                                    if ($Error.Count -gt 0)
                                                    { # retrieve error message on error
                                                            $RESULT = "`nError while downloading '$CHECKFILE'`n`n"
                                                            $RESULT += $Error[0]
                                                            $Error.Clear()
                                                    }

Memory consumption

  • Your way of logging results in high memory consumption when running for long. Better to drop it to file.
  • Using += operator with strings (and arrays) results in memory leakage. Better try list or stringbuilder types.

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.