HTTP. Response code HTTP_ERROR_MALFORMED_RESPONSE
#1

I'm not quite sure if this is the right forum for it. If it is not, sorry!


I send a HTTP request to get the number of users online in my forum.


pawn Код:
forward OnForumMembersOnlineReceived(index, response_code, data[]);
public OnForumMembersOnlineReceived(index, response_code, data[])
{
    DebugPrint("OnForumMembersOnlineReceived(%d,%d,%s)",index, response_code, data);
}


task GetForumUsersOnline[30000]()
{
    new ret = HTTP(1, HTTP_GET, "77.241.198.132/ForumMembersOnline.php/", "", "OnForumMembersOnlineReceived");
}
Output from the print:
Quote:

OnForumMembersOnlineReceived(1,6,)

It seems that the URL is malformed like the response code says.. but it isn't. I've run the same code on my Linux VPS and it worked perfectly. So I'm assuming something blocks that request on my local machine(still no idea why it says the url is malformed).

I'm running Windows 7 and I checked the firewall. samp-server.exe is not blocked.

Any ideas on why could this be happening? What else could block it?
Reply
#2

All mighty bump
Reply
#3

Try to use a network sniffer! I myself never tried it, but you should give it a try (Since I have no clue what could be wrong.. Except perhaps that Windows might process data different?)
Here's a link for you: https://www.softperfect.com/products/networksniffer/ - I can't promise it's virus-free since I never used it. Please let me know if it's clean and/or if it worked. This program might give you some answers to the questions we don't have an answer for ;P

Quote:

... tool for analysing, debugging, maintaining and monitoring local networks and Internet connections. It captures the data passing through the dial-up connection or Ethernet network card, analyses this data and then represents it in a readable form.

Reply
#4

Well that was confusing... I did manage to get some results. SAMP sends two packets and gets four in exchange.

Here is the output. I excluded data that changes when I copy it here but I assume that it's the packet header.
Quote:

HTTP/1.1 200 OK
Date: Fri, 14 Nov 2014 11:40:24 GMT
Server: Apache/2.2.22 (Debian)
X-Powered-By: PHP/5.4.34-0+deb7u1
Vary: Accept-Encoding
Content-Length: 1
Connection: close
Content-Type: text/html

7

That's one of the packets which makes most sense. That number "7" IS what should be returned from my php script. So I do not understand what's wrong with the response if if'ts just there?
Reply
#5

I think it expects a properly formatted document when the Content-Type is html, i.e. <html>, <head>, etc. You could try adding this (before any output is sent):
PHP код:
header('Content-Type: text/plain; charset=utf-8'); 
This will make the browser treat it like a regular textfile.
Reply
#6

Thanks I did added it. Sadly nothing changed
Reply
#7

Why is the first parameter "1" in OnForumMembersOnlineReceived even though you put "0" in HTTP()
Reply
#8

Oh that's because I use a define for that ID which is 1 and I removed it before posting this code. Fixed it.


EDIT: the main problem is not yet fixed.
Reply
#9

Another bump.
Reply
#10

Bump.

Tried this but it was a long shot and did not help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)