view release on metacpan or search on metacpan
examples/cgi/WwwCounter/gifcat.pl view on Meta::CPAN
return(substr($buf, $from, $cnt - $from));
}
;# =====================================
;# Memory Dump
;# =====================================
sub Dump {
local($buf) = @_;
my($i);
if (length($buf) == 0) {
return;
}
for ($i = 0; $i < length($buf); $i++) {
if (($i % 16) == 0) {
printf(" ");
}
printf("%02X ", ord(substr($buf, $i, 1)));
if (($i % 16) == 15) {
printf("\n");
}
}
if (($i % 16) != 0) {
printf("\n");
examples/cgi/WwwCounter/readme.html view on Meta::CPAN
<p>é ãã«ã¦ã³ã¿ã®ã«ã¦ã³ãæ°ã¯ãã¬ãã¼ãæ©è½ããwwwcount.cnt ãã¡ã¤ã«ãç´æ¥åç
§ãããã¨ã§ç¢ºèªã§ãã¾ãã</p>
</div>
<h4>â <a name="RefFind">ãªã³ã¯å
çºè¦æ©è½</a></h4>
<div class=i>
<p>CGIã°ã©ãã£ãã¯ã«ã¦ã³ã¿ã¼ã以ä¸ã®ããã«å¼ã³åºãã¨ãèªåã®ãã¼ã ãã¼ã¸ãã©ããããªã³ã¯ããã¦ããã®ãçºè¦ãããã¨ãã§ãã¾ãã</p>
<pre class=c>
<script>
xx = escape(document.referrer);
yy = "";
for (i = 0; i < xx.length; i++) {
zz = xx.charAt(i);
yy += (zz == "+") ? "%2B" : zz;
}
document.write('<img width=96 height=19 ');
document.write('src="wwwcount.cgi?gif');
document.write('+ref+', yy, '">');
</script>
<noscript>
<img width=96 height=19 src="wwwcount.cgi?gif">
</noscript>
examples/cgi/WwwCounter/wwwcount.cgi view on Meta::CPAN
if ($g_mode eq "text") {
printf("Content-type: text/html\n");
printf("\n");
printf("$count_str\n");
# GIFã¢ã¼ã
} elsif ($g_mode eq "gif") {
printf("Content-type: image/gif\n");
printf("\n");
@files = ();
for (my $i = 0; $i < length($count_str); $i++) {
$n = substr($count_str, $i, 1);
push(@files, "$n.gif");
}
require "./gifcat.pl";
binmode(STDOUT);
print gifcat'gifcat(@files);
# é ãã«ã¦ã³ã¿ã¼ã¢ã¼ã
} elsif ($g_mode eq "hide") {
printf("Content-type: image/gif\n");
lib/AWS/Lambda/PSGI.pm view on Meta::CPAN
$env->{'HTTP_X_REQUEST_ID'} = $ctx->aws_request_id;
}
my $body = encode_utf8($payload->{body} // '');
if ($payload->{isBase64Encoded}) {
$body = decode_base64 $body;
}
open my $input, "<", \$body;
$env->{REQUEST_METHOD} = $payload->{httpMethod};
$env->{'psgi.input'} = $input;
$env->{CONTENT_LENGTH} //= bytes::length($body);
$env->{REQUEST_URI} = $payload->{path};
if ($env->{QUERY_STRING}) {
$env->{REQUEST_URI} .= '?' . $env->{QUERY_STRING};
}
$env->{PATH_INFO} = URI::Escape::uri_unescape($payload->{path});
$env->{SCRIPT_NAME} = '';
my $requestContext = $payload->{requestContext};
if ($requestContext) {
my $path = $requestContext->{path};
lib/AWS/Lambda/PSGI.pm view on Meta::CPAN
$env->{'psgix.request_id'} = $ctx->aws_request_id;
$env->{'HTTP_X_REQUEST_ID'} = $ctx->aws_request_id;
}
my $body = encode_utf8($payload->{body} // '');
if ($payload->{isBase64Encoded}) {
$body = decode_base64 $body;
}
open my $input, "<", \$body;
$env->{'psgi.input'} = $input;
$env->{CONTENT_LENGTH} //= bytes::length($body);
my $requestContext = $payload->{requestContext};
$env->{REQUEST_METHOD} = $requestContext->{http}{method};
$env->{REQUEST_URI} = $payload->{rawPath};
if ($env->{QUERY_STRING}) {
$env->{REQUEST_URI} .= '?' . $env->{QUERY_STRING};
}
$env->{PATH_INFO} = $requestContext->{http}{path};
$env->{SCRIPT_NAME} = '';
return $env;
}
lib/AWS/Lambda/ResponseWriter.pm view on Meta::CPAN
$self->close;
}
my $http = $self->{http};
my $handle = $self->{handle};
my $response;
do { $response = $handle->read_response_header }
until (substr($response->{status},0,1) ne '1');
my $data_cb = $http->_prepare_data_cb($response, {});
my $known_message_length = $handle->read_body($data_cb, $response);
$handle->close;
$response->{success} = substr( $response->{status}, 0, 1 ) eq '2';
$response->{url} = $self->{response_url};
return $response;
}
sub write {
my ($self, $data) = @_;
if ($self->{closed}) {
# already closed
croak "write failed: already closed";
}
if (!defined($data) || length($data) == 0) {
return "0E0";
}
my $chunk = sprintf '%X', length $data;
$chunk .= "\x0D\x0A";
$chunk .= $data;
$chunk .= "\x0D\x0A";
return $self->{handle}->write($chunk);
}
sub close {
my $self = shift;
if ($self->{closed}) {
# already closed
t/testdata/alb-base64-request.json view on Meta::CPAN
"requestContext": {
"elb": {
"targetGroupArn": "arn:aws:elasticloadbalancing:ap-northeast-1:123456789012:targetgroup/lambda-target/a8d0882e91e66540"
}
},
"httpMethod": "POST",
"path": "/foo/bar",
"queryStringParameters": {},
"headers": {
"accept": "*/*",
"content-length": "17",
"content-type": "application/octet-stream",
"host": "lambda-test-1234567890.ap-northeast-1.elb.amazonaws.com",
"user-agent": "curl/7.54.0",
"x-amzn-trace-id": "Root=1-5c0f091f-56087f0297986bc017de21bc",
"x-forwarded-for": "192.0.2.1",
"x-forwarded-port": "80",
"x-forwarded-proto": "http"
},
"body": "eyJoZWxsbyI6IndvcmxkIn0=",
"isBase64Encoded": true
t/testdata/alb-post-request.json view on Meta::CPAN
"requestContext": {
"elb": {
"targetGroupArn": "arn:aws:elasticloadbalancing:ap-northeast-1:123456789012:targetgroup/lambda-target/a8d0882e91e66540"
}
},
"httpMethod": "POST",
"path": "/",
"queryStringParameters": {},
"headers": {
"accept": "*/*",
"content-length": "17",
"content-type": "application/json",
"host": "lambda-test-1234567890.ap-northeast-1.elb.amazonaws.com",
"user-agent": "curl/7.54.0",
"x-amzn-trace-id": "Root=1-5c0f08ec-8a00ddf3c79b53a01fa905ba",
"x-forwarded-for": "192.0.2.1",
"x-forwarded-port": "443",
"x-forwarded-proto": "https"
},
"body": "{\"hello\":\"ããã«ã¡ã¯ä¸ç\"}",
"isBase64Encoded": false
t/testdata/apigateway-v2-base64-request.json view on Meta::CPAN
{
"version": "2.0",
"routeKey": "$default",
"rawPath": "/my/path",
"rawQueryString": "",
"headers": {
"accept": "*/*",
"content-length": "17",
"content-type": "application/octet-stream",
"host": "xxxxxxxxxx.execute-api.ap-northeast-1.amazonaws.com",
"user-agent": "curl/7.64.1",
"x-amzn-trace-id": "Root=1-5e8a9b8c-5fd89a5053994a40c1343990",
"x-forwarded-for": "192.0.2.1",
"x-forwarded-port": "443",
"x-forwarded-proto": "https"
},
"requestContext": {
"accountId": "123456789012",
t/testdata/apigateway-v2-get-request.json view on Meta::CPAN
{
"version": "2.0",
"routeKey": "$default",
"rawPath": "/my/path",
"rawQueryString": "parameter1=value1¶meter1=value2¶meter2=value",
"headers": {
"accept": "*/*",
"content-length": "0",
"header1": "value1,value2",
"header2": "value2",
"host": "xxxxxxxxxx.execute-api.ap-northeast-1.amazonaws.com",
"user-agent": "curl/7.64.1",
"x-amzn-trace-id": "Root=1-5e8a9a35-1d1dea5e28ab3c9c2a525afc",
"x-forwarded-for": "192.0.2.1",
"x-forwarded-port": "443",
"x-forwarded-proto": "https"
},
"queryStringParameters": {
t/testdata/apigateway-v2-post-request.json view on Meta::CPAN
{
"version": "2.0",
"routeKey": "$default",
"rawPath": "/my/path",
"rawQueryString": "",
"headers": {
"accept": "*/*",
"content-length": "17",
"content-type": "application/json",
"host": "xxxxxxxxxx.execute-api.ap-northeast-1.amazonaws.com",
"user-agent": "curl/7.64.1",
"x-amzn-trace-id": "Root=1-5e8a9af6-43dfdbb5896d7684515eb0ba",
"x-forwarded-for": "192.0.2.1",
"x-forwarded-port": "443",
"x-forwarded-proto": "https"
},
"requestContext": {
"accountId": "123456789012",