Different response between curl and openssl s_client












0















I'm having a headache with some results.



Running the following command results in an HTTP 200 response:



$ curl -v -L www.example.com >/dev/null


while running this, and using the exact headers that curl uses results in an HTTP 403 response:



$ openssl s_client -connect www.example.com:443


There is no problem with certificate, as curl and openssl verify it. I really can't think of anything to start digging this problem, so even just a wild guess is more than welcome!



The 403 response comes from Fortigaurd servers, reading "Web filter service error: all Fortiguard servers failed to respond".



I can provide more information, such as curl and openssl outputs, if needed.










share|improve this question


















  • 1





    Are you sure you got the line endings right? The HTTP specification requires a carriage return followed by a newline after each line. Just using a newline is not correct. I also noticed that you don't specify -quiet or -ign_eof. This means that s_client will parse your text for commands like R which might appear in your headers!

    – David Schwartz
    Jan 9 at 1:22













  • @DavidSchwartz Thanks, I didn't know about those parameters. Adding -quiet and also -crlf didn't help. Still getting 403.

    – vfsoraki
    Jan 9 at 2:07











  • @DavidSchwartz I'm almost sure. I used emacs to change all endings to crlf, then copying that into my ssh session inside terminal. Unless copy/paste doesn't change line endings, all things should be fine.

    – vfsoraki
    Jan 9 at 2:21






  • 1





    (1) Copy/paste to a terminal very well can change line endings; put your request in a file (and use <file) so you can edit exactly what you want. Be sure to include the empty line after the last header (that is a vital part of HTTP format). (2) The server (or its frontend) may want SNI, which s_client doesn't do by default; try adding -servername $hostname.

    – dave_thompson_085
    Jan 9 at 5:37








  • 1





    Your curl command is requesting on port 80 (HTTP), while your openssl command is requesting on port 443 (hopefully configured for HTTPS). Check your server config.

    – garethTheRed
    Jan 9 at 7:17
















0















I'm having a headache with some results.



Running the following command results in an HTTP 200 response:



$ curl -v -L www.example.com >/dev/null


while running this, and using the exact headers that curl uses results in an HTTP 403 response:



$ openssl s_client -connect www.example.com:443


There is no problem with certificate, as curl and openssl verify it. I really can't think of anything to start digging this problem, so even just a wild guess is more than welcome!



The 403 response comes from Fortigaurd servers, reading "Web filter service error: all Fortiguard servers failed to respond".



I can provide more information, such as curl and openssl outputs, if needed.










share|improve this question


















  • 1





    Are you sure you got the line endings right? The HTTP specification requires a carriage return followed by a newline after each line. Just using a newline is not correct. I also noticed that you don't specify -quiet or -ign_eof. This means that s_client will parse your text for commands like R which might appear in your headers!

    – David Schwartz
    Jan 9 at 1:22













  • @DavidSchwartz Thanks, I didn't know about those parameters. Adding -quiet and also -crlf didn't help. Still getting 403.

    – vfsoraki
    Jan 9 at 2:07











  • @DavidSchwartz I'm almost sure. I used emacs to change all endings to crlf, then copying that into my ssh session inside terminal. Unless copy/paste doesn't change line endings, all things should be fine.

    – vfsoraki
    Jan 9 at 2:21






  • 1





    (1) Copy/paste to a terminal very well can change line endings; put your request in a file (and use <file) so you can edit exactly what you want. Be sure to include the empty line after the last header (that is a vital part of HTTP format). (2) The server (or its frontend) may want SNI, which s_client doesn't do by default; try adding -servername $hostname.

    – dave_thompson_085
    Jan 9 at 5:37








  • 1





    Your curl command is requesting on port 80 (HTTP), while your openssl command is requesting on port 443 (hopefully configured for HTTPS). Check your server config.

    – garethTheRed
    Jan 9 at 7:17














0












0








0








I'm having a headache with some results.



Running the following command results in an HTTP 200 response:



$ curl -v -L www.example.com >/dev/null


while running this, and using the exact headers that curl uses results in an HTTP 403 response:



$ openssl s_client -connect www.example.com:443


There is no problem with certificate, as curl and openssl verify it. I really can't think of anything to start digging this problem, so even just a wild guess is more than welcome!



The 403 response comes from Fortigaurd servers, reading "Web filter service error: all Fortiguard servers failed to respond".



I can provide more information, such as curl and openssl outputs, if needed.










share|improve this question














I'm having a headache with some results.



Running the following command results in an HTTP 200 response:



$ curl -v -L www.example.com >/dev/null


while running this, and using the exact headers that curl uses results in an HTTP 403 response:



$ openssl s_client -connect www.example.com:443


There is no problem with certificate, as curl and openssl verify it. I really can't think of anything to start digging this problem, so even just a wild guess is more than welcome!



The 403 response comes from Fortigaurd servers, reading "Web filter service error: all Fortiguard servers failed to respond".



I can provide more information, such as curl and openssl outputs, if needed.







curl openssl






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 9 at 1:19









vfsorakivfsoraki

1,2072914




1,2072914








  • 1





    Are you sure you got the line endings right? The HTTP specification requires a carriage return followed by a newline after each line. Just using a newline is not correct. I also noticed that you don't specify -quiet or -ign_eof. This means that s_client will parse your text for commands like R which might appear in your headers!

    – David Schwartz
    Jan 9 at 1:22













  • @DavidSchwartz Thanks, I didn't know about those parameters. Adding -quiet and also -crlf didn't help. Still getting 403.

    – vfsoraki
    Jan 9 at 2:07











  • @DavidSchwartz I'm almost sure. I used emacs to change all endings to crlf, then copying that into my ssh session inside terminal. Unless copy/paste doesn't change line endings, all things should be fine.

    – vfsoraki
    Jan 9 at 2:21






  • 1





    (1) Copy/paste to a terminal very well can change line endings; put your request in a file (and use <file) so you can edit exactly what you want. Be sure to include the empty line after the last header (that is a vital part of HTTP format). (2) The server (or its frontend) may want SNI, which s_client doesn't do by default; try adding -servername $hostname.

    – dave_thompson_085
    Jan 9 at 5:37








  • 1





    Your curl command is requesting on port 80 (HTTP), while your openssl command is requesting on port 443 (hopefully configured for HTTPS). Check your server config.

    – garethTheRed
    Jan 9 at 7:17














  • 1





    Are you sure you got the line endings right? The HTTP specification requires a carriage return followed by a newline after each line. Just using a newline is not correct. I also noticed that you don't specify -quiet or -ign_eof. This means that s_client will parse your text for commands like R which might appear in your headers!

    – David Schwartz
    Jan 9 at 1:22













  • @DavidSchwartz Thanks, I didn't know about those parameters. Adding -quiet and also -crlf didn't help. Still getting 403.

    – vfsoraki
    Jan 9 at 2:07











  • @DavidSchwartz I'm almost sure. I used emacs to change all endings to crlf, then copying that into my ssh session inside terminal. Unless copy/paste doesn't change line endings, all things should be fine.

    – vfsoraki
    Jan 9 at 2:21






  • 1





    (1) Copy/paste to a terminal very well can change line endings; put your request in a file (and use <file) so you can edit exactly what you want. Be sure to include the empty line after the last header (that is a vital part of HTTP format). (2) The server (or its frontend) may want SNI, which s_client doesn't do by default; try adding -servername $hostname.

    – dave_thompson_085
    Jan 9 at 5:37








  • 1





    Your curl command is requesting on port 80 (HTTP), while your openssl command is requesting on port 443 (hopefully configured for HTTPS). Check your server config.

    – garethTheRed
    Jan 9 at 7:17








1




1





Are you sure you got the line endings right? The HTTP specification requires a carriage return followed by a newline after each line. Just using a newline is not correct. I also noticed that you don't specify -quiet or -ign_eof. This means that s_client will parse your text for commands like R which might appear in your headers!

– David Schwartz
Jan 9 at 1:22







Are you sure you got the line endings right? The HTTP specification requires a carriage return followed by a newline after each line. Just using a newline is not correct. I also noticed that you don't specify -quiet or -ign_eof. This means that s_client will parse your text for commands like R which might appear in your headers!

– David Schwartz
Jan 9 at 1:22















@DavidSchwartz Thanks, I didn't know about those parameters. Adding -quiet and also -crlf didn't help. Still getting 403.

– vfsoraki
Jan 9 at 2:07





@DavidSchwartz Thanks, I didn't know about those parameters. Adding -quiet and also -crlf didn't help. Still getting 403.

– vfsoraki
Jan 9 at 2:07













@DavidSchwartz I'm almost sure. I used emacs to change all endings to crlf, then copying that into my ssh session inside terminal. Unless copy/paste doesn't change line endings, all things should be fine.

– vfsoraki
Jan 9 at 2:21





@DavidSchwartz I'm almost sure. I used emacs to change all endings to crlf, then copying that into my ssh session inside terminal. Unless copy/paste doesn't change line endings, all things should be fine.

– vfsoraki
Jan 9 at 2:21




1




1





(1) Copy/paste to a terminal very well can change line endings; put your request in a file (and use <file) so you can edit exactly what you want. Be sure to include the empty line after the last header (that is a vital part of HTTP format). (2) The server (or its frontend) may want SNI, which s_client doesn't do by default; try adding -servername $hostname.

– dave_thompson_085
Jan 9 at 5:37







(1) Copy/paste to a terminal very well can change line endings; put your request in a file (and use <file) so you can edit exactly what you want. Be sure to include the empty line after the last header (that is a vital part of HTTP format). (2) The server (or its frontend) may want SNI, which s_client doesn't do by default; try adding -servername $hostname.

– dave_thompson_085
Jan 9 at 5:37






1




1





Your curl command is requesting on port 80 (HTTP), while your openssl command is requesting on port 443 (hopefully configured for HTTPS). Check your server config.

– garethTheRed
Jan 9 at 7:17





Your curl command is requesting on port 80 (HTTP), while your openssl command is requesting on port 443 (hopefully configured for HTTPS). Check your server config.

– garethTheRed
Jan 9 at 7:17










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%2f1392088%2fdifferent-response-between-curl-and-openssl-s-client%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%2f1392088%2fdifferent-response-between-curl-and-openssl-s-client%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

Probability when a professor distributes a quiz and homework assignment to a class of n students.

Aardman Animations

Are they similar matrix