简体   繁体   中英

Url Encoding Issue - Special Characters originate webserver crash

I have been searching about this info but since I'm new to web development the answers I'm getting are getting me even more confused. Basically, I have a webserver established in a Java Modem (which uses 1.3IDE) which will handle requests. These requests were being processed as long as I kept it simple.

http://87.103.87.59/teste.html?a=10&b=10

This request is normally processed. However, when applying the real deal, my webserver is crashing.

http://5.43.52.4/api.html?ATCOMMAND=AT%5EMTXTUNNEL=SMS,0035111111111,string sending test

The problem is due to two aspects. The "%" character and the string sending test. To put everything clear, handlers I'm using are these:

public InputStream is = null;
private OutputStream os = null;
private byte buffer[] = new byte[];
String streamAux="";


is = socketX.openInputStream();
os = socketX.openOutputStream();
if ((is.available()>0)||(blockX==true))
{   

//Read data sent from remote client 
numDadosLidos=is.read(buffer);
for (int i=0;i<numDadosLidos;i++)
streamAux= streamAux + (char)buffer[i];  //where the url will be stored

Basically I will need those parameters so I can use them to operate my Java device so, I think I'll need to do some sort of encoding but there's a lot of information that I can't comprehend and my 1.3 IDE is kind of keeping me stuck.

I apologize for some sort of newbie behaviour in advance.

Hope you can lend me a hand,

Thanks

For those who are interested, I basically went around the issue obliging the message to be sent using '-' character. It doesn't solve the issue, it simply solves the question with the "not-ideal" method.

Still totally interested if someone figures this one out. Thanks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM