One HTTP request, two responses?












0















I'm experimenting with my Samsung wireless speaker. I've been using Wireshark to examine and reverse engineer its API. One of the API calls I make causes strange behaviour where it seems one HTTP request returns two HTTP responses.



curl -v http://192.168.1.165:55001/UIC?cmd=%3Cname%3EGetMainInfo%3C/name%3E


Wireshark capture for the above command



What's frustrating, is that it's the second response that has the payload I'm after. How can I get to it?



Curl output



*   Trying 192.168.1.165...
* TCP_NODELAY set
* Connected to 192.168.1.165 (192.168.1.165) port 55001 (#0)
> GET /UIC?cmd=%3Cname%3EGetMainInfo%3C/name%3E HTTP/1.1
> Host: 192.168.1.165:55001
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Fri, 02 Jan 1970 09:31:25 GMT
< Server: Samsung/1.0
< Content-Type: text/html
< Content-Length: 215
< Connection: close
< Last-Modified: Fri, 02 Jan 1970 09:31:25 GMT
<
* Closing connection 0
<?xml version="1.0" encoding="UTF-8"?><UIC><method>RequestDeviceInfo</method><version>1.0</version><speakerip>192.168.1.165</speakerip><user_identifier>public</user_identifier><response result="ok"></response></UIC>


Wireshark HTTP response 1/2




<?xml version="1.0" encoding="UTF-8"?><UIC><method>RequestDeviceInfo</method><version>1.0</version><speakerip>192.168.1.165</speakerip><user_identifier>public</user_identifier><response result="ok"></response></UIC>




Wireshark HTTP response 2/2





<?xml version="1.0" encoding="UTF-8"?><UIC><method>MainInfo</method><version>1.0</version><speakerip>192.168.1.165</speakerip><user_identifier></user_identifier><response result="ok"><party>off</party><partymain></partymain><grouptype>N</grouptype><groupmainip>0.0.0.0</groupmainip><groupmainmacaddr>00:00:00:00:00:00</groupmainmacaddr><spkmacaddr>xx:xx:xx:xx:xx:xx</spkmacaddr><spkmodelname>SPK-WAM3500</spkmodelname><groupmode>none</groupmode><channeltype>invalid</channeltype><channelvolume>0</channelvolume><multichinfo>on</multichinfo><groupspknum>1</groupspknum><dfsstatus>dfsoff</dfsstatus><protocolver>2.3</protocolver><btmacaddr>xx:xx:xx:xx:xx:xx</btmacaddr></response></UIC>




netcat



Netcat did the job it seems:



$ nc 192.168.1.165 55001
GET /UIC?cmd=%3Cname%3EGetMainInfo%3C/name%3E HTTP/1.1
Host: 192.168.1.165

HTTP/1.1 200 OK
Date: Fri, 02 Jan 1970 10:53:13 GMT
Server: Samsung/1.0
Content-Type: text/html
Content-Length: 215
Connection: close
Last-Modified: Fri, 02 Jan 1970 10:53:13 GMT

<?xml version="1.0" encoding="UTF-8"?><UIC><method>RequestDeviceInfo</method><version>1.0</version><speakerip>192.168.1.165</speakerip><user_identifier>public</user_identifier><response result="ok"></response></UIC>HTTP/1.1 200 OK
Date: Fri, 02 Jan 1970 10:53:13 GMT
Server: Samsung/1.0
Content-Type: text/html
Content-Length: 684
Connection: close
Last-Modified: Fri, 02 Jan 1970 10:53:13 GMT

<?xml version="1.0" encoding="UTF-8"?><UIC><method>MainInfo</method><version>1.0</version><speakerip>192.168.1.165</speakerip><user_identifier></user_identifier><response result="ok"><party>off</party><partymain></partymain><grouptype>N</grouptype><groupmainip>0.0.0.0</groupmainip><groupmainmacaddr>00:00:00:00:00:00</groupmainmacaddr><spkmacaddr>xx:xx:xx:xx:xx:xx</spkmacaddr><spkmodelname>SPK-WAM3500</spkmodelname><groupmode>none</groupmode><channeltype>invalid</channeltype><channelvolume>0</channelvolume><multichinfo>on</multichinfo><groupspknum>1</groupspknum><dfsstatus>dfsoff</dfsstatus><protocolver>2.3</protocolver><btmacaddr>xx:xx:xx:xx:xx:xx</btmacaddr></response></UIC>









share|improve this question

























  • You can get an HTTP response in multiple packets. What is the output of your curl request?

    – slhck
    Jan 9 at 11:09











  • @slhck added curl output, thanks for looking

    – beklip
    Jan 9 at 14:51











  • @Biswapriyo added both payloads, thanks for looking

    – beklip
    Jan 9 at 14:51











  • What happens if you echo 'GET /UIC?cmd=%3Cname%3EGetMainInfo%3C/name%3E HTTP/1.1' | socat - TCP:192.168.1.165:55001 (or variants with more headers, or telnet if you don't have socat)? The point is to avoid curl reacting on the wrong length in the first response together with Connection: close.

    – dirkt
    Jan 9 at 15:23











  • @dirkt I used netcat, which seemed to do the job

    – beklip
    Jan 9 at 15:53
















0















I'm experimenting with my Samsung wireless speaker. I've been using Wireshark to examine and reverse engineer its API. One of the API calls I make causes strange behaviour where it seems one HTTP request returns two HTTP responses.



curl -v http://192.168.1.165:55001/UIC?cmd=%3Cname%3EGetMainInfo%3C/name%3E


Wireshark capture for the above command



What's frustrating, is that it's the second response that has the payload I'm after. How can I get to it?



Curl output



*   Trying 192.168.1.165...
* TCP_NODELAY set
* Connected to 192.168.1.165 (192.168.1.165) port 55001 (#0)
> GET /UIC?cmd=%3Cname%3EGetMainInfo%3C/name%3E HTTP/1.1
> Host: 192.168.1.165:55001
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Fri, 02 Jan 1970 09:31:25 GMT
< Server: Samsung/1.0
< Content-Type: text/html
< Content-Length: 215
< Connection: close
< Last-Modified: Fri, 02 Jan 1970 09:31:25 GMT
<
* Closing connection 0
<?xml version="1.0" encoding="UTF-8"?><UIC><method>RequestDeviceInfo</method><version>1.0</version><speakerip>192.168.1.165</speakerip><user_identifier>public</user_identifier><response result="ok"></response></UIC>


Wireshark HTTP response 1/2




<?xml version="1.0" encoding="UTF-8"?><UIC><method>RequestDeviceInfo</method><version>1.0</version><speakerip>192.168.1.165</speakerip><user_identifier>public</user_identifier><response result="ok"></response></UIC>




Wireshark HTTP response 2/2





<?xml version="1.0" encoding="UTF-8"?><UIC><method>MainInfo</method><version>1.0</version><speakerip>192.168.1.165</speakerip><user_identifier></user_identifier><response result="ok"><party>off</party><partymain></partymain><grouptype>N</grouptype><groupmainip>0.0.0.0</groupmainip><groupmainmacaddr>00:00:00:00:00:00</groupmainmacaddr><spkmacaddr>xx:xx:xx:xx:xx:xx</spkmacaddr><spkmodelname>SPK-WAM3500</spkmodelname><groupmode>none</groupmode><channeltype>invalid</channeltype><channelvolume>0</channelvolume><multichinfo>on</multichinfo><groupspknum>1</groupspknum><dfsstatus>dfsoff</dfsstatus><protocolver>2.3</protocolver><btmacaddr>xx:xx:xx:xx:xx:xx</btmacaddr></response></UIC>




netcat



Netcat did the job it seems:



$ nc 192.168.1.165 55001
GET /UIC?cmd=%3Cname%3EGetMainInfo%3C/name%3E HTTP/1.1
Host: 192.168.1.165

HTTP/1.1 200 OK
Date: Fri, 02 Jan 1970 10:53:13 GMT
Server: Samsung/1.0
Content-Type: text/html
Content-Length: 215
Connection: close
Last-Modified: Fri, 02 Jan 1970 10:53:13 GMT

<?xml version="1.0" encoding="UTF-8"?><UIC><method>RequestDeviceInfo</method><version>1.0</version><speakerip>192.168.1.165</speakerip><user_identifier>public</user_identifier><response result="ok"></response></UIC>HTTP/1.1 200 OK
Date: Fri, 02 Jan 1970 10:53:13 GMT
Server: Samsung/1.0
Content-Type: text/html
Content-Length: 684
Connection: close
Last-Modified: Fri, 02 Jan 1970 10:53:13 GMT

<?xml version="1.0" encoding="UTF-8"?><UIC><method>MainInfo</method><version>1.0</version><speakerip>192.168.1.165</speakerip><user_identifier></user_identifier><response result="ok"><party>off</party><partymain></partymain><grouptype>N</grouptype><groupmainip>0.0.0.0</groupmainip><groupmainmacaddr>00:00:00:00:00:00</groupmainmacaddr><spkmacaddr>xx:xx:xx:xx:xx:xx</spkmacaddr><spkmodelname>SPK-WAM3500</spkmodelname><groupmode>none</groupmode><channeltype>invalid</channeltype><channelvolume>0</channelvolume><multichinfo>on</multichinfo><groupspknum>1</groupspknum><dfsstatus>dfsoff</dfsstatus><protocolver>2.3</protocolver><btmacaddr>xx:xx:xx:xx:xx:xx</btmacaddr></response></UIC>









share|improve this question

























  • You can get an HTTP response in multiple packets. What is the output of your curl request?

    – slhck
    Jan 9 at 11:09











  • @slhck added curl output, thanks for looking

    – beklip
    Jan 9 at 14:51











  • @Biswapriyo added both payloads, thanks for looking

    – beklip
    Jan 9 at 14:51











  • What happens if you echo 'GET /UIC?cmd=%3Cname%3EGetMainInfo%3C/name%3E HTTP/1.1' | socat - TCP:192.168.1.165:55001 (or variants with more headers, or telnet if you don't have socat)? The point is to avoid curl reacting on the wrong length in the first response together with Connection: close.

    – dirkt
    Jan 9 at 15:23











  • @dirkt I used netcat, which seemed to do the job

    – beklip
    Jan 9 at 15:53














0












0








0








I'm experimenting with my Samsung wireless speaker. I've been using Wireshark to examine and reverse engineer its API. One of the API calls I make causes strange behaviour where it seems one HTTP request returns two HTTP responses.



curl -v http://192.168.1.165:55001/UIC?cmd=%3Cname%3EGetMainInfo%3C/name%3E


Wireshark capture for the above command



What's frustrating, is that it's the second response that has the payload I'm after. How can I get to it?



Curl output



*   Trying 192.168.1.165...
* TCP_NODELAY set
* Connected to 192.168.1.165 (192.168.1.165) port 55001 (#0)
> GET /UIC?cmd=%3Cname%3EGetMainInfo%3C/name%3E HTTP/1.1
> Host: 192.168.1.165:55001
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Fri, 02 Jan 1970 09:31:25 GMT
< Server: Samsung/1.0
< Content-Type: text/html
< Content-Length: 215
< Connection: close
< Last-Modified: Fri, 02 Jan 1970 09:31:25 GMT
<
* Closing connection 0
<?xml version="1.0" encoding="UTF-8"?><UIC><method>RequestDeviceInfo</method><version>1.0</version><speakerip>192.168.1.165</speakerip><user_identifier>public</user_identifier><response result="ok"></response></UIC>


Wireshark HTTP response 1/2




<?xml version="1.0" encoding="UTF-8"?><UIC><method>RequestDeviceInfo</method><version>1.0</version><speakerip>192.168.1.165</speakerip><user_identifier>public</user_identifier><response result="ok"></response></UIC>




Wireshark HTTP response 2/2





<?xml version="1.0" encoding="UTF-8"?><UIC><method>MainInfo</method><version>1.0</version><speakerip>192.168.1.165</speakerip><user_identifier></user_identifier><response result="ok"><party>off</party><partymain></partymain><grouptype>N</grouptype><groupmainip>0.0.0.0</groupmainip><groupmainmacaddr>00:00:00:00:00:00</groupmainmacaddr><spkmacaddr>xx:xx:xx:xx:xx:xx</spkmacaddr><spkmodelname>SPK-WAM3500</spkmodelname><groupmode>none</groupmode><channeltype>invalid</channeltype><channelvolume>0</channelvolume><multichinfo>on</multichinfo><groupspknum>1</groupspknum><dfsstatus>dfsoff</dfsstatus><protocolver>2.3</protocolver><btmacaddr>xx:xx:xx:xx:xx:xx</btmacaddr></response></UIC>




netcat



Netcat did the job it seems:



$ nc 192.168.1.165 55001
GET /UIC?cmd=%3Cname%3EGetMainInfo%3C/name%3E HTTP/1.1
Host: 192.168.1.165

HTTP/1.1 200 OK
Date: Fri, 02 Jan 1970 10:53:13 GMT
Server: Samsung/1.0
Content-Type: text/html
Content-Length: 215
Connection: close
Last-Modified: Fri, 02 Jan 1970 10:53:13 GMT

<?xml version="1.0" encoding="UTF-8"?><UIC><method>RequestDeviceInfo</method><version>1.0</version><speakerip>192.168.1.165</speakerip><user_identifier>public</user_identifier><response result="ok"></response></UIC>HTTP/1.1 200 OK
Date: Fri, 02 Jan 1970 10:53:13 GMT
Server: Samsung/1.0
Content-Type: text/html
Content-Length: 684
Connection: close
Last-Modified: Fri, 02 Jan 1970 10:53:13 GMT

<?xml version="1.0" encoding="UTF-8"?><UIC><method>MainInfo</method><version>1.0</version><speakerip>192.168.1.165</speakerip><user_identifier></user_identifier><response result="ok"><party>off</party><partymain></partymain><grouptype>N</grouptype><groupmainip>0.0.0.0</groupmainip><groupmainmacaddr>00:00:00:00:00:00</groupmainmacaddr><spkmacaddr>xx:xx:xx:xx:xx:xx</spkmacaddr><spkmodelname>SPK-WAM3500</spkmodelname><groupmode>none</groupmode><channeltype>invalid</channeltype><channelvolume>0</channelvolume><multichinfo>on</multichinfo><groupspknum>1</groupspknum><dfsstatus>dfsoff</dfsstatus><protocolver>2.3</protocolver><btmacaddr>xx:xx:xx:xx:xx:xx</btmacaddr></response></UIC>









share|improve this question
















I'm experimenting with my Samsung wireless speaker. I've been using Wireshark to examine and reverse engineer its API. One of the API calls I make causes strange behaviour where it seems one HTTP request returns two HTTP responses.



curl -v http://192.168.1.165:55001/UIC?cmd=%3Cname%3EGetMainInfo%3C/name%3E


Wireshark capture for the above command



What's frustrating, is that it's the second response that has the payload I'm after. How can I get to it?



Curl output



*   Trying 192.168.1.165...
* TCP_NODELAY set
* Connected to 192.168.1.165 (192.168.1.165) port 55001 (#0)
> GET /UIC?cmd=%3Cname%3EGetMainInfo%3C/name%3E HTTP/1.1
> Host: 192.168.1.165:55001
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Fri, 02 Jan 1970 09:31:25 GMT
< Server: Samsung/1.0
< Content-Type: text/html
< Content-Length: 215
< Connection: close
< Last-Modified: Fri, 02 Jan 1970 09:31:25 GMT
<
* Closing connection 0
<?xml version="1.0" encoding="UTF-8"?><UIC><method>RequestDeviceInfo</method><version>1.0</version><speakerip>192.168.1.165</speakerip><user_identifier>public</user_identifier><response result="ok"></response></UIC>


Wireshark HTTP response 1/2




<?xml version="1.0" encoding="UTF-8"?><UIC><method>RequestDeviceInfo</method><version>1.0</version><speakerip>192.168.1.165</speakerip><user_identifier>public</user_identifier><response result="ok"></response></UIC>




Wireshark HTTP response 2/2





<?xml version="1.0" encoding="UTF-8"?><UIC><method>MainInfo</method><version>1.0</version><speakerip>192.168.1.165</speakerip><user_identifier></user_identifier><response result="ok"><party>off</party><partymain></partymain><grouptype>N</grouptype><groupmainip>0.0.0.0</groupmainip><groupmainmacaddr>00:00:00:00:00:00</groupmainmacaddr><spkmacaddr>xx:xx:xx:xx:xx:xx</spkmacaddr><spkmodelname>SPK-WAM3500</spkmodelname><groupmode>none</groupmode><channeltype>invalid</channeltype><channelvolume>0</channelvolume><multichinfo>on</multichinfo><groupspknum>1</groupspknum><dfsstatus>dfsoff</dfsstatus><protocolver>2.3</protocolver><btmacaddr>xx:xx:xx:xx:xx:xx</btmacaddr></response></UIC>




netcat



Netcat did the job it seems:



$ nc 192.168.1.165 55001
GET /UIC?cmd=%3Cname%3EGetMainInfo%3C/name%3E HTTP/1.1
Host: 192.168.1.165

HTTP/1.1 200 OK
Date: Fri, 02 Jan 1970 10:53:13 GMT
Server: Samsung/1.0
Content-Type: text/html
Content-Length: 215
Connection: close
Last-Modified: Fri, 02 Jan 1970 10:53:13 GMT

<?xml version="1.0" encoding="UTF-8"?><UIC><method>RequestDeviceInfo</method><version>1.0</version><speakerip>192.168.1.165</speakerip><user_identifier>public</user_identifier><response result="ok"></response></UIC>HTTP/1.1 200 OK
Date: Fri, 02 Jan 1970 10:53:13 GMT
Server: Samsung/1.0
Content-Type: text/html
Content-Length: 684
Connection: close
Last-Modified: Fri, 02 Jan 1970 10:53:13 GMT

<?xml version="1.0" encoding="UTF-8"?><UIC><method>MainInfo</method><version>1.0</version><speakerip>192.168.1.165</speakerip><user_identifier></user_identifier><response result="ok"><party>off</party><partymain></partymain><grouptype>N</grouptype><groupmainip>0.0.0.0</groupmainip><groupmainmacaddr>00:00:00:00:00:00</groupmainmacaddr><spkmacaddr>xx:xx:xx:xx:xx:xx</spkmacaddr><spkmodelname>SPK-WAM3500</spkmodelname><groupmode>none</groupmode><channeltype>invalid</channeltype><channelvolume>0</channelvolume><multichinfo>on</multichinfo><groupspknum>1</groupspknum><dfsstatus>dfsoff</dfsstatus><protocolver>2.3</protocolver><btmacaddr>xx:xx:xx:xx:xx:xx</btmacaddr></response></UIC>






networking http wireshark






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 9 at 16:09







beklip

















asked Jan 9 at 10:56









beklipbeklip

11




11













  • You can get an HTTP response in multiple packets. What is the output of your curl request?

    – slhck
    Jan 9 at 11:09











  • @slhck added curl output, thanks for looking

    – beklip
    Jan 9 at 14:51











  • @Biswapriyo added both payloads, thanks for looking

    – beklip
    Jan 9 at 14:51











  • What happens if you echo 'GET /UIC?cmd=%3Cname%3EGetMainInfo%3C/name%3E HTTP/1.1' | socat - TCP:192.168.1.165:55001 (or variants with more headers, or telnet if you don't have socat)? The point is to avoid curl reacting on the wrong length in the first response together with Connection: close.

    – dirkt
    Jan 9 at 15:23











  • @dirkt I used netcat, which seemed to do the job

    – beklip
    Jan 9 at 15:53



















  • You can get an HTTP response in multiple packets. What is the output of your curl request?

    – slhck
    Jan 9 at 11:09











  • @slhck added curl output, thanks for looking

    – beklip
    Jan 9 at 14:51











  • @Biswapriyo added both payloads, thanks for looking

    – beklip
    Jan 9 at 14:51











  • What happens if you echo 'GET /UIC?cmd=%3Cname%3EGetMainInfo%3C/name%3E HTTP/1.1' | socat - TCP:192.168.1.165:55001 (or variants with more headers, or telnet if you don't have socat)? The point is to avoid curl reacting on the wrong length in the first response together with Connection: close.

    – dirkt
    Jan 9 at 15:23











  • @dirkt I used netcat, which seemed to do the job

    – beklip
    Jan 9 at 15:53

















You can get an HTTP response in multiple packets. What is the output of your curl request?

– slhck
Jan 9 at 11:09





You can get an HTTP response in multiple packets. What is the output of your curl request?

– slhck
Jan 9 at 11:09













@slhck added curl output, thanks for looking

– beklip
Jan 9 at 14:51





@slhck added curl output, thanks for looking

– beklip
Jan 9 at 14:51













@Biswapriyo added both payloads, thanks for looking

– beklip
Jan 9 at 14:51





@Biswapriyo added both payloads, thanks for looking

– beklip
Jan 9 at 14:51













What happens if you echo 'GET /UIC?cmd=%3Cname%3EGetMainInfo%3C/name%3E HTTP/1.1' | socat - TCP:192.168.1.165:55001 (or variants with more headers, or telnet if you don't have socat)? The point is to avoid curl reacting on the wrong length in the first response together with Connection: close.

– dirkt
Jan 9 at 15:23





What happens if you echo 'GET /UIC?cmd=%3Cname%3EGetMainInfo%3C/name%3E HTTP/1.1' | socat - TCP:192.168.1.165:55001 (or variants with more headers, or telnet if you don't have socat)? The point is to avoid curl reacting on the wrong length in the first response together with Connection: close.

– dirkt
Jan 9 at 15:23













@dirkt I used netcat, which seemed to do the job

– beklip
Jan 9 at 15:53





@dirkt I used netcat, which seemed to do the job

– beklip
Jan 9 at 15:53










0






active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1392237%2fone-http-request-two-responses%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1392237%2fone-http-request-two-responses%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Terni

A new problem with tex4ht and tikz

Sun Ra