I am searching for clues as to why post requests larger than 128K are dying with a returned 500 or 404.
The php script includes similar to this portion
$arContext['http']['timeout'] = 60;
$context = stream_context_create($arContext);
$FileContents = file_get_contents('php://input', 0, $context);
syslog(LOG_INFO, "File length = " . strlen($FileContents);
Server side:
post_max_size = 8M
memory_limit = 32M
syslog shows file length is 131702 on these failed posts.
At this point, this seems to only be a problem with satellite connections, but not sure how that plays into the problem.
Wireshark from serverside includes:
POST /Farms/somewhere.php?id=lalala HTTP/1.1
Host: nowhere.net
Content-Length: 96
Expect: 100-continue
Connection: Keep-Alive
.G.c.!.......&.>...&..K..-.)..^B?.(..4XH..veU..kU..w...I..Xr.&C...+^H...`.............x..C=.2...HTTP/1.1 100 Continue
HTTP/1.1 200 OK
Date: Fri, 27 May 2016 22:32:39 GMT
Server: Apache/2.2.31 (Unix) mod_ssl/2.2.31 OpenSSL/1.0.1e-fips mod_bwlimited/1.4
X-Powered-By: PHP/5.5.30
Cache-Control: no-transform
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=Windows-1252
10
."5.......E..>..
0
POST /Farms/somewhere.php?id=lalala HTTP/1.1
Host: nowhere.net
Content-Length: 1745376
Expect: 100-continue
HTTP/1.1 100 Continue
.G.c.!.......&.>.--->data-->Y.I*#WHTTP/1.1 500 Internal Server Error
Date: Fri, 27 May 2016 22:32:41 GMT
Server: Apache/2.2.31 (Unix) mod_ssl/2.2.31 OpenSSL/1.0.1e-fips mod_bwlimited/1.4
Content-Length: 798
Connection: close
Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator,
webmaster#nowhere.net and inform them of the time the error occurred,
and anything you might have done that may have
caused the error.</p>
<p>More information about this error may be available
in the server error log.</p>
<p>Additionally, a 500 Internal Server Error
error was encountered while trying to use an ErrorDocument to handle the request.</p>
<hr>
<address>Apache/2.2.31 (Unix) mod_ssl/2.2.31 OpenSSL/1.0.1e-fips mod_bwlimited/1.4 Server at nowhere.net Port 80</address>
</body></html>
apache error logs show
[Sat May 28 10:47:53 2016] [error] [client nn.nn.176.108] Handler for (null) returned invalid result code 70008
[Sat May 28 10:47:53 2016] [error] [client nn.nn.176.108] File does not exist: /home/somewhere/public_html/500.shtml
It also seems that H___net is inserting Connection: Keep-Alive in the header.
Related
I have a HAProxy health check configured with the following backend:
backend php_servers
http-request set-header X-Forwarded-Port %[dst_port]
option httpchk get /health
http-check expect status 200
server php1 internal_ip:80 check
HAProxy doesn't enable the server but when using CURL I receive a 200 OK response.
Command: curl -I internal_ip/health
Response:
HTTP/1.1 200 OK
Server: nginx
Date: Thu, 01 Dec 2016 20:53:48 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Access-Control-Allow-Origin: api.flex-appeal.nl
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-transform
Why doesn't HAProxy recognize the servers as "UP"? Seems I can connect just fine.
The correct HTTP verb is GET, not get:
option httpchk GET /health
You can also check/enable the stats page: on the LastChk column you will see why the check fails. In my case, I get a 501 Not Implemented response.
I can reproduce it by doing the same request as HAProxy:
$ telnet localhost 80
Trying ::1...
Connected to localhost.
Escape character is '^]'.
get /health HTTP/1.0
HTTP/1.1 501 Not Implemented
Date: Thu, 01 Dec 2016 21:53:09 GMT
Server: Apache/2.4.23 (Unix) PHP/7.0.13
[...]
I am trying to push a page to the browser while it is being generated from a PHP script. I have no access to my hosting provider's nginx configuration but they have told me that they use nginx 1.8.1. In my phpinfo() output I can see
output_buffering 0 0
and the same script works as expected on my local PC.
This is my starting script:
<pre>
<?php
for ($i = 0; $i < 100; ++$i) {
print('<b>.</b>');
flush();
usleep(100000); // 0.1 second
}
?>
</pre>
I start getting output immediately on my local PC but I have to wait the full 10 seconds before I see anything when the page is accessed from my hosting.
These are the default response headers:
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 12 Apr 2016 12:32:05 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Vary: Accept-Encoding
X-Powered-By: PHP/5.4.45
Content-Encoding: gzip
If I add
<?php
header('X-Accel-Buffering: no');
I get
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 12 Apr 2016 12:35:10 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Vary: Accept-Encoding
X-Powered-By: PHP/5.4.45
Content-Encoding: gzip
<?php
header('X-Accel-Buffering: no');
header('Content-Encoding: identity');
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 12 Apr 2016 12:37:11 GMT
Content-Type: text/html; charset=UTF-8
Content-Length: 812
Connection: keep-alive
X-Powered-By: PHP/5.4.45
Content-Encoding: identity
Obviously, if the server knows the length of the content, it has waited for the script to finish before starting to send it to the browser.
These are the headers on my local machine:
HTTP/1.1 200 OK
Date: Tue, 12 Apr 2016 12:52:31 GMT
Server: Apache/2.4.7 (Win32) PHP/5.4.45 OpenSSL/1.0.1e
X-Powered-By: PHP/5.4.45
X-Accel-Buffering: no
Content-Encoding: identity
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=utf-8
The X-Accel-Buffering header gets passed through because I am not running nginx locally.
Are there any other headers I can pass through from PHP to stop nginx from buffering the content? So far I've only found config options, which I don't have access to.
I know it is very simple, but I can't figure it out, if I make a request with telnet like this:
machine:~ user$ telnet localhost 80
Trying ::1...
Connected to localhost.
Escape character is '^]'.
POST / HTTP/1.1
Host: localhost
Content-Length: 7
vari=e3
HTTP/1.1 200 OK
Date: Thu, 10 Jul 2014 18:06:33 GMT
Server: Apache/2.2.26 (Unix) mod_fastcgi/2.4.6 mod_wsgi/3.4 Python/2.7.6 PHP/5.5.10 mod_ssl/2.2.26 OpenSSL/0.9.8y DAV/2 mod_perl/2.0.8 Perl/v5.18.2
X-Powered-By: PHP/5.5.10
Content-Length: 7
Content-Type: text/html
VARI =
The vari variable isn't set... the response should have VARI = e3 cause I have a PHP line that outputs it:
echo "VARI = ".$_POST['vari'];
exit;
But the variable doesn't appear. Am I missing something?
Try adding the Content-type header:
Content-type: application/x-www-form-urlencoded
I test an Android application which plays videos.
The problem is the video play fail with an unknown error:
MediaPlayer(20533): Error (1,-2147483648)
The application code :
// Place the video view.
mVideoView = (VideoView) findViewById(R.id.surface_view);
// Retrieve the video path.
path = getIntent().getStringExtra(PATH);
Log.i(TAG, "Play the file : " + path);
// Set the video to play.
mVideoView.setVideoPath(path);
mVideoView.setMediaController(new MediaController(this));
mVideoView.requestFocus();
// Start the video play.
mVideoView.start();
The web server which serves the video is an Apache2 with PHP 5.
HTTP requests:
The first:
GET /.../hsf6bfs9/android.mp4 HTTP/1.1
Host: site.com
Connection: keep-alive
User-Agent: stagefright/1.2 (Linux;Android 4.2.2)
Accept-Encoding: gzip,deflate
HTTP/1.1 200 OK
Date: Tue, 04 Jun 2013 16:57:42 GMT
Server: Apache
Cache-Control: public
Content-Transfer-Encoding: binary
Content-Disposition: inline; filename="android.mp4"
Accept-Ranges: bytes
Content-Range: bytes 0-5245532/5245533
Content-Length: 5245533
Keep-Alive: timeout=30, max=100
Connection: Keep-Alive
Content-Type: video/mp4
The second:
GET /.../hsf6bfs9/android.mp4 HTTP/1.1
Host: site.com
Connection: keep-alive
User-Agent: stagefright/1.2 (Linux;Android 4.2.2)
Accept-Encoding: gzip,deflate
Range: bytes=4927056-
HTTP/1.1 206 Partial Content
Date: Tue, 04 Jun 2013 16:57:45 GMT
Server: Apache
X-Mod-H264-Streaming: version=2.2.7
Content-Length: 318511
Last-Modified: Tue, 04 Jun 2013 16:57:43 GMT
ETag: "36bc00b-500a5d-4de56facaefc0;5245567"
Accept-Ranges: bytes
Content-Range: bytes 4927056-5245566/5245567
Keep-Alive: timeout=30, max=100
Connection: Keep-Alive
Content-Type: video/mp4
And the final one before the fail:
GET /.../hsf6bfs9/android.mp4 HTTP/1.1
Host: site.com
Connection: keep-alive
User-Agent: stagefright/1.2 (Linux;Android 4.2.2)
Accept-Encoding: gzip,deflate
Range: bytes=3591808430-
HTTP/1.1 416 Requested Range Not Satisfiable
Date: Tue, 04 Jun 2013 16:57:47 GMT
Server: Apache
Keep-Alive: timeout=30, max=99
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>416 Requested Range Not Satisfiable</title>
</head><body>
<h1>Requested Range Not Satisfiable</h1>
<p>None of the range-specifier values in the Range
request-header field overlap the current extent
of the selected resource.</p>
</body></html>
Logs found:
06-05 10:23:06.577: I/NuCachedSource2(161): new range: offset= 4927056
06-05 10:23:07.618: I/NuCachedSource2(161): ERROR_END_OF_STREAM
06-05 10:23:07.618: I/NuCachedSource2(161): new range: offset= 3591808430
06-05 10:23:07.618: I/ChromiumHTTPDataSource(161): Reconnecting...
06-05 10:23:07.638: D/overlay(158): Unset pipe=RGB1 dpy=0;
06-05 10:23:07.788: I/ChromiumHTTPDataSourceSupport(161): We requested a content range, but server didn't support that. (responded with 416)
06-05 10:23:07.788: I/ChromiumHTTPDataSource(161): Reconnect failed w/ err 0xffffffe0
06-05 10:23:07.788: E/MediaPlayer(19641): error (1, -2147483648)
Do you have an idea of the problem ?
Thanks!
According to the doc, this error is thrown with the constant USE_DEFAULT_STREAM_TYPE.
Suggests using the default stream type. This may not be used in all
places a stream type is needed.
Constant Value: -2147483648 (0x80000000)
May this answer help. Maybe the mediaPlayer didn't have the right permissions to play this file so you could check this.
Finally you could check this thread which suggests that the video encoding isn't supported by Android.
Hope this helps =)
I'm using charles proxy to debug a zend amf response. The headers are coming back as:
HTTP/1.1 200 OK
Date: Sat, 29 Aug 2009 10:04:32 GMT
Server: Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8k DAV/2 PHP/5.3.0
X-Powered-By: PHP/5.3.0
Content-Length: 33
Content-Type: text/html; charset=utf-8
Should the content type be application/x-amf.
Does apache need something special to do this?
Thanks
The headers should be x-amf. Something in my php script was corrupting the output. The charles proxy item should have an 'A' icon. I didn't have to add anything in Apache.