youngj / httpserver Goto Github PK
View Code? Open in Web Editor NEWA simple HTTP server, written in PHP, that serves PHP scripts and static files
License: Other
A simple HTTP server, written in PHP, that serves PHP scripts and static files
License: Other
In a few places, short array syntax is used although the readme states PHP 5.3+. It would be great if the project remained < 5.4 as one reason to use a php web server for development is if you cannot upgrade to PHP 5.4 for some reason. I'll go ahead and submit a patch. I'm not sure if there are other PHP 5.4+ dependencies though.
[examples:master]$ git log --oneline -1
0aa0e41 allow sending the same HTTP header name multiple times in the same response (needed to set more than one cookie with Set-Cookie header)
[examples:master]$ php -v
PHP 5.3.20 (cli) (built: Dec 20 2012 06:20:32)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
[examples:master]$ php example_server.php
PHP Parse error: syntax error, unexpected '[' in /home/aaron/workspace/test/httpserver/httpserver.php on line 499
[examples:master]$ cd ..
[httpserver:master]$ find . -iname "*.php" -exec php -l {} \; | grep -v "No syntax errors"
PHP Parse error: syntax error, unexpected '[' in ./httprequest.php on line 205
Errors parsing ./httprequest.php
PHP Parse error: syntax error, unexpected '[' in ./httpserver.php on line 499
Errors parsing ./httpserver.php
PHP Parse error: syntax error, unexpected '[' in ./httpresponse.php on line 88
Errors parsing ./httpresponse.php
I have been trying to get the tests for Drupal core to pass using the Drush runserver command, but the test below in error.test was failing because it was checking the HTTP status message, but httpserver was replacing it with the default one.
$this->assertTrue(strpos($this->drupalGetHeader(':status'), '500 Service unavailable (with message)'), t('Received expected HTTP status line.'));
According to http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1 localized messages are acceptable, and Apache passes them though, so I think that is the correct behavior. Hence I added code to parse out the message from the CGI and pass it through if non empty.
Class HttpRequest collides with the internal php class HttpRequest, thus throws an error when creating a new response
Fatal error: Uncaught exception 'HttpException' with message 'HttpRequest::__construct() expects parameter 1 to be string, resource given'
Can you consider namespsacing all classes?
1.0.0-alpha1? :-)
cc @youngj
Hi,
I tried it on windows. In example_server.php i set following settings.
But when going to browser 127.0.0.1:8003, am getting Internal Server Error: php-cgi\php-cgi.exe was not found error.
function __construct() { parent::__construct(array( 'addr' => "127.0.0.1", 'port' => 8003, 'php_cgi' => "php-cgi\php-cgi.exe", )); }
In httpserver i changed $cgi_stream = fopen("cgi://{$this->php_cgi}", 'rb', false, $context);
to $cgi_stream = fopen("$this->php_cgi", 'rb', false, $context);
and am getting output somthing like binary data.
Can you please advice me how to setup it. Am using PHP 5.6 & win10
Hey @youngj, would you mind tagging a v1.0.1
release at this hash?
41dd2b7
That was, packagist.org will create the metadata for a new release, allowing depending projects like drush to clean up their composer.json files.
I'm sure others would appreciate another tag at the head of master as well, but I'm unfamiliar with those changes and not sure what version to bump.
If you wouldn't mind doing this (or tranfering the repo to another maintainer) it would really help keep those who depend on it from fragmenting the network graph any more than it needs to be :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.