Streaming HTTPs using Ruby - ruby

I wanted to open a https connection and keep it unclosed. I will be getting an xml document, which I will be saving in a file as it gets streamed.
I tried net/https, but I was able to use Net::HTTP::Get.new() method, which stops after getting one response.
My primary use is to save the xml that I am downloading into chunks of file.
Any comments/thoughts?

Got the answer...
The Net::HTTP:Get method works fine, You just need to keep reading from the same response again!

Related

HTTP request handled by apache but not by Laravel?

I have a Laravel7 app to which I send large data files (mp3/wav) and a CSV file via XHR to a POST method.
Generally, the stuff works like a charm, but for one of my testers (slower connection), it works randomly.
The thing is that I see in my Apache logs that the request is accepted, and responded with a 200 status code. The Laravel log doesn't show anything (I put some Log::debug at the start on my controller action).
If I test by myself, the log show what it has to.
In my /etc/php.ini, I set higher values for max_execution_time (3600), max_input_time(3600), post_max_size(4G), and upload_max_filesize(4G).
In my virtualhost conf, I set a TimeOut value to 3600.
Also, it seems, that when my tester sends the csv file as raw text file (.txt), the app responds, but I cannot figureout why, as we have no blocking concerning the non-audio file ...
Have you any idea ?
THanks in advance.

Post Request is too large in jmeter

Facing the issue while developing the performance script for salesforce application. The issue is, one of the apexremote post call is too large in size. Jmeter is getting hanged if i am trying to click that particular request. Even if I manage to enhance the post request somehow the cursor is not going to end of the line. Hence at the end of the line there is one CSRF which I am not able to correlate. This is only happening for only one apex post request. Because of this my orders are getting rejected while provisioning. I tried by increasing my heapsize in jmeter.bat file but no help.Searched in google but didn't find related queries. I tried the same thing with neoload and I was successfully access and enhanced that particular request.
Has anyone experienced ever! How to resolve this.
Please HELP!
1.Basically for that you need to be Patience after clicking on the request and when the request populate properly copy that post data into notepad++for correlation purpose.
2.Or other solution is Open the .JMX directly into notepad and from there copy the post data into other notepad++ instance and form there with some manipulation you can do correlation.
3.Hope you already changed the property "view.results.tree.max_size=0" in "jmeter.properties" file because may be for next correlation you will get the message like "Response data is to Large".
I had also faced the same issue several times in past, so in that case just copy the complete post body and paste it into notepad++ and modify the content there instead of modifying in jmeter itself, then paste the content back to jmeter and execute it.
This will resolve your issue but have patience while clicking on http request to copy the post body because it'll take some time to open the request properly
I have found out the solution for the very big request for which meter is getting hanged. The best solution is to take the request from the html body of the view result tree listener for the recorded original one and paste in the payload of a new sampler. Then add it in appropriate place accordingly. We can also keep a raw request and make the correlation changes there itself instead of messing around in the big request payload.

File upload fails during recording using JMeter

I attempted to record a file upload in JMeter, using port 8888, but the file failed to upload when using JMeter as the proxy ( Recording Controller and HTTP(S) Test Script Recorder ). I also tried to run this from within JMeter by choosing "Start" and viewing what I had just recorded in the View Results Tree listener. When I ran it this way, I received a 500 error for the file upload line in the View Results Tree listener.
So, I ran Charles network proxy while doing the file upload to see if the same thing happened. It did not. I was able to successfully upload the file going through the Charles network proxy on the same port 8888.
Furthermore, I took out all proxies and did the file upload successfully.
Only when I use JMeter as the proxy do I have a problem uploading the file.
In JMeter, after first running it with no changes, I then tried to change many settings like Implementation, Content Encoding, Browser-campatible headers, Retrieve All Embedded Resources, and many others to see if this would help, but it did not.
So, my gut tells me that there is a setting that is set incorrectly.
I found this post that talks about changing to use "Java" in the HTTP Request Defaults. ( Unable to upload image/file when using Jmeter HTTP Proxy server ) This did not help me though when I tried that.
I found this post also which mentions some other types of things ( Unable to record an upload file scenario in JMeter though it is possible by manual effort with specific browser settings ) . I did check the headers against Charles and they look the same.
Any ideas?
============= Edit below is adding the test plan screen shot===============
During recording you need to put the file you want to upload in jmeter/bin folder.
This is due to some limitations of browsers which do not transmit the full path.
So, apparently, I had to remove the parameters from the "Path" line and move them to the "Send Parameters With the Request:" for the line that I had the 500 error on ( the highlighted line in the screen shot I had attached above ).
In summary, here is what happened. When I recorded the file upload with JMeter using the Recording Controller and HTTP(S) Test Script Recorder, JMeter had put all of the parameters in the "Path" field for me on many of the lines that JMeter had recorded for me. I did not even think twice about what JMeter had done automatically for me. So, after I removed all text except "/" in the "Path" field and added each parameter one at a time under "Send Parameters With the request", I received a "200" status code on the line that had given me the problem. I also went into all other lines and made these same changes for the parameters. I still am not sure if the file upload is actually working, but I don't care about that right now since I did get a "200" on the line that was giving me a problem. That is enough progress to keep me moving ahead... :-).

GET request to mp3 in S3 bucket failing to download file with 206 partial content?

I have an mp3 file in an S3 bucket. I am fetching this file via ajax GET request for html5 audio playback. Intermittently, the get request will fail to download the file and thus the track will not play. The request returns "206 partial content." Oddly, it will work several times before failing and then continuing to fail.
If I disable caching in my browser (chrome), the file will download and play appropriately.
Have I configured s3 incorrectly? How can I get this mp3 file to download and play consistently?
specific file is located here: https://s3.amazonaws.com/1m40s_dev/assets/music/walden.mp3
thanks!
I've found this often relates to the MIME type set on the S3 hosted file.
Setting the correct MIME type seems to fix things.
On a side note, I struggled with a single binary file always breaking in IE. Its MIME type was application/octet-stream. I changed the MIME to binary/octet-stream and that seemed to fix downloads from IE. Not sure why.
use amazon cloudfront solve the problem
I solved this by appending a timestamp to the end of the mp3 url on page load. This forced a new download of the content each time and eliminated the caching error.
This feels more like a work around than a fix. I still don't know the root cause of the issue but if you find yourself having a similar problem and just need to move on, add a timestamp or random number as a param at the end of the url
.../assets/music/walden.mp3?[timestamp]
One other workaround I've found is, if you're using rails, turning off turbolinks makes this go away on chrome. I'll add more to my answer as I discover more.

Need to debug recorded jmeter script

I recently recorded a test script in Jmeter intended for use as a load test script (using this handy set of instructions. The recording itself worked great and I even figured out how to grab and parametrize the session ids and timestamps. However, if I run the recorded steps just as they were recorded some of them don't work -- they generate "500--Server encountered and internal error ...nested exception is java.lang.NullPointerException" The failing steps are all Ajax calls that populate sidebar elements. If I copy the request GET call (Request tab, ViewResultsTree) and paste it into a browser I get the exact same error. Do I need to record my script differently, or hand-code the ajax calls? Other, earlier steps work correctly and send the expected POST data, so it isn't the application under test or forgotten proxy settings. Currently running against Firefox 3.6.10
Any suggestions on how I can debug this would be greatly appreciated.
The first thing I'd do is determine if the java.lang.NullPointerException is happening on the client side (JMeter) or on your server. If it is happening in JMeter, than something is terribly wrong with either your script or with JMeter.
But assuming that the error is encountered on your server, then looking into the cause of the exception may shed light on what is wrong with the request issued by JMeter. Do you have access to the code where the exception is thrown?
I would also recommend comparing the request in the recording with the request that generated the error. You may need to determine which parts of the request are session-specific and ensure those fields are populated correctly.
It sounds like Jmeter isn't executing the AJAX calls, and this can be fine depending on your site. Can you simply do an HTTP request to get the pages the AJAX calls populate?
I would recommend reading this post, as it looks pretty good.
I've seen that situation caused by a few things:
a page is required to load and be cached BEFORE making the failing request;
the failing page needs to automatically redirected to work properly;
the failing page has sub-requests JMeter failed to record. Devs can help with this.
Hope this helps.

Resources